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:10:13 UTC

svn commit: r1211985 - /directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BinaryAttributesAndSyntaxesPreferencePage.java

Author: pamarcelot
Date: Thu Dec  8 17:10:13 2011
New Revision: 1211985

URL: http://svn.apache.org/viewvc?rev=1211985&view=rev
Log:
Fixed behavior of the TableViewer buttons (Edit and Delete).
They should be disabled when nothing is selected in the TableViewer.

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

Modified: directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BinaryAttributesAndSyntaxesPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BinaryAttributesAndSyntaxesPreferencePage.java?rev=1211985&r1=1211984&r2=1211985&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BinaryAttributesAndSyntaxesPreferencePage.java (original)
+++ directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BinaryAttributesAndSyntaxesPreferencePage.java Thu Dec  8 17:10:13 2011
@@ -43,8 +43,10 @@ import org.eclipse.jface.preference.Pref
 import org.eclipse.jface.viewers.ArrayContentProvider;
 import org.eclipse.jface.viewers.DoubleClickEvent;
 import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.ITableLabelProvider;
 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.swt.SWT;
@@ -267,6 +269,15 @@ public class BinaryAttributesAndSyntaxes
                 editAttribute();
             }
         } );
+        
+        attributeViewer.addSelectionChangedListener( new ISelectionChangedListener()
+        {
+            public void selectionChanged( SelectionChangedEvent event )
+            {
+                attributeEditButton.setEnabled( !attributeViewer.getSelection().isEmpty() );
+                attributeRemoveButton.setEnabled( !attributeViewer.getSelection().isEmpty() );
+            }
+        } );
 
         attributeAddButton = BaseWidgetUtils.createButton( buttonComposite, Messages
             .getString( "BinaryAttributesAndSyntaxesPreferencePage.Add" ), 1 ); //$NON-NLS-1$
@@ -279,6 +290,7 @@ public class BinaryAttributesAndSyntaxes
         } );
         attributeEditButton = BaseWidgetUtils.createButton( buttonComposite, Messages
             .getString( "BinaryAttributesAndSyntaxesPreferencePage.Edit" ), 1 ); //$NON-NLS-1$
+        attributeEditButton.setEnabled( false );
         attributeEditButton.addSelectionListener( new SelectionAdapter()
         {
             public void widgetSelected( SelectionEvent e )
@@ -288,6 +300,7 @@ public class BinaryAttributesAndSyntaxes
         } );
         attributeRemoveButton = BaseWidgetUtils.createButton( buttonComposite, Messages
             .getString( "BinaryAttributesAndSyntaxesPreferencePage.Remove" ), 1 ); //$NON-NLS-1$
+        attributeRemoveButton.setEnabled( false );
         attributeRemoveButton.addSelectionListener( new SelectionAdapter()
         {
             public void widgetSelected( SelectionEvent e )
@@ -339,6 +352,15 @@ public class BinaryAttributesAndSyntaxes
             }
         } );
 
+        syntaxViewer.addSelectionChangedListener( new ISelectionChangedListener()
+        {
+            public void selectionChanged( SelectionChangedEvent event )
+            {
+                syntaxEditButton.setEnabled( !syntaxViewer.getSelection().isEmpty() );
+                syntaxRemoveButton.setEnabled( !syntaxViewer.getSelection().isEmpty() );
+            }
+        } );
+
         syntaxAddButton = BaseWidgetUtils.createButton( buttonComposite, Messages
             .getString( "BinaryAttributesAndSyntaxesPreferencePage.Add" ), 1 ); //$NON-NLS-1$
         syntaxAddButton.addSelectionListener( new SelectionAdapter()
@@ -350,6 +372,7 @@ public class BinaryAttributesAndSyntaxes
         } );
         syntaxEditButton = BaseWidgetUtils.createButton( buttonComposite, Messages
             .getString( "BinaryAttributesAndSyntaxesPreferencePage.Edit" ), 1 ); //$NON-NLS-1$
+        syntaxEditButton.setEnabled( false );
         syntaxEditButton.addSelectionListener( new SelectionAdapter()
         {
             public void widgetSelected( SelectionEvent e )
@@ -359,6 +382,7 @@ public class BinaryAttributesAndSyntaxes
         } );
         syntaxRemoveButton = BaseWidgetUtils.createButton( buttonComposite, Messages
             .getString( "BinaryAttributesAndSyntaxesPreferencePage.Remove" ), 1 ); //$NON-NLS-1$
+        syntaxRemoveButton.setEnabled( false );
         syntaxRemoveButton.addSelectionListener( new SelectionAdapter()
         {
             public void widgetSelected( SelectionEvent e )