in plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/ReplicationConsumerDialog.java [855:1066]
private void refreshUI()
{
if ( syncRepl != null )
{
removeListeners();
//
// Replication Consumer
//
// Replica ID
String replicaId = syncRepl.getRid();
if ( replicaId != null )
{
replicaIdText.setText( replicaId );
}
else
{
replicaIdText.setText( "" );
}
// Replication Type
Type replicationType = syncRepl.getType();
if ( replicationType != null )
{
replicationTypeComboViewer.setSelection( new StructuredSelection( replicationType ) );
}
else
{
replicationTypeComboViewer.setSelection( new StructuredSelection( Type.REFRESH_AND_PERSIST ) );
}
//
// Replication Provider Connection
//
// Provider
Provider provider = syncRepl.getProvider();
if ( provider != null )
{
// Provider Host
String providerHost = provider.getHost();
if ( providerHost != null )
{
hostText.setText( providerHost );
}
else
{
hostText.setText( "" );
}
// Provider Port
int providerPort = provider.getPort();
if ( providerPort != Provider.NO_PORT )
{
portText.setText( Integer.toString( providerPort ) );
}
else
{
portText.setText( "" );
}
// Encryption Type
boolean isLdaps = provider.isLdaps();
StartTls startTls = syncRepl.getStartTls();
if ( isLdaps && ( startTls == null ) )
{
// SSL Encryption (LDAPS)
encryptionMethodComboViewer.setSelection( new StructuredSelection(
EncryptionMethod.SSL_ENCRYPTION_LDAPS ) );
}
else if ( !isLdaps && ( startTls != null ) )
{
// Start TLS
encryptionMethodComboViewer.setSelection( new StructuredSelection(
EncryptionMethod.START_TLS_EXTENSION ) );
}
else
{
// No Encryption Type
encryptionMethodComboViewer
.setSelection( new StructuredSelection( EncryptionMethod.NO_ENCRYPTION ) );
}
}
else
{
hostText.setText( "" );
portText.setText( "" );
encryptionMethodComboViewer.setSelection( new StructuredSelection( EncryptionMethod.NO_ENCRYPTION ) );
}
//
// Authentication
//
BindMethod bindMethod = syncRepl.getBindMethod();
if ( ( bindMethod == null ) || ( bindMethod == BindMethod.SIMPLE ) )
{
// Simple Authentication
authenticationTabFolder.setSelection( SIMPLE_AUTHENTICATION_TAB_ITEM_INDEX );
// Bind DN
String bindDn = syncRepl.getBindDn();
if ( bindDn != null )
{
bindDnText.setText( bindDn );
}
else
{
bindDnText.setText( "" );
}
// Credentials
String credentials = syncRepl.getCredentials();
if ( credentials != null )
{
credentialsText.setText( credentials );
}
else
{
credentialsText.setText( "" );
}
// SASL Authentication Label
saslAuthenticationLabel.setText( getSaslAuthenticationLabelText() );
}
else
{
// SASL Authentication
authenticationTabFolder.setSelection( SASL_AUTHENTICATION_TAB_ITEM_INDEX );
// SASL Authentication Label
saslAuthenticationLabel.setText( getSaslAuthenticationLabelText() );
saslAuthenticationLabel.update();
// Simple Authentication fields
bindDnText.setText( "" );
credentialsText.setText( "" );
}
//
// Replication Data Configuration
//
// Search Base DN
String searchBaseDn = syncRepl.getSearchBase();
if ( searchBaseDn != null )
{
try
{
searchBaseDnEntryWidget.setInput( browserConnection, new Dn( searchBaseDn ) );
}
catch ( LdapInvalidDnException e )
{
// Silent
searchBaseDnEntryWidget.setInput( browserConnection, Dn.EMPTY_DN );
}
}
else
{
searchBaseDnEntryWidget.setInput( browserConnection, Dn.EMPTY_DN );
}
// Filter
String filter = syncRepl.getFilter();
if ( filter != null )
{
filterWidget.setFilter( filter );
}
else
{
filterWidget.setFilter( "" );
}
// Scope
Scope scope = syncRepl.getScope();
if ( scope != null )
{
scopeComboViewer.setSelection( new StructuredSelection( scope ) );
}
else
{
scopeComboViewer.setSelection( new StructuredSelection( Scope.SUB ) );
}
// Attributes
String[] attributes = syncRepl.getAttributes();
this.attributes.clear();
if ( attributes != null )
{
this.attributes.addAll( Arrays.asList( attributes ) );
attributesTableViewer.refresh();
}
// Attributes Only
attributesOnlyCheckbox.setSelection( syncRepl.isAttrsOnly() );
addListeners();
}
}