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 18:21:25 UTC

svn commit: r1211994 - in /directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences: AttributeValueEditorDialog.java SyntaxValueEditorDialog.java

Author: pamarcelot
Date: Thu Dec  8 17:21:24 2011
New Revision: 1211994

URL: http://svn.apache.org/viewvc?rev=1211994&view=rev
Log:
Fix for the AttributeValueEditorDialog and SyntaxValueEditorDialog classes.

See 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/AttributeValueEditorDialog.java
    directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxValueEditorDialog.java

Modified: directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributeValueEditorDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributeValueEditorDialog.java?rev=1211994&r1=1211993&r2=1211994&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributeValueEditorDialog.java (original)
+++ directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributeValueEditorDialog.java Thu Dec  8 17:21:24 2011
@@ -31,6 +31,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;
@@ -45,7 +46,6 @@ import org.eclipse.swt.widgets.Shell;
  */
 public class AttributeValueEditorDialog extends Dialog
 {
-
     /** The initial attribute to value editor relation. */
     private AttributeValueEditorRelation relation;
 
@@ -67,6 +67,9 @@ public class AttributeValueEditorDialog 
     /** The value editor combo. */
     private Combo valueEditorCombo;
 
+    /** The OK button of the dialog */
+    private Button okButton;
+
 
     /**
      * Creates a new instance of AttributeValueEditorDialog.
@@ -106,6 +109,18 @@ public class AttributeValueEditorDialog 
     /**
      * {@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()
     {
         returnRelation = new AttributeValueEditorRelation( typeOrOidCombo.getText(), veName2classMap
@@ -158,7 +173,7 @@ public class AttributeValueEditorDialog 
 
     private void validate()
     {
-        super.getButton( IDialogConstants.OK_ID ).setEnabled(
+        okButton.setEnabled(
             !"".equals( valueEditorCombo.getText() ) && !"".equals( typeOrOidCombo.getText() ) ); //$NON-NLS-1$ //$NON-NLS-2$
     }
 

Modified: directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxValueEditorDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxValueEditorDialog.java?rev=1211994&r1=1211993&r2=1211994&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxValueEditorDialog.java (original)
+++ directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxValueEditorDialog.java Thu Dec  8 17:21:24 2011
@@ -31,6 +31,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;
@@ -45,7 +46,6 @@ import org.eclipse.swt.widgets.Shell;
  */
 public class SyntaxValueEditorDialog extends Dialog
 {
-
     /** The initial syntax to value editor relation. */
     private SyntaxValueEditorRelation relation;
 
@@ -67,6 +67,9 @@ public class SyntaxValueEditorDialog ext
     /** The value editor combo. */
     private Combo valueEditorCombo;
 
+    /** The OK button of the dialog */
+    private Button okButton;
+
 
     /**
      * Creates a new instance of SyntaxValueEditorDialog.
@@ -106,6 +109,18 @@ public class SyntaxValueEditorDialog ext
     /**
      * {@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()
     {
         returnRelation = new SyntaxValueEditorRelation( oidCombo.getText(), ( String ) veName2classMap
@@ -158,7 +173,7 @@ public class SyntaxValueEditorDialog ext
 
     private void validate()
     {
-        super.getButton( IDialogConstants.OK_ID ).setEnabled(
+        okButton.setEnabled(
             !"".equals( valueEditorCombo.getText() ) && !"".equals( oidCombo.getText() ) ); //$NON-NLS-1$ //$NON-NLS-2$
     }