You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2017/08/18 16:24:32 UTC
svn commit: r1805443 [2/3] - in
/directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio:
connection/ui/ connection/ui/actions/ connection/ui/dialogs/
connection/ui/dnd/ connection/ui/preferences/ connecti...
Modified: directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/dnd/DragConnectionListener.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/dnd/DragConnectionListener.java?rev=1805443&r1=1805442&r2=1805443&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/dnd/DragConnectionListener.java (original)
+++ directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/dnd/DragConnectionListener.java Fri Aug 18 16:24:32 2017
@@ -86,7 +86,7 @@ public class DragConnectionListener impl
if ( dragSource.getControl() instanceof Tree )
{
- List<Object> objectList = new ArrayList<Object>();
+ List<Object> objectList = new ArrayList<>();
if ( selection != null )
{
@@ -114,5 +114,6 @@ public class DragConnectionListener impl
*/
public void dragFinished( DragSourceEvent event )
{
+ // Nothing to do
}
}
Modified: directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/dnd/DropConnectionListener.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/dnd/DropConnectionListener.java?rev=1805443&r1=1805442&r2=1805443&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/dnd/DropConnectionListener.java (original)
+++ directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/dnd/DropConnectionListener.java Fri Aug 18 16:24:32 2017
@@ -77,6 +77,7 @@ public class DropConnectionListener impl
*/
public void dragLeave( DropTargetEvent event )
{
+ // Nothing to do
}
@@ -161,6 +162,7 @@ public class DropConnectionListener impl
*/
public void dropAccept( DropTargetEvent event )
{
+ // Nothing to do
}
Modified: directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/CertificateValidationPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/CertificateValidationPreferencePage.java?rev=1805443&r1=1805442&r2=1805443&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/CertificateValidationPreferencePage.java (original)
+++ directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/CertificateValidationPreferencePage.java Fri Aug 18 16:24:32 2017
@@ -73,6 +73,7 @@ public class CertificateValidationPrefer
*/
public void init( IWorkbench workbench )
{
+ // Nothing to do
}
@@ -123,6 +124,7 @@ public class CertificateValidationPrefer
/**
* {@inheritDoc}
*/
+ @Override
protected void performDefaults()
{
verifyCertificatesButton.setSelection( ConnectionCorePlugin.getDefault().getPluginPreferences()
Modified: directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/ConnectionsPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/ConnectionsPreferencePage.java?rev=1805443&r1=1805442&r2=1805443&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/ConnectionsPreferencePage.java (original)
+++ directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/ConnectionsPreferencePage.java Fri Aug 18 16:24:32 2017
@@ -74,6 +74,7 @@ public class ConnectionsPreferencePage e
*/
public void init( IWorkbench workbench )
{
+ // Nothing to do
}
@@ -133,6 +134,7 @@ public class ConnectionsPreferencePage e
useKrb5SystemPropertiesButton.addSelectionListener( new SelectionAdapter()
{
+ @Override
public void widgetSelected( SelectionEvent event )
{
validate();
@@ -156,6 +158,7 @@ public class ConnectionsPreferencePage e
/**
* {@inheritDoc}
*/
+ @Override
protected void performDefaults()
{
NetworkProvider defaultdDefaultNetworkProvider = ConnectionCorePlugin.getDefault().getNetworkProvider(
@@ -208,6 +211,7 @@ public class ConnectionsPreferencePage e
{
case 1:
return ConnectionCoreConstants.PREFERENCE_NETWORK_PROVIDER_JNDI;
+
default:
return ConnectionCoreConstants.PREFERENCE_NETWORK_PROVIDER_APACHE_DIRECTORY_LDAP_API;
}
Modified: directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/PasswordsKeystorePreferencePage.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/PasswordsKeystorePreferencePage.java?rev=1805443&r1=1805442&r2=1805443&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/PasswordsKeystorePreferencePage.java (original)
+++ directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/PasswordsKeystorePreferencePage.java Fri Aug 18 16:24:32 2017
@@ -73,7 +73,7 @@ public class PasswordsKeystorePreference
private PasswordsKeyStoreManager passwordsKeyStoreManager;
/** The map used to backup connections passwords */
- private Map<String, String> connectionsPasswordsBackup = new ConcurrentHashMap<String, String>();
+ private Map<String, String> connectionsPasswordsBackup = new ConcurrentHashMap<>();
/** The connection manager */
private ConnectionManager connectionManager;
@@ -88,6 +88,7 @@ public class PasswordsKeystorePreference
/**
* {@inheritDoc}
*/
+ @Override
public void widgetSelected( SelectionEvent event )
{
Boolean selected = enableKeystoreCheckbox.getSelection();
@@ -128,6 +129,7 @@ public class PasswordsKeystorePreference
/**
* {@inheritDoc}
*/
+ @Override
public void widgetSelected( SelectionEvent event )
{
changeMasterPassword();
@@ -193,6 +195,7 @@ public class PasswordsKeystorePreference
/**
* {@inheritDoc}
*/
+ @Override
protected void contributeButtons( Composite parent )
{
// Increasing the number of columns on the parent layout
@@ -286,6 +289,7 @@ public class PasswordsKeystorePreference
/**
* {@inheritDoc}
*/
+ @Override
protected void performDefaults()
{
removeListeners();
@@ -392,14 +396,14 @@ public class PasswordsKeystorePreference
if ( !connectionsPasswordsBackup.isEmpty() )
{
// Adding them to the keystore
- for ( String connectionId : connectionsPasswordsBackup.keySet() )
+ for ( Map.Entry<String, String> entry : connectionsPasswordsBackup.entrySet() )
{
- Connection connection = connectionManager.getConnectionById( connectionId );
+ Connection connection = connectionManager.getConnectionById( entry.getKey() );
if ( connection != null )
{
connection.getConnectionParameter().setBindPassword(
- connectionsPasswordsBackup.get( connectionId ) );
+ entry.getValue() );
}
}
@@ -578,7 +582,6 @@ public class PasswordsKeystorePreference
if ( errorDialog.open() == MessageDialog.CANCEL )
{
// The user cancelled the action
- password = null;
return false;
}
}
Modified: directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/properties/ConnectionPropertyPage.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/properties/ConnectionPropertyPage.java?rev=1805443&r1=1805442&r2=1805443&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/properties/ConnectionPropertyPage.java (original)
+++ directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/properties/ConnectionPropertyPage.java Fri Aug 18 16:24:32 2017
@@ -39,7 +39,6 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.ui.PlatformUI;
@@ -47,7 +46,24 @@ import org.eclipse.ui.dialogs.PropertyPa
/**
- * The ConnectionPropertyPage displays the properties of a {@link Connection}.
+ * The ConnectionPropertyPage displays the properties of a {@link Connection}, in a popup containing
+ * tabs :
+ *
+ * <pre>
+ * +-------------------------------------------------------------------------------------+
+ * | Connection <- -> v |
+ * +-------------------------------------------------------------------------------------+
+ * | .-------------------.----------------.-----------------.--------------. |
+ * | .-----| Network Parameter | Authentication | Browser Options | edit Options |-----. |
+ * | | `-------------------'----------------'-----------------'--------------' | |
+ * | | | |
+ * .......................................................................................
+ * | | | |
+ * | `---------------------------------------------------------------------------------' |
+ * | [] Read-Only (prevents any add, delete, modify or rename operations |
+ * +-------------------------------------------------------------------------------------+
+ *
+ * </pe>
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
@@ -56,9 +72,6 @@ public class ConnectionPropertyPage exte
/** The tab folder. */
private TabFolder tabFolder;
- /** The tabs. */
- private TabItem[] tabs;
-
/** The connection property pages. */
private ConnectionParameterPage[] pages;
@@ -88,10 +101,12 @@ public class ConnectionPropertyPage exte
public ConnectionParameter getTestConnectionParameters()
{
ConnectionParameter connectionParameter = new ConnectionParameter();
- for ( int i = 0; i < pages.length; i++ )
+
+ for ( ConnectionParameterPage page : pages )
{
- pages[i].saveParameters( connectionParameter );
+ page.saveParameters( connectionParameter );
}
+
return connectionParameter;
}
@@ -99,6 +114,7 @@ public class ConnectionPropertyPage exte
/**
* @see org.eclipse.jface.dialogs.DialogPage#setMessage(java.lang.String)
*/
+ @Override
public void setMessage( String message )
{
super.setMessage( message, PropertyPage.WARNING );
@@ -106,24 +122,16 @@ public class ConnectionPropertyPage exte
/**
- * @see org.eclipse.jface.preference.PreferencePage#setErrorMessage(java.lang.String)
- */
- public void setErrorMessage( String errorMessage )
- {
- super.setErrorMessage( errorMessage );
- }
-
-
- /**
* Validates the dialog.
*/
private void validate()
{
int index = tabFolder.getSelectionIndex();
- ConnectionParameterPage page = index >= 0 ? pages[tabFolder.getSelectionIndex()] : null;
- if ( page != null
- && ( page.getMessage() != null || page.getInfoMessage() != null || page.getErrorMessage() != null ) )
+
+ if ( index >= 0 )
{
+ ConnectionParameterPage page = pages[tabFolder.getSelectionIndex()];
+
if ( page.getMessage() != null )
{
setMessage( page.getMessage() );
@@ -136,30 +144,37 @@ public class ConnectionPropertyPage exte
{
setMessage( null );
}
- setErrorMessage( page.getErrorMessage() );
+
+ if ( page.getErrorMessage() != null )
+ {
+ setErrorMessage( page.getErrorMessage() );
+ }
+
setValid( page.isValid() );
}
else
{
- for ( int i = 0; i < pages.length; i++ )
+ for ( ConnectionParameterPage page : pages )
{
- if ( pages[i].getMessage() != null || pages[i].getInfoMessage() != null
- || pages[i].getErrorMessage() != null )
+ if ( page.getMessage() != null )
{
- if ( page.getMessage() != null )
- {
- setMessage( page.getMessage() );
- }
- else if ( page.getInfoMessage() != null )
- {
- setMessage( page.getInfoMessage() );
- }
- else
- {
- setMessage( null );
- }
- setErrorMessage( pages[i].getErrorMessage() );
- setValid( pages[i].isValid() );
+ setMessage( page.getMessage() );
+ }
+ else if ( page.getInfoMessage() != null )
+ {
+ setMessage( page.getInfoMessage() );
+ }
+ else
+ {
+ setMessage( null );
+ }
+
+ if ( page.getErrorMessage() != null )
+ {
+
+ setErrorMessage( page.getErrorMessage() );
+ setValid( page.isValid() );
+
return;
}
}
@@ -174,10 +189,12 @@ public class ConnectionPropertyPage exte
static Connection getConnection( Object element )
{
Connection connection = null;
+
if ( element instanceof IAdaptable )
{
- connection = ( Connection ) ( ( IAdaptable ) element ).getAdapter( Connection.class );
+ connection = ( ( IAdaptable ) element ).getAdapter( Connection.class );
}
+
return connection;
}
@@ -198,25 +215,24 @@ public class ConnectionPropertyPage exte
.getPasswordsKeyStoreManager();
// Checking if the keystore is not loaded
- if ( !passwordsKeyStoreManager.isLoaded() )
+ // Asking the user to load the keystore
+ if ( !passwordsKeyStoreManager.isLoaded() && !PasswordsKeyStoreManagerUtils.askUserToLoadKeystore() )
{
- // Asking the user to load the keystore
- if ( !PasswordsKeyStoreManagerUtils.askUserToLoadKeystore() )
- {
- // The user failed to load the keystore and cancelled
- Label label = BaseWidgetUtils
- .createLabel(
- parent,
- Messages
- .getString( "ConnectionPropertyPage.AccessToPasswordsKeystoreRequiredToViewProperties" ), 1 ); //$NON-NLS-1$
- return label;
- }
+ // The user failed to load the keystore and cancelled
+ return BaseWidgetUtils
+ .createLabel(
+ parent,
+ Messages
+ .getString( "ConnectionPropertyPage.AccessToPasswordsKeystoreRequiredToViewProperties" ), 1 ); //$NON-NLS-1$
}
}
+ // Select the connection in the tree
Connection connection = getConnection( getElement() );
+
if ( connection != null )
{
+ // Create the tabs for this connection
super
.setMessage( Messages.getString( "ConnectionPropertyPage.Connection" ) + Utils.shorten( connection.getName(), 30 ) ); //$NON-NLS-1$
@@ -224,7 +240,8 @@ public class ConnectionPropertyPage exte
tabFolder = new TabFolder( parent, SWT.TOP );
- tabs = new TabItem[pages.length];
+ TabItem[] tabs = new TabItem[pages.length];
+
for ( int i = 0; i < pages.length; i++ )
{
Composite composite = new Composite( tabFolder, SWT.NONE );
@@ -242,9 +259,7 @@ public class ConnectionPropertyPage exte
}
else
{
- Label label = BaseWidgetUtils.createLabel( parent, Messages
- .getString( "ConnectionPropertyPage.NoConnection" ), 1 ); //$NON-NLS-1$
- return label;
+ return BaseWidgetUtils.createLabel( parent, Messages.getString( "ConnectionPropertyPage.NoConnection" ), 1 ); //$NON-NLS-1$
}
}
@@ -265,19 +280,20 @@ public class ConnectionPropertyPage exte
}
// get current connection parameters
- Connection connection = ( Connection ) getConnection( getElement() );
+ Connection connection = getConnection( getElement() );
// save modified parameters
boolean parametersModified = false;
boolean reconnectionRequired = false;
ConnectionParameter connectionParameter = new ConnectionParameter();
connectionParameter.setId( connection.getConnectionParameter().getId() );
- for ( int i = 0; i < pages.length; i++ )
+
+ for ( ConnectionParameterPage page : pages )
{
- pages[i].saveParameters( connectionParameter );
- pages[i].saveDialogSettings();
- parametersModified |= pages[i].areParametersModifed();
- reconnectionRequired |= pages[i].isReconnectionRequired();
+ page.saveParameters( connectionParameter );
+ page.saveDialogSettings();
+ parametersModified |= page.areParametersModifed();
+ reconnectionRequired |= page.isReconnectionRequired();
}
if ( parametersModified )
Modified: directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/AuthenticationParameterPage.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/AuthenticationParameterPage.java?rev=1805443&r1=1805442&r2=1805443&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/AuthenticationParameterPage.java (original)
+++ directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/AuthenticationParameterPage.java Fri Aug 18 16:24:32 2017
@@ -51,12 +51,8 @@ import org.eclipse.jface.dialogs.Message
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -88,6 +84,9 @@ public class AuthenticationParameterPage
/** The URL simple constant */
private static final String X_AUTH_METHOD_SIMPLE = "Simple"; //$NON-NLS-1$
+ /** The URL PLAIN constant */
+ private static final String X_AUTH_METHOD_PLAIN = "PLAIN"; //$NON-NLS-1$
+
/** The URL DIGEST-MD5 constant */
private static final String X_AUTH_METHOD_DIGEST_MD5 = "DIGEST-MD5"; //$NON-NLS-1$
@@ -108,22 +107,22 @@ public class AuthenticationParameterPage
/** The SASL QOP constant */
private static final String X_SASL_QOP = "X-SASL-QOP"; //$NON-NLS-1$
-
+
/** The SASL QOP AUTH-INT constant */
private static final String X_SASL_QOP_AUTH_INT = "AUTH-INT"; //$NON-NLS-1$
-
+
/** The SASL QOP AUTH-INT PROV constant */
private static final String X_SASL_QOP_AUTH_INT_PRIV = "AUTH-INT-PRIV"; //$NON-NLS-1$
-
+
/** The SASL Security Strength constant */
private static final String X_SASL_SEC_STRENGTH = "X-SASL-SEC-STRENGTH"; //$NON-NLS-1$
-
+
/** The SASL Medium security constant */
private static final String X_SASL_SEC_STRENGTH_MEDIUM = "MEDIUM"; //$NON-NLS-1$
-
+
/** The SASL Low security constant */
private static final String X_SASL_SEC_STRENGTH_LOW = "LOW"; //$NON-NLS-1$
-
+
/** The SASL no-mutual-auth constant */
private static final String X_SASL_NO_MUTUAL_AUTH = "X-SASL-NO-MUTUAL-AUTH"; //$NON-NLS-1$
@@ -146,6 +145,9 @@ public class AuthenticationParameterPage
/** The text widget to input bind password */
private Text bindPasswordText;
+ /** The text widget to input the SASL PLAIN autzid (if selected) */
+ private Text authzidText;
+
/** The checkbox to choose if the bind password should be saved on disk */
private Button saveBindPasswordButton;
@@ -183,16 +185,16 @@ public class AuthenticationParameterPage
{
case 1:
return ConnectionParameter.AuthenticationMethod.SIMPLE;
-
+
case 2:
return ConnectionParameter.AuthenticationMethod.SASL_DIGEST_MD5;
-
+
case 3:
return ConnectionParameter.AuthenticationMethod.SASL_CRAM_MD5;
-
+
case 4:
return ConnectionParameter.AuthenticationMethod.SASL_GSSAPI;
-
+
default:
return ConnectionParameter.AuthenticationMethod.NONE;
}
@@ -221,6 +223,17 @@ public class AuthenticationParameterPage
}
+ /**
+ * Gets the bind authzid.
+ *
+ * @return the authzid
+ */
+ private String getAuthzid()
+ {
+ return authzidText.getText();
+ }
+
+
private String getSaslRealm()
{
return saslRealmText.getText();
@@ -233,10 +246,10 @@ public class AuthenticationParameterPage
{
case 1:
return SaslQoP.AUTH_INT;
-
+
case 2:
return SaslQoP.AUTH_CONF;
-
+
default:
return SaslQoP.AUTH;
}
@@ -249,10 +262,10 @@ public class AuthenticationParameterPage
{
case 1:
return SaslSecurityStrength.MEDIUM;
-
+
case 2:
return SaslSecurityStrength.LOW;
-
+
default:
return SaslSecurityStrength.HIGH;
}
@@ -292,7 +305,7 @@ public class AuthenticationParameterPage
private int getKdcPort()
{
String krb5ConfigPort = krb5ConfigManualPortText.getText();
-
+
if ( Strings.isEmpty( krb5ConfigPort ) )
{
return 0;
@@ -324,9 +337,8 @@ public class AuthenticationParameterPage
private Connection getTestConnection()
{
ConnectionParameter connectionParameter = connectionParameterPageModifyListener.getTestConnectionParameters();
- Connection conn = new Connection( connectionParameter );
-
- return conn;
+
+ return new Connection( connectionParameter );
}
@@ -344,14 +356,14 @@ public class AuthenticationParameterPage
Composite groupComposite = BaseWidgetUtils.createColumnContainer( group1, 1, 1 );
String[] authMethods = new String[]
- {
- Messages.getString( "AuthenticationParameterPage.AnonymousAuthentication" ), //$NON-NLS-1$
- Messages.getString( "AuthenticationParameterPage.SimpleAuthentication" ), //$NON-NLS-1$
- Messages.getString( "AuthenticationParameterPage.DigestMD5" ), //$NON-NLS-1$
- Messages.getString( "AuthenticationParameterPage.CramMD5" ), //$NON-NLS-1$
- Messages.getString( "AuthenticationParameterPage.GSSAPI" ) //$NON-NLS-1$
- };
-
+ {
+ Messages.getString( "AuthenticationParameterPage.AnonymousAuthentication" ), //$NON-NLS-1$
+ Messages.getString( "AuthenticationParameterPage.SimpleAuthentication" ), //$NON-NLS-1$
+ Messages.getString( "AuthenticationParameterPage.DigestMD5" ), //$NON-NLS-1$
+ Messages.getString( "AuthenticationParameterPage.CramMD5" ), //$NON-NLS-1$
+ Messages.getString( "AuthenticationParameterPage.GSSAPI" ) //$NON-NLS-1$
+ };
+
authenticationMethodCombo = BaseWidgetUtils.createReadonlyCombo( groupComposite, authMethods, 1, 2 );
// Authentication Parameter
@@ -366,6 +378,10 @@ public class AuthenticationParameterPage
ConnectionUIConstants.DIALOGSETTING_KEY_PRINCIPAL_HISTORY );
bindPrincipalCombo = BaseWidgetUtils.createCombo( composite, dnHistory, -1, 2 );
+ BaseWidgetUtils.createLabel( composite, Messages.getString( "AuthenticationParameterPage.Authzid" ), 1 ); //$NON-NLS-1$
+ authzidText = BaseWidgetUtils.createText( composite, "SASL PLAIN only", 2 ); //$NON-NLS-1$
+ authzidText.setEnabled( false );
+
BaseWidgetUtils.createLabel( composite, Messages.getString( "AuthenticationParameterPage.BindPassword" ), 1 ); //$NON-NLS-1$
bindPasswordText = BaseWidgetUtils.createPasswordText( composite, StringUtils.EMPTY, 2 ); //$NON-NLS-1$
@@ -417,13 +433,14 @@ public class AuthenticationParameterPage
/**
* {@inheritDoc}
*/
+ @Override
public void expansionStateChanged( ExpansionEvent event )
{
ExpandableComposite excomposite = ( ExpandableComposite ) event.getSource();
excomposite.getParent().setSize( excomposite.getParent().computeSize( SWT.DEFAULT, SWT.DEFAULT ) );
}
} );
-
+
return excomposite;
}
@@ -436,26 +453,26 @@ public class AuthenticationParameterPage
saslRealmText = BaseWidgetUtils.createCombo( saslComposite, saslHistory, -1, 1 );
BaseWidgetUtils.createLabel( saslComposite, Messages.getString( "AuthenticationParameterPage.SaslQop" ), 1 ); //$NON-NLS-1$
-
+
String[] qops = new String[]
- {
- Messages.getString( "AuthenticationParameterPage.SaslQopAuth" ), //$NON-NLS-1$
- Messages.getString( "AuthenticationParameterPage.SaslQopAuthInt" ), //$NON-NLS-1$
- Messages.getString( "AuthenticationParameterPage.SaslQopAuthIntPriv" ) //$NON-NLS-1$
- };
-
+ {
+ Messages.getString( "AuthenticationParameterPage.SaslQopAuth" ), //$NON-NLS-1$
+ Messages.getString( "AuthenticationParameterPage.SaslQopAuthInt" ), //$NON-NLS-1$
+ Messages.getString( "AuthenticationParameterPage.SaslQopAuthIntPriv" ) //$NON-NLS-1$
+ };
+
saslQopCombo = BaseWidgetUtils.createReadonlyCombo( saslComposite, qops, 0, 1 );
BaseWidgetUtils.createLabel( saslComposite, Messages
.getString( "AuthenticationParameterPage.SaslSecurityStrength" ), 1 ); //$NON-NLS-1$
-
+
String[] securityStrengths = new String[]
- {
- Messages.getString( "AuthenticationParameterPage.SaslSecurityStrengthHigh" ), //$NON-NLS-1$
- Messages.getString( "AuthenticationParameterPage.SaslSecurityStrengthMedium" ), //$NON-NLS-1$
- Messages.getString( "AuthenticationParameterPage.SaslSecurityStrengthLow" ) //$NON-NLS-1$
- };
-
+ {
+ Messages.getString( "AuthenticationParameterPage.SaslSecurityStrengthHigh" ), //$NON-NLS-1$
+ Messages.getString( "AuthenticationParameterPage.SaslSecurityStrengthMedium" ), //$NON-NLS-1$
+ Messages.getString( "AuthenticationParameterPage.SaslSecurityStrengthLow" ) //$NON-NLS-1$
+ };
+
saslSecurityStrengthCombo = BaseWidgetUtils.createReadonlyCombo( saslComposite, securityStrengths, 0, 1 );
saslMutualAuthenticationButton = BaseWidgetUtils.createCheckbox( saslComposite, Messages
@@ -489,7 +506,8 @@ public class AuthenticationParameterPage
krb5ConfigFileText = BaseWidgetUtils.createText( configComposite, StringUtils.EMPTY, 2 ); //$NON-NLS-1$
krb5ConfigManualButton = BaseWidgetUtils.createRadiobutton( configComposite, Messages
.getString( "AuthenticationParameterPage.Krb5ConfigManual" ), 1 ); //$NON-NLS-1$
- BaseWidgetUtils.createLabel( configComposite, Messages.getString( "AuthenticationParameterPage.Krb5Realm" ), 1 ); //$NON-NLS-1$
+ BaseWidgetUtils.createLabel( configComposite, Messages.getString( "AuthenticationParameterPage.Krb5Realm" ), //$NON-NLS-1$
+ 1 );
krb5ConfigManualRealmText = BaseWidgetUtils.createText( configComposite, StringUtils.EMPTY, 1 ); //$NON-NLS-1$
BaseWidgetUtils.createSpacer( configComposite, 1 );
BaseWidgetUtils.createLabel( configComposite,
@@ -522,7 +540,7 @@ public class AuthenticationParameterPage
Preferences preferences = ConnectionCorePlugin.getDefault().getPluginPreferences();
boolean useKrb5SystemProperties = preferences
.getBoolean( ConnectionCoreConstants.PREFERENCE_USE_KRB5_SYSTEM_PROPERTIES );
-
+
if ( krb5Composite != null )
{
krb5CredentialConfigurationUseNativeButton.setEnabled( isGssapiEnabled() && !useKrb5SystemProperties );
@@ -541,38 +559,40 @@ public class AuthenticationParameterPage
krb5ConfigManualPortText.setEnabled( isGssapiEnabled() && krb5ConfigManualButton.getSelection()
&& !useKrb5SystemProperties );
}
-
+
bindPrincipalCombo.setEnabled( isPrincipalPasswordEnabled() );
bindPasswordText.setEnabled( isPrincipalPasswordEnabled() && isSaveBindPassword() );
saveBindPasswordButton.setEnabled( isPrincipalPasswordEnabled() );
checkPrincipalPasswordAuthButton
.setEnabled( ( isPrincipalPasswordEnabled() && isSaveBindPassword()
- && !bindPrincipalCombo.getText().equals( StringUtils.EMPTY ) && !bindPasswordText.getText().equals( StringUtils.EMPTY ) ) || isGssapiEnabled() ); //$NON-NLS-1$ //$NON-NLS-2$
+ && !bindPrincipalCombo.getText().equals( StringUtils.EMPTY )
+ && !bindPasswordText.getText().equals( StringUtils.EMPTY ) ) || isGssapiEnabled() ); //$NON-NLS-1$ //$NON-NLS-2$
// validate input fields
message = null;
infoMessage = null;
errorMessage = null;
-
+
if ( isPrincipalPasswordEnabled() )
{
if ( isSaveBindPassword() && Strings.isEmpty( bindPasswordText.getText() ) ) //$NON-NLS-1$
{
message = Messages.getString( "AuthenticationParameterPage.PleaseEnterBindPassword" ); //$NON-NLS-1$
}
-
+
if ( Strings.isEmpty( bindPrincipalCombo.getText() ) && !isGssapiEnabled() ) //$NON-NLS-1$
{
message = Messages.getString( "AuthenticationParameterPage.PleaseEnterBindDNOrUser" ); //$NON-NLS-1$
}
}
- if ( isSaslRealmTextEnabled() &&Strings.isEmpty( saslRealmText.getText() ) ) //$NON-NLS-1$
+ if ( isSaslRealmTextEnabled() && Strings.isEmpty( saslRealmText.getText() ) ) //$NON-NLS-1$
{
infoMessage = Messages.getString( "AuthenticationParameterPage.PleaseEnterSaslRealm" ); //$NON-NLS-1$
}
- if ( isGssapiEnabled() && krb5ConfigFileButton.getSelection() && Strings.isEmpty( krb5ConfigFileText.getText() ) ) //$NON-NLS-1$
+ if ( isGssapiEnabled() && krb5ConfigFileButton.getSelection()
+ && Strings.isEmpty( krb5ConfigFileText.getText() ) ) //$NON-NLS-1$
{
message = Messages.getString( "AuthenticationParameterPage.PleaseEnterKrb5ConfigFile" ); //$NON-NLS-1$
}
@@ -583,12 +603,12 @@ public class AuthenticationParameterPage
{
message = Messages.getString( "AuthenticationParameterPage.PleaseEnterKrb5Port" ); //$NON-NLS-1$
}
-
+
if ( Strings.isEmpty( krb5ConfigManualHostText.getText() ) ) //$NON-NLS-1$
{
message = Messages.getString( "AuthenticationParameterPage.PleaseEnterKrb5Host" ); //$NON-NLS-1$
}
-
+
if ( Strings.isEmpty( krb5ConfigManualRealmText.getText() ) ) //$NON-NLS-1$
{
message = Messages.getString( "AuthenticationParameterPage.PleaseEnterKrb5Realm" ); //$NON-NLS-1$
@@ -607,8 +627,9 @@ public class AuthenticationParameterPage
return ( getAuthenticationMethod() == AuthenticationMethod.SIMPLE )
|| ( getAuthenticationMethod() == AuthenticationMethod.SASL_DIGEST_MD5 )
|| ( getAuthenticationMethod() == AuthenticationMethod.SASL_CRAM_MD5 )
- || ( getAuthenticationMethod() == AuthenticationMethod.SASL_GSSAPI && krb5CredentialConfigurationObtainTgtButton
- .getSelection() );
+ || ( getAuthenticationMethod() == AuthenticationMethod.SASL_GSSAPI
+ && krb5CredentialConfigurationObtainTgtButton
+ .getSelection() );
}
@@ -621,7 +642,7 @@ public class AuthenticationParameterPage
private boolean isSaslEnabled()
{
AuthenticationMethod authenticationMethod = getAuthenticationMethod();
-
+
return ( authenticationMethod == AuthenticationMethod.SASL_DIGEST_MD5 )
|| ( authenticationMethod == AuthenticationMethod.SASL_CRAM_MD5 )
|| ( authenticationMethod == AuthenticationMethod.SASL_GSSAPI );
@@ -642,7 +663,7 @@ public class AuthenticationParameterPage
{
connectionParameter = parameter;
AuthenticationMethod authenticationMethod = parameter.getAuthMethod();
-
+
int index = authenticationMethod.getValue();
authenticationMethodCombo.select( index );
bindPrincipalCombo.setText( CommonUIUtils.getTextValue( parameter.getBindPrincipal() ) );
@@ -668,7 +689,7 @@ public class AuthenticationParameterPage
}
bindPasswordText.setText( CommonUIUtils.getTextValue( bindPassword ) );
-
+
// The Save Bind Password Button
saveBindPasswordButton.setSelection( bindPassword != null );
@@ -677,48 +698,48 @@ public class AuthenticationParameterPage
// The SASL QOP combo
int qopIndex;
-
+
SaslQoP saslQop = parameter.getSaslQop();
-
+
switch ( saslQop )
{
- case AUTH_INT :
+ case AUTH_INT:
qopIndex = 1;
break;
-
- case AUTH_CONF :
+
+ case AUTH_CONF:
qopIndex = 2;
break;
-
- default :
+
+ default:
qopIndex = 0;
break;
}
saslQopCombo.select( qopIndex );
-
+
// The Security Strength
int securityStrengthIndex;
-
+
SaslSecurityStrength securityStrength = parameter.getSaslSecurityStrength();
-
- switch ( securityStrength )
+
+ switch ( securityStrength )
{
- case MEDIUM :
+ case MEDIUM:
securityStrengthIndex = 1;
break;
-
- case LOW :
+
+ case LOW:
securityStrengthIndex = 2;
break;
-
- default :
+
+ default:
securityStrengthIndex = 0;
break;
}
saslSecurityStrengthCombo.select( securityStrengthIndex );
-
+
// The Mutual Authentication Button
saslMutualAuthenticationButton.setSelection( parameter.isSaslMutualAuthentication() );
@@ -746,39 +767,23 @@ public class AuthenticationParameterPage
/**
* {@inheritDoc}
*/
+ @Override
public void widgetSelected( SelectionEvent event )
{
connectionPageModified();
}
} );
- bindPrincipalCombo.addModifyListener( new ModifyListener()
- {
- /**
- * {@inheritDoc}
- */
- public void modifyText( ModifyEvent event )
- {
- connectionPageModified();
- }
- } );
+ bindPrincipalCombo.addModifyListener( event -> connectionPageModified() );
- bindPasswordText.addModifyListener( new ModifyListener()
- {
- /**
- * {@inheritDoc}
- */
- public void modifyText( ModifyEvent event )
- {
- connectionPageModified();
- }
- } );
+ bindPasswordText.addModifyListener( event -> connectionPageModified() );
saveBindPasswordButton.addSelectionListener( new SelectionAdapter()
{
/**
* {@inheritDoc}
*/
+ @Override
public void widgetSelected( SelectionEvent event )
{
if ( !saveBindPasswordButton.getSelection() )
@@ -786,7 +791,7 @@ public class AuthenticationParameterPage
// Reseting the previously saved password (if any)
bindPasswordText.setText( StringUtils.EMPTY ); //$NON-NLS-1$
}
-
+
connectionPageModified();
}
} );
@@ -796,12 +801,13 @@ public class AuthenticationParameterPage
/**
* {@inheritDoc}
*/
+ @Override
public void widgetSelected( SelectionEvent event )
{
Connection connection = getTestConnection();
CheckBindRunnable runnable = new CheckBindRunnable( connection );
IStatus status = RunnableContextRunner.execute( runnable, runnableContext, true );
-
+
if ( status.isOK() )
{
MessageDialog.openInformation( Display.getDefault().getActiveShell(), Messages
@@ -811,22 +817,14 @@ public class AuthenticationParameterPage
}
} );
- saslRealmText.addModifyListener( new ModifyListener()
- {
- /**
- * {@inheritDoc}
- */
- public void modifyText( ModifyEvent even )
- {
- connectionPageModified();
- }
- } );
+ saslRealmText.addModifyListener( event -> connectionPageModified() );
saslQopCombo.addSelectionListener( new SelectionAdapter()
{
/**
* {@inheritDoc}
*/
+ @Override
public void widgetSelected( SelectionEvent event )
{
connectionPageModified();
@@ -835,6 +833,7 @@ public class AuthenticationParameterPage
saslSecurityStrengthCombo.addSelectionListener( new SelectionAdapter()
{
+ @Override
public void widgetSelected( SelectionEvent event )
{
connectionPageModified();
@@ -846,6 +845,7 @@ public class AuthenticationParameterPage
/**
* {@inheritDoc}
*/
+ @Override
public void widgetSelected( SelectionEvent event )
{
connectionPageModified();
@@ -857,6 +857,7 @@ public class AuthenticationParameterPage
/**
* {@inheritDoc}
*/
+ @Override
public void widgetSelected( SelectionEvent event )
{
connectionPageModified();
@@ -865,6 +866,7 @@ public class AuthenticationParameterPage
krb5CredentialConfigurationObtainTgtButton.addSelectionListener( new SelectionAdapter()
{
+ @Override
public void widgetSelected( SelectionEvent event )
{
connectionPageModified();
@@ -876,6 +878,7 @@ public class AuthenticationParameterPage
/**
* {@inheritDoc}
*/
+ @Override
public void widgetSelected( SelectionEvent event )
{
connectionPageModified();
@@ -887,80 +890,39 @@ public class AuthenticationParameterPage
/**
* {@inheritDoc}
*/
+ @Override
public void widgetSelected( SelectionEvent event )
{
connectionPageModified();
}
} );
- krb5ConfigFileText.addModifyListener( new ModifyListener()
- {
- /**
- * {@inheritDoc}
- */
- public void modifyText( ModifyEvent event )
- {
- connectionPageModified();
- }
- } );
+ krb5ConfigFileText.addModifyListener( event -> connectionPageModified() );
krb5ConfigManualButton.addSelectionListener( new SelectionAdapter()
{
/**
* {@inheritDoc}
*/
+ @Override
public void widgetSelected( SelectionEvent event )
{
connectionPageModified();
}
} );
- krb5ConfigManualRealmText.addModifyListener( new ModifyListener()
- {
- /**
- * {@inheritDoc}
- */
- public void modifyText( ModifyEvent event )
- {
- connectionPageModified();
- }
- } );
+ krb5ConfigManualRealmText.addModifyListener( event -> connectionPageModified() );
- krb5ConfigManualHostText.addModifyListener( new ModifyListener()
- {
- /**
- * {@inheritDoc}
- */
- public void modifyText( ModifyEvent event )
- {
- connectionPageModified();
- }
- } );
+ krb5ConfigManualHostText.addModifyListener( event -> connectionPageModified() );
- krb5ConfigManualPortText.addVerifyListener( new VerifyListener()
- {
- /**
- * {@inheritDoc}
- */
- public void verifyText( VerifyEvent event )
+ krb5ConfigManualPortText.addVerifyListener( event -> {
+ if ( !event.text.matches( "[0-9]*" ) ) //$NON-NLS-1$
{
- if ( !event.text.matches( "[0-9]*" ) ) //$NON-NLS-1$
- {
- event.doit = false;
- }
+ event.doit = false;
}
} );
- krb5ConfigManualPortText.addModifyListener( new ModifyListener()
- {
- /**
- * {@inheritDoc}
- */
- public void modifyText( ModifyEvent event )
- {
- connectionPageModified();
- }
- } );
+ krb5ConfigManualPortText.addModifyListener( event -> connectionPageModified() );
}
@@ -1014,7 +976,7 @@ public class AuthenticationParameterPage
HistoryUtils.save( dialogSettings, ConnectionUIConstants.DIALOGSETTING_KEY_PRINCIPAL_HISTORY,
bindPrincipalCombo.getText() );
-
+
if ( getAuthenticationMethod().equals( AuthenticationMethod.SASL_DIGEST_MD5 ) )
{
HistoryUtils.save( dialogSettings, ConnectionUIConstants.DIALOGSETTING_KEY_REALM_HISTORY,
@@ -1069,34 +1031,38 @@ public class AuthenticationParameterPage
{
switch ( parameter.getAuthMethod() )
{
+ case SASL_PLAIN :
+ ldapUrl.getExtensions().add( new Extension( false, X_AUTH_METHOD, X_AUTH_METHOD_PLAIN ) );
+ break;
+
case SASL_CRAM_MD5:
ldapUrl.getExtensions().add( new Extension( false, X_AUTH_METHOD, X_AUTH_METHOD_CRAM_MD5 ) );
break;
-
+
case SASL_DIGEST_MD5:
ldapUrl.getExtensions().add( new Extension( false, X_AUTH_METHOD, X_AUTH_METHOD_DIGEST_MD5 ) );
break;
-
+
case SASL_GSSAPI:
ldapUrl.getExtensions().add( new Extension( false, X_AUTH_METHOD, X_AUTH_METHOD_GSSAPI ) );
break;
-
+
case SIMPLE:
if ( StringUtils.isEmpty( parameter.getBindPrincipal() ) )
{
// default if bind user is present
ldapUrl.getExtensions().add( new Extension( false, X_AUTH_METHOD, X_AUTH_METHOD_SIMPLE ) );
}
-
+
break;
-
+
case NONE:
if ( StringUtils.isNotEmpty( parameter.getBindPrincipal() ) )
{
// default if bind user is absent
ldapUrl.getExtensions().add( new Extension( false, X_AUTH_METHOD, X_AUTH_METHOD_ANONYMOUS ) );
}
-
+
break;
}
@@ -1112,6 +1078,7 @@ public class AuthenticationParameterPage
switch ( parameter.getAuthMethod() )
{
+ case SASL_PLAIN:
case SASL_CRAM_MD5:
case SASL_DIGEST_MD5:
case SASL_GSSAPI:
@@ -1125,11 +1092,11 @@ public class AuthenticationParameterPage
case AUTH:
// default
break;
-
+
case AUTH_INT:
ldapUrl.getExtensions().add( new Extension( false, X_SASL_QOP, X_SASL_QOP_AUTH_INT ) );
break;
-
+
case AUTH_CONF:
ldapUrl.getExtensions().add( new Extension( false, X_SASL_QOP, X_SASL_QOP_AUTH_INT_PRIV ) );
break;
@@ -1140,12 +1107,12 @@ public class AuthenticationParameterPage
case HIGH:
// default
break;
-
+
case MEDIUM:
ldapUrl.getExtensions().add(
new Extension( false, X_SASL_SEC_STRENGTH, X_SASL_SEC_STRENGTH_MEDIUM ) );
break;
-
+
case LOW:
ldapUrl.getExtensions().add(
new Extension( false, X_SASL_SEC_STRENGTH, X_SASL_SEC_STRENGTH_LOW ) );
@@ -1156,45 +1123,50 @@ public class AuthenticationParameterPage
{
ldapUrl.getExtensions().add( new Extension( false, X_SASL_NO_MUTUAL_AUTH, null ) );
}
+
+ break;
+
+ default:
+ break;
}
- switch ( parameter.getAuthMethod() )
+ if ( parameter.getAuthMethod() == AuthenticationMethod.SASL_GSSAPI )
{
- case SASL_GSSAPI:
- switch ( parameter.getKrb5CredentialConfiguration() )
- {
- case USE_NATIVE:
- // default
- break;
-
- case OBTAIN_TGT:
- ldapUrl.getExtensions().add(
- new Extension( false, X_KRB5_CREDENTIALS_CONF, X_KRB5_CREDENTIALS_CONF_OBTAIN_TGT ) );
- break;
- }
-
- switch ( parameter.getKrb5Configuration() )
- {
- case DEFAULT:
- // default
- break;
-
- case FILE:
- ldapUrl.getExtensions().add( new Extension( false, X_KRB5_CONFIG, X_KRB5_CONFIG_FILE ) );
- ldapUrl.getExtensions().add(
- new Extension( false, X_KRB5_CONFIG_FILE_FILE, parameter.getKrb5ConfigurationFile() ) );
- break;
-
- case MANUAL:
- ldapUrl.getExtensions().add( new Extension( false, X_KRB5_CONFIG, X_KRB5_CONFIG_MANUAL ) );
- ldapUrl.getExtensions().add(
- new Extension( false, X_KRB5_CONFIG_MANUAL_REALM, parameter.getKrb5Realm() ) );
- ldapUrl.getExtensions().add(
- new Extension( false, X_KRB5_CONFIG_MANUAL_KDC_HOST, parameter.getKrb5KdcHost() ) );
- ldapUrl.getExtensions().add(
- new Extension( false, X_KRB5_CONFIG_MANUAL_KDC_PORT, Integer.toString( parameter.getKrb5KdcPort() ) ) ); //$NON-NLS-1$
- break;
- }
+ switch ( parameter.getKrb5CredentialConfiguration() )
+ {
+ case USE_NATIVE:
+ // default
+ break;
+
+ case OBTAIN_TGT:
+ ldapUrl.getExtensions().add(
+ new Extension( false, X_KRB5_CREDENTIALS_CONF, X_KRB5_CREDENTIALS_CONF_OBTAIN_TGT ) );
+ break;
+ }
+
+ switch ( parameter.getKrb5Configuration() )
+ {
+ case DEFAULT:
+ // default
+ break;
+
+ case FILE:
+ ldapUrl.getExtensions().add( new Extension( false, X_KRB5_CONFIG, X_KRB5_CONFIG_FILE ) );
+ ldapUrl.getExtensions().add(
+ new Extension( false, X_KRB5_CONFIG_FILE_FILE, parameter.getKrb5ConfigurationFile() ) );
+ break;
+
+ case MANUAL:
+ ldapUrl.getExtensions().add( new Extension( false, X_KRB5_CONFIG, X_KRB5_CONFIG_MANUAL ) );
+ ldapUrl.getExtensions().add(
+ new Extension( false, X_KRB5_CONFIG_MANUAL_REALM, parameter.getKrb5Realm() ) );
+ ldapUrl.getExtensions().add(
+ new Extension( false, X_KRB5_CONFIG_MANUAL_KDC_HOST, parameter.getKrb5KdcHost() ) );
+ ldapUrl.getExtensions().add(
+ new Extension( false, X_KRB5_CONFIG_MANUAL_KDC_PORT,
+ Integer.toString( parameter.getKrb5KdcPort() ) ) ); //$NON-NLS-1$
+ break;
+ }
}
}
@@ -1206,12 +1178,12 @@ public class AuthenticationParameterPage
{
// bind user and password, none if empty or absent
String principal = ldapUrl.getExtensionValue( X_BIND_USER );
-
+
if ( principal == null )
{
principal = StringUtils.EMPTY;
}
-
+
parameter.setBindPrincipal( principal );
String password = ldapUrl.getExtensionValue( X_BIND_PASSWORD );
@@ -1219,7 +1191,7 @@ public class AuthenticationParameterPage
// auth method, simple if unknown or absent and X-BIND-USER is present, else anonymous
String authMethod = ldapUrl.getExtensionValue( X_AUTH_METHOD );
-
+
if ( StringUtils.isNotEmpty( authMethod ) && X_AUTH_METHOD_ANONYMOUS.equalsIgnoreCase( authMethod ) )
{
parameter.setAuthMethod( ConnectionParameter.AuthenticationMethod.NONE );
@@ -1247,7 +1219,7 @@ public class AuthenticationParameterPage
// SASL realm, none if empty or absent
String saslRealm = ldapUrl.getExtensionValue( X_SASL_REALM );
-
+
if ( StringUtils.isNotEmpty( saslRealm ) )
{
parameter.setSaslRealm( saslRealm );
@@ -1255,7 +1227,7 @@ public class AuthenticationParameterPage
// SASL QOP, default to AUTH
String saslQop = ldapUrl.getExtensionValue( X_SASL_QOP );
-
+
if ( StringUtils.isNotEmpty( saslQop ) && X_SASL_QOP_AUTH_INT.equalsIgnoreCase( saslQop ) )
{
parameter.setSaslQop( SaslQoP.AUTH_INT );
@@ -1271,8 +1243,9 @@ public class AuthenticationParameterPage
// SASL security strength, default to HIGH
String saslSecStrength = ldapUrl.getExtensionValue( X_SASL_SEC_STRENGTH );
-
- if ( StringUtils.isNotEmpty( saslSecStrength ) && X_SASL_SEC_STRENGTH_MEDIUM.equalsIgnoreCase( saslSecStrength ) )
+
+ if ( StringUtils.isNotEmpty( saslSecStrength )
+ && X_SASL_SEC_STRENGTH_MEDIUM.equalsIgnoreCase( saslSecStrength ) )
{
parameter.setSaslSecurityStrength( SaslSecurityStrength.MEDIUM );
}
@@ -1292,7 +1265,7 @@ public class AuthenticationParameterPage
// KRB5 credentials
String krb5CredentialsConf = ldapUrl.getExtensionValue( X_KRB5_CREDENTIALS_CONF );
-
+
if ( StringUtils.isNotEmpty( krb5CredentialsConf )
&& X_KRB5_CREDENTIALS_CONF_OBTAIN_TGT.equalsIgnoreCase( krb5CredentialsConf ) )
{
@@ -1305,7 +1278,7 @@ public class AuthenticationParameterPage
// KRB5 configuration
String krb5Config = ldapUrl.getExtensionValue( X_KRB5_CONFIG );
-
+
if ( StringUtils.isNotEmpty( krb5Config ) && X_KRB5_CONFIG_FILE.equalsIgnoreCase( krb5Config ) )
{
parameter.setKrb5Configuration( Krb5Configuration.FILE );
@@ -1324,7 +1297,7 @@ public class AuthenticationParameterPage
parameter.setKrb5KdcHost( ldapUrl.getExtensionValue( X_KRB5_CONFIG_MANUAL_KDC_HOST ) );
String kdcPort = ldapUrl.getExtensionValue( X_KRB5_CONFIG_MANUAL_KDC_PORT );
-
+
try
{
parameter.setKrb5KdcPort( Integer.valueOf( kdcPort ) );
Modified: directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateInfoComposite.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateInfoComposite.java?rev=1805443&r1=1805442&r2=1805443&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateInfoComposite.java (original)
+++ directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateInfoComposite.java Fri Aug 18 16:24:32 2017
@@ -40,11 +40,9 @@ import org.apache.directory.studio.commo
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.x509.extension.X509ExtensionUtil;
import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
@@ -73,7 +71,7 @@ public class CertificateInfoComposite ex
{
/** The default attributes of an X500Principal: CN, L, ST, O, OU, C, STREET, DC, UID */
private static final String[] ATTRIBUTES =
- {
+ {
"CN", //$NON-NLS-1$
"L", //$NON-NLS-1$
"ST", //$NON-NLS-1$
@@ -242,13 +240,7 @@ public class CertificateInfoComposite ex
hierarchyTreeViewer.getTree().setLayoutData( new GridData( GridData.FILL, GridData.FILL, true, true ) );
hierarchyTreeViewer.setContentProvider( new HierarchyContentProvider() );
hierarchyTreeViewer.setLabelProvider( new HierarchyLabelProvider() );
- hierarchyTreeViewer.addSelectionChangedListener( new ISelectionChangedListener()
- {
- public void selectionChanged( SelectionChangedEvent event )
- {
- populateCertificateTree();
- }
- } );
+ hierarchyTreeViewer.addSelectionChangedListener( event -> populateCertificateTree() );
Composite certificateContainer = new Composite( detailsForm, SWT.NONE );
GridLayout certificateLayout = new GridLayout( 1, false );
@@ -260,10 +252,11 @@ public class CertificateInfoComposite ex
certificateTree.setLayoutData( new GridData( GridData.FILL, GridData.FILL, true, true ) );
certificateTree.addSelectionListener( new SelectionAdapter()
{
+ @Override
public void widgetSelected( final SelectionEvent event )
{
TreeItem item = ( TreeItem ) event.item;
-
+
if ( ( item == null ) || ( item.getData() == null ) )
{
valueText.setText( StringUtils.EMPTY );
@@ -322,7 +315,7 @@ public class CertificateInfoComposite ex
expiresOn.setText( DateFormatUtils.ISO_DATE_FORMAT.format( certificate.getNotAfter() ) );
byte[] encoded2 = null;
-
+
try
{
encoded2 = certificate.getEncoded();
@@ -330,7 +323,7 @@ public class CertificateInfoComposite ex
catch ( CertificateEncodingException e )
{
}
-
+
byte[] md5 = DigestUtils.md5( encoded2 );
String md5HexString = getHexString( md5 );
fingerprintMD5.setText( md5HexString );
@@ -341,25 +334,25 @@ public class CertificateInfoComposite ex
// Details: certificate chain
CertificateChainItem parentItem = null;
CertificateChainItem certificateItem = null;
-
+
for ( X509Certificate cert : certificateChain )
{
CertificateChainItem item = new CertificateChainItem( cert );
-
+
if ( parentItem != null )
{
item.child = parentItem;
parentItem.parent = item;
}
-
+
if ( certificateItem == null )
{
certificateItem = item;
}
-
+
parentItem = item;
}
-
+
hierarchyTreeViewer.setInput( new CertificateChainItem[]
{ parentItem } );
hierarchyTreeViewer.expandAll();
@@ -378,7 +371,7 @@ public class CertificateInfoComposite ex
valueText.setText( StringUtils.EMPTY );
IStructuredSelection selection = ( IStructuredSelection ) hierarchyTreeViewer.getSelection();
-
+
if ( selection.size() != 1 )
{
return;
@@ -396,11 +389,11 @@ public class CertificateInfoComposite ex
createTreeItem( certItem,
Messages.getString( "CertificateInfoComposite.Version" ), String.valueOf( certificate.getVersion() ) ); //$NON-NLS-1$
createTreeItem( certItem,
- Messages.getString( "CertificateInfoComposite.SerialNumber" ), certificate.getSerialNumber().toString( 16 ) ); //$NON-NLS-1$
+ Messages.getString( "CertificateInfoComposite.SerialNumber" ), //$NON-NLS-1$
+ certificate.getSerialNumber().toString( 16 ) );
createTreeItem( certItem,
Messages.getString( "CertificateInfoComposite.Signature" ), certificate.getSigAlgName() ); //$NON-NLS-1$
- // TODO: formatting
createTreeItem( certItem,
Messages.getString( "CertificateInfoComposite.Issuer" ), certificate.getIssuerX500Principal().getName() ); //$NON-NLS-1$
@@ -411,7 +404,6 @@ public class CertificateInfoComposite ex
createTreeItem( validityItem,
Messages.getString( "CertificateInfoComposite.NotAfter" ), certificate.getNotAfter().toString() ); //$NON-NLS-1$
- // TODO: formatting
createTreeItem( certItem,
Messages.getString( "CertificateInfoComposite.Subject" ), certificate.getSubjectX500Principal().getName() ); //$NON-NLS-1$
@@ -419,12 +411,14 @@ public class CertificateInfoComposite ex
.getString( "CertificateInfoComposite.SubjectPublicKeyInfo" ), StringUtils.EMPTY ); //$NON-NLS-1$
createTreeItem(
pkiItem,
- Messages.getString( "CertificateInfoComposite.SubjectPublicKeyAlgorithm" ), certificate.getPublicKey().getAlgorithm() ); //$NON-NLS-1$
- // TODO: formatting
+ Messages.getString( "CertificateInfoComposite.SubjectPublicKeyAlgorithm" ), //$NON-NLS-1$
+ certificate.getPublicKey().getAlgorithm() );
+
createTreeItem(
pkiItem,
- Messages.getString( "CertificateInfoComposite.SubjectPublicKey" ), new String( Hex.encodeHex( certificate.getPublicKey() //$NON-NLS-1$
- .getEncoded() ) ) );
+ Messages.getString( "CertificateInfoComposite.SubjectPublicKey" ), //$NON-NLS-1$
+ new String( Hex.encodeHex( certificate.getPublicKey()
+ .getEncoded() ) ) );
TreeItem extItem = createTreeItem( certItem,
Messages.getString( "CertificateInfoComposite.Extensions" ), StringUtils.EMPTY ); //$NON-NLS-1$
@@ -433,10 +427,11 @@ public class CertificateInfoComposite ex
createTreeItem( rootItem,
Messages.getString( "CertificateInfoComposite.SignatureAlgorithm" ), certificate.getSigAlgName() ); //$NON-NLS-1$
- // TODO: formatting
+
createTreeItem(
rootItem,
- Messages.getString( "CertificateInfoComposite.Signature" ), new String( Hex.encodeHex( certificate.getSignature() ) ) ); //$NON-NLS-1$
+ Messages.getString( "CertificateInfoComposite.Signature" ), //$NON-NLS-1$
+ new String( Hex.encodeHex( certificate.getSignature() ) ) );
rootItem.setExpanded( true );
certItem.setExpanded( true );
@@ -451,15 +446,17 @@ public class CertificateInfoComposite ex
TreeItem item = new TreeItem( parent, SWT.NONE );
item.setText( field );
item.setData( value );
-
+
return item;
}
- private void populateExtensions( final TreeItem extensionsItem, final X509Certificate certificate, boolean critical )
+ private void populateExtensions( final TreeItem extensionsItem, final X509Certificate certificate,
+ boolean critical )
{
- Set<String> oids = critical ? certificate.getCriticalExtensionOIDs() : certificate
- .getNonCriticalExtensionOIDs();
+ Set<String> oids = critical ? certificate.getCriticalExtensionOIDs()
+ : certificate
+ .getNonCriticalExtensionOIDs();
if ( oids != null )
{
@@ -468,7 +465,7 @@ public class CertificateInfoComposite ex
// try to parse the extension value byte[] to an ASN1 object
byte[] extensionValueBin = certificate.getExtensionValue( oid );
String extensionValue = null;
-
+
try
{
ASN1Object extension = X509ExtensionUtil.fromExtensionValue( extensionValueBin );
@@ -480,7 +477,8 @@ public class CertificateInfoComposite ex
}
String value = Messages.getString( "CertificateInfoComposite.ExtensionOIDColon" ) + oid + '\n'; //$NON-NLS-1$
- value += Messages.getString( "CertificateInfoComposite.CriticalColon" ) + Boolean.toString( critical ) + '\n'; //$NON-NLS-1$
+ value += Messages.getString( "CertificateInfoComposite.CriticalColon" ) + Boolean.toString( critical ) //$NON-NLS-1$
+ + '\n';
value += Messages.getString( "CertificateInfoComposite.ExtensionValueColon" ) + extensionValue + '\n'; //$NON-NLS-1$
// TODO: OID descriptions
@@ -499,17 +497,17 @@ public class CertificateInfoComposite ex
{
char[] hex = Hex.encodeHex( bytes );
StringBuilder buffer = new StringBuilder();
-
+
for ( int i = 0; i < hex.length; i++ )
{
if ( i % 2 == 0 && i > 0 )
{
buffer.append( ':' );
}
-
+
buffer.append( Character.toUpperCase( hex[i] ) );
}
-
+
return buffer.toString();
}
@@ -524,7 +522,7 @@ public class CertificateInfoComposite ex
*/
private Map<String, String> getAttributeMap( X500Principal principal )
{
- Map<String, String> map = new HashMap<String, String>();
+ Map<String, String> map = new HashMap<>();
// populate map with default values
for ( String attribute : ATTRIBUTES )
@@ -537,11 +535,10 @@ public class CertificateInfoComposite ex
{
String name = principal.getName();
Dn dn = new Dn( name );
- //List<Rdn> rdns = dn.getRdns();
-
+
for ( Rdn rdn : dn )
{
- map.put( rdn.getType().toUpperCase(), rdn.getValue().toString() );
+ map.put( rdn.getType().toUpperCase(), rdn.getValue() );
}
}
catch ( LdapInvalidDnException lide )
@@ -551,7 +548,6 @@ public class CertificateInfoComposite ex
return map;
}
-
class HierarchyContentProvider implements ITreeContentProvider
{
@@ -560,14 +556,14 @@ public class CertificateInfoComposite ex
if ( parentElement instanceof CertificateChainItem )
{
CertificateChainItem item = ( CertificateChainItem ) parentElement;
-
+
if ( item.child != null )
{
return new CertificateChainItem[]
{ item.child };
}
}
-
+
return new Object[0];
}
@@ -577,10 +573,10 @@ public class CertificateInfoComposite ex
if ( element instanceof CertificateChainItem )
{
CertificateChainItem item = ( CertificateChainItem ) element;
-
+
return item.parent;
}
-
+
return null;
}
@@ -597,16 +593,18 @@ public class CertificateInfoComposite ex
{
return ( CertificateChainItem[] ) inputElement;
}
-
+
return getChildren( inputElement );
}
+ @Override
public void dispose()
{
}
+ @Override
public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
{
}
Modified: directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateListComposite.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateListComposite.java?rev=1805443&r1=1805442&r2=1805443&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateListComposite.java (original)
+++ directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateListComposite.java Fri Aug 18 16:24:32 2017
@@ -37,14 +37,12 @@ import org.apache.directory.studio.conne
import org.apache.directory.studio.connection.ui.dialogs.CertificateInfoDialog;
import org.apache.directory.studio.connection.ui.wizards.ExportCertificateWizard;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
@@ -81,59 +79,41 @@ public class CertificateListComposite ex
{
/** The KeyStore wrapper */
private StudioKeyStoreManager keyStoreManager;
-
+
/** The table containing the KeyStore elements */
private TableViewer tableViewer;
-
+
/** The View action button */
private Button viewButton;
/** The Add action button */
private Button addButton;
-
+
/** The Remove action button */
private Button removeButton;
-
+
/** The Export action button */
private Button exportButton;
/**
* The listener called when the table selection has changed
*/
- private ISelectionChangedListener tableViewerSelectionListener = new ISelectionChangedListener()
- {
- /**
- * {@inheritDoc}
- */
- public void selectionChanged( SelectionChangedEvent event )
- {
- // Enable and disable the button accordingly to the selection :
- // - 1 line selected : enable remove, view and export
- // - N lines selected : enable remove, disable view and export
- // - nothing selected, disable view, remove and exprt
- viewButton.setEnabled( ( ( IStructuredSelection ) event.getSelection() ).size() == 1 );
- removeButton.setEnabled( !event.getSelection().isEmpty() );
- exportButton.setEnabled( ( ( IStructuredSelection ) event.getSelection() ).size() == 1 );
- }
+ private ISelectionChangedListener tableViewerSelectionListener = event -> {
+ // Enable and disable the button accordingly to the selection :
+ // - 1 line selected : enable remove, view and export
+ // - N lines selected : enable remove, disable view and export
+ // - nothing selected, disable view, remove and exprt
+ viewButton.setEnabled( ( ( IStructuredSelection ) event.getSelection() ).size() == 1 );
+ removeButton.setEnabled( !event.getSelection().isEmpty() );
+ exportButton.setEnabled( ( ( IStructuredSelection ) event.getSelection() ).size() == 1 );
};
-
-
+
/**
* The listener called when a line is double-clicked in the table : we will
* open the Certificate dialog.
*/
- private IDoubleClickListener tableViewerDoubleClickListener = new IDoubleClickListener()
- {
- /**
- * {@inheritDoc}
- */
- public void doubleClick( DoubleClickEvent event )
- {
- openCertificate( event.getSelection() );
- }
- };
-
-
+ private IDoubleClickListener tableViewerDoubleClickListener = event -> openCertificate( event.getSelection() );
+
/**
* A selection listener on the View button : we will open the Certificate Dialog
*/
@@ -142,13 +122,13 @@ public class CertificateListComposite ex
/**
* {@inheritDoc}
*/
+ @Override
public void widgetSelected( SelectionEvent event )
{
openCertificate( tableViewer.getSelection() );
}
};
-
-
+
/**
* A selection listener on the Add button : we will open the File Dialog
* and let the user select the KeyStore location to add in the table
@@ -158,6 +138,7 @@ public class CertificateListComposite ex
/**
* {@inheritDoc}
*/
+ @Override
public void widgetSelected( SelectionEvent event )
{
// Asking the user for the certificate file
@@ -190,8 +171,7 @@ public class CertificateListComposite ex
}
}
};
-
-
+
/**
* A selection listener on the Remove button.
*/
@@ -200,15 +180,16 @@ public class CertificateListComposite ex
/**
* {@inheritDoc}
*/
+ @Override
public void widgetSelected( SelectionEvent event )
{
IStructuredSelection selection = ( IStructuredSelection ) tableViewer.getSelection();
Iterator<?> iterator = selection.iterator();
-
+
while ( iterator.hasNext() )
{
X509Certificate certificate = ( X509Certificate ) iterator.next();
-
+
try
{
keyStoreManager.removeCertificate( certificate );
@@ -218,12 +199,11 @@ public class CertificateListComposite ex
throw new RuntimeException( ce );
}
}
-
+
tableViewer.refresh();
}
};
-
-
+
/**
* A selection listener on the Export button. We will open the Export wizard.
*/
@@ -232,6 +212,7 @@ public class CertificateListComposite ex
/**
* {@inheritDoc}
*/
+ @Override
public void widgetSelected( SelectionEvent event )
{
X509Certificate certificate = ( X509Certificate ) ( ( IStructuredSelection ) tableViewer.getSelection() )
@@ -242,7 +223,7 @@ public class CertificateListComposite ex
}
};
-
+
/**
* Creates a new instance of CertificateInfoComposite.
*
@@ -296,7 +277,7 @@ public class CertificateListComposite ex
// The View Button
viewButton = BaseWidgetUtils.createButton( buttonContainer, Messages
.getString( "CertificateListComposite.ViewButton" ), 1 );//$NON-NLS-1$
-
+
viewButton.setEnabled( false );
viewButton.addSelectionListener( viewButtonSelectionListener );
@@ -310,7 +291,7 @@ public class CertificateListComposite ex
.getString( "CertificateListComposite.RemoveButton" ), 1 ); //$NON-NLS-1$
removeButton.setEnabled( false );
removeButton.addSelectionListener( removeButtonSelectionListener );
-
+
// The export button
exportButton = BaseWidgetUtils.createButton( buttonContainer, Messages
.getString( "CertificateListComposite.ExportButton" ), 1 ); //$NON-NLS-1$
@@ -326,7 +307,7 @@ public class CertificateListComposite ex
{
CertificateFactory certificateFactory = CertificateFactory.getInstance( "X.509" ); //$NON-NLS-1$
Certificate certificate = certificateFactory.generateCertificate( new ByteArrayInputStream( data ) );
-
+
if ( certificate instanceof X509Certificate )
{
return ( X509Certificate ) certificate;
@@ -347,7 +328,6 @@ public class CertificateListComposite ex
tableViewer.setInput( keyStoreManager );
}
-
/**
* This class is used to give back the content of teh Table viewer
*/
@@ -361,11 +341,9 @@ public class CertificateListComposite ex
{
if ( inputElement instanceof StudioKeyStoreManager )
{
- StudioKeyStoreManager keyStoreManager = ( StudioKeyStoreManager ) inputElement;
-
try
{
- return keyStoreManager.getCertificates();
+ return ( ( StudioKeyStoreManager ) inputElement ).getCertificates();
}
catch ( CertificateException e )
{
@@ -373,13 +351,15 @@ public class CertificateListComposite ex
}
}
- return new Object[]{};
+ return new Object[]
+ {};
}
/**
* {@inheritDoc}
*/
+ @Override
public void dispose()
{
}
@@ -388,13 +368,13 @@ public class CertificateListComposite ex
/**
* {@inheritDoc}
*/
+ @Override
public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
{
}
}
-
/**
* This helper class is used to decorate the elements in the table : we use the certificate name if any.
* @author elecharny
@@ -405,6 +385,7 @@ public class CertificateListComposite ex
/**
* {@inheritDoc}
*/
+ @Override
public String getText( Object element )
{
if ( element instanceof X509Certificate )
@@ -412,8 +393,8 @@ public class CertificateListComposite ex
X509Certificate certificate = ( X509Certificate ) element;
String certificateName = certificate.getSubjectX500Principal().getName();
-
- if ( Strings.isEmpty( certificateName ) )
+
+ if ( Strings.isEmpty( certificateName ) )
{
return Messages.getString( "CertificateListComposite.UntitledCertificate" ); //$NON-NLS-1$
}
@@ -430,6 +411,7 @@ public class CertificateListComposite ex
/**
* {@inheritDoc}
*/
+ @Override
public Image getImage( Object element )
{
if ( element instanceof X509Certificate )
@@ -440,8 +422,8 @@ public class CertificateListComposite ex
return super.getImage( element );
}
}
-
-
+
+
/**
* A private method that opens the Certificate Dialog
* @param selection
Modified: directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionActionGroup.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionActionGroup.java?rev=1805443&r1=1805442&r2=1805443&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionActionGroup.java (original)
+++ directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionActionGroup.java Fri Aug 18 16:24:32 2017
@@ -127,7 +127,7 @@ public class ConnectionActionGroup imple
collapseAllAction = new CollapseAllAction( viewer );
expandAllAction = new ExpandAllAction( viewer );
- connectionActionMap = new HashMap<String, ConnectionViewActionProxy>();
+ connectionActionMap = new HashMap<>();
connectionActionMap.put( NEW_CONNECTION_ACTION, new ConnectionViewActionProxy( viewer, this,
new NewConnectionAction() ) );
@@ -169,9 +169,8 @@ public class ConnectionActionGroup imple
for ( Iterator<String> it = connectionActionMap.keySet().iterator(); it.hasNext(); )
{
String key = it.next();
- ConnectionViewActionProxy action = ( ConnectionViewActionProxy ) this.connectionActionMap.get( key );
+ ConnectionViewActionProxy action = this.connectionActionMap.get( key );
action.dispose();
- action = null;
it.remove();
}
@@ -259,11 +258,11 @@ public class ConnectionActionGroup imple
menuManager.add( new Separator() );
// open/close
- if ( ( ( IAction ) connectionActionMap.get( CLOSE_CONNECTION_ACTION ) ).isEnabled() )
+ if ( ( connectionActionMap.get( CLOSE_CONNECTION_ACTION ) ).isEnabled() )
{
menuManager.add( ( IAction ) connectionActionMap.get( CLOSE_CONNECTION_ACTION ) );
}
- else if ( ( ( IAction ) connectionActionMap.get( OPEN_CONNECTION_ACTION ) ).isEnabled() )
+ else if ( ( connectionActionMap.get( OPEN_CONNECTION_ACTION ) ).isEnabled() )
{
menuManager.add( ( IAction ) connectionActionMap.get( OPEN_CONNECTION_ACTION ) );
}
@@ -292,19 +291,19 @@ public class ConnectionActionGroup imple
{
if ( actionBars == null )
{
- IAction copyConnectionAction = ( IAction ) connectionActionMap.get( COPY_CONNECTION_ACTION );
+ IAction copyConnectionAction = connectionActionMap.get( COPY_CONNECTION_ACTION );
copyConnectionAction.setActionDefinitionId( ConnectionUIConstants.CMD_COPY );
ActionUtils.activateActionHandler( copyConnectionAction );
- IAction pasteConnectionAction = ( IAction ) connectionActionMap.get( PASTE_CONNECTION_ACTION );
+ IAction pasteConnectionAction = connectionActionMap.get( PASTE_CONNECTION_ACTION );
pasteConnectionAction.setActionDefinitionId( ConnectionUIConstants.CMD_PASTE );
ActionUtils.activateActionHandler( pasteConnectionAction );
- IAction deleteConnectionAction = ( IAction ) connectionActionMap.get( DELETE_CONNECTION_ACTION );
+ IAction deleteConnectionAction = connectionActionMap.get( DELETE_CONNECTION_ACTION );
deleteConnectionAction.setActionDefinitionId( ConnectionUIConstants.CMD_DELETE );
ActionUtils.activateActionHandler( deleteConnectionAction );
- IAction propertyDialogAction = ( IAction ) connectionActionMap.get( PROPERTY_DIALOG_ACTION );
+ IAction propertyDialogAction = connectionActionMap.get( PROPERTY_DIALOG_ACTION );
propertyDialogAction.setActionDefinitionId( ConnectionUIConstants.CMD_PROPERTIES );
ActionUtils.activateActionHandler( propertyDialogAction );
}
@@ -332,13 +331,13 @@ public class ConnectionActionGroup imple
{
if ( actionBars == null )
{
- IAction copyConnectionAction = ( IAction ) connectionActionMap.get( COPY_CONNECTION_ACTION );
+ IAction copyConnectionAction = connectionActionMap.get( COPY_CONNECTION_ACTION );
ActionUtils.deactivateActionHandler( copyConnectionAction );
- IAction pasteConnectionAction = ( IAction ) connectionActionMap.get( PASTE_CONNECTION_ACTION );
+ IAction pasteConnectionAction = connectionActionMap.get( PASTE_CONNECTION_ACTION );
ActionUtils.deactivateActionHandler( pasteConnectionAction );
- IAction deleteConnectionAction = ( IAction ) connectionActionMap.get( DELETE_CONNECTION_ACTION );
+ IAction deleteConnectionAction = connectionActionMap.get( DELETE_CONNECTION_ACTION );
ActionUtils.deactivateActionHandler( deleteConnectionAction );
- IAction propertyDialogAction = ( IAction ) connectionActionMap.get( PROPERTY_DIALOG_ACTION );
+ IAction propertyDialogAction = connectionActionMap.get( PROPERTY_DIALOG_ACTION );
ActionUtils.deactivateActionHandler( propertyDialogAction );
}
else
Modified: directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionConfiguration.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionConfiguration.java?rev=1805443&r1=1805442&r2=1805443&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionConfiguration.java (original)
+++ directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionConfiguration.java Fri Aug 18 16:24:32 2017
@@ -97,7 +97,7 @@ public class ConnectionConfiguration
Menu menu = contextMenuManager.createContextMenu( viewer.getControl() );
viewer.getControl().setMenu( menu );
}
-
+
return contextMenuManager;
}
Modified: directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionContentProvider.java?rev=1805443&r1=1805442&r2=1805443&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionContentProvider.java (original)
+++ directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionContentProvider.java Fri Aug 18 16:24:32 2017
@@ -45,6 +45,7 @@ public class ConnectionContentProvider i
* @see org.eclipse.jface.viewers.IContentProvider#
* inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
+ @Override
public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
{
}
@@ -53,6 +54,7 @@ public class ConnectionContentProvider i
/**
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
*/
+ @Override
public void dispose()
{
}
@@ -67,9 +69,8 @@ public class ConnectionContentProvider i
{
ConnectionFolderManager cfm = ( ConnectionFolderManager ) inputElement;
ConnectionFolder rootConnectionFolder = cfm.getRootConnectionFolder();
- Object[] elements = getChildren( rootConnectionFolder );
-
- return elements;
+
+ return getChildren( rootConnectionFolder );
}
else
{
@@ -85,7 +86,7 @@ public class ConnectionContentProvider i
{
if ( parentElement instanceof ConnectionFolder )
{
- List<Object> children = new ArrayList<Object>();
+ List<Object> children = new ArrayList<>();
ConnectionFolder folder = ( ConnectionFolder ) parentElement;
List<String> subFolderIds = folder.getSubFolderIds();
@@ -95,7 +96,7 @@ public class ConnectionContentProvider i
{
ConnectionFolder subFolder = ConnectionCorePlugin.getDefault().getConnectionFolderManager()
.getConnectionFolderById( subFolderId );
-
+
if ( subFolder != null )
{
children.add( subFolder );
@@ -105,7 +106,7 @@ public class ConnectionContentProvider i
{
Connection conn = ConnectionCorePlugin.getDefault().getConnectionManager().getConnectionById(
connectionId );
-
+
if ( conn != null )
{
children.add( conn );
@@ -114,7 +115,7 @@ public class ConnectionContentProvider i
return children.toArray();
}
-
+
return null;
}
@@ -147,7 +148,7 @@ public class ConnectionContentProvider i
public boolean hasChildren( Object element )
{
Object[] children = getChildren( element );
-
+
return children != null && children.length > 0;
}