You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2011/12/08 17:59:57 UTC

svn commit: r1211980 - in /directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences: AttributeDialog.java SyntaxDialog.java

Author: pamarcelot
Date: Thu Dec  8 16:59:56 2011
New Revision: 1211980

URL: http://svn.apache.org/viewvc?rev=1211980&view=rev
Log:
Fix for DIRSTUDIO-727 (It is possible to add empty Binary Attributes and Binary Syntax Definitions in the preferences)

Modified:
    directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributeDialog.java
    directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxDialog.java

Modified: directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributeDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributeDialog.java?rev=1211980&r1=1211979&r2=1211980&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributeDialog.java (original)
+++ directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributeDialog.java Thu Dec  8 16:59:56 2011
@@ -27,6 +27,7 @@ import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
@@ -40,7 +41,6 @@ import org.eclipse.swt.widgets.Shell;
  */
 public class AttributeDialog extends Dialog
 {
-
     /** The initial attribute. */
     private BinaryAttribute currentAttribute;
 
@@ -53,6 +53,9 @@ public class AttributeDialog extends Dia
     /** The combo. */
     private Combo typeOrOidCombo;
 
+    /** The OK button of the dialog */
+    private Button okButton;
+
 
     /**
      * Creates a new instance of AttributeDialog.
@@ -78,6 +81,17 @@ public class AttributeDialog extends Dia
         super.configureShell( newShell );
         newShell.setText( Messages.getString( "AttributeDialog.SelectAttributeTypeOrOID" ) ); //$NON-NLS-1$
     }
+    
+    /**
+     * {@inheritDoc}
+     */
+    protected void createButtonsForButtonBar( Composite parent )
+    {
+        okButton = createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true );
+        createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+        
+        validate();
+    }
 
 
     /**
@@ -118,7 +132,7 @@ public class AttributeDialog extends Dia
 
     private void validate()
     {
-        getButton( IDialogConstants.OK_ID ).setEnabled( !"".equals( typeOrOidCombo.getText() ) ); //$NON-NLS-1$
+        okButton.setEnabled( !"".equals( typeOrOidCombo.getText() ) ); //$NON-NLS-1$
     }
 
 

Modified: directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxDialog.java?rev=1211980&r1=1211979&r2=1211980&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxDialog.java (original)
+++ directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxDialog.java Thu Dec  8 16:59:56 2011
@@ -27,6 +27,7 @@ import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
@@ -40,7 +41,6 @@ import org.eclipse.swt.widgets.Shell;
  */
 public class SyntaxDialog extends Dialog
 {
-
     /** The initial syntax. */
     private BinarySyntax currentSyntax;
 
@@ -53,6 +53,9 @@ public class SyntaxDialog extends Dialog
     /** The combo. */
     private Combo oidCombo;
 
+    /** The OK button of the dialog */
+    private Button okButton;
+
 
     /**
      * Creates a new instance of SyntaxDialog.
@@ -83,6 +86,18 @@ public class SyntaxDialog extends Dialog
     /**
      * {@inheritDoc}
      */
+    protected void createButtonsForButtonBar( Composite parent )
+    {
+        okButton = createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true );
+        createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+
+        validate();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
     protected void okPressed()
     {
         returnSyntax = new BinarySyntax( oidCombo.getText() );
@@ -118,7 +133,7 @@ public class SyntaxDialog extends Dialog
 
     private void validate()
     {
-        getButton( IDialogConstants.OK_ID ).setEnabled( !"".equals( oidCombo.getText() ) ); //$NON-NLS-1$
+        okButton.setEnabled( !"".equals( oidCombo.getText() ) ); //$NON-NLS-1$
     }