directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1211992 - /directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/ValueEditorsPreferencePage.java
Date Thu, 08 Dec 2011 17:17:34 GMT
Author: pamarcelot
Date: Thu Dec  8 17:17:34 2011
New Revision: 1211992

URL: http://svn.apache.org/viewvc?rev=1211992&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/ValueEditorsPreferencePage.java

Modified: directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/ValueEditorsPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/ValueEditorsPreferencePage.java?rev=1211992&r1=1211991&r2=1211992&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/ValueEditorsPreferencePage.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/ValueEditorsPreferencePage.java
Thu Dec  8 17:17:34 2011
@@ -48,8 +48,10 @@ import org.eclipse.jface.resource.ImageD
 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;
@@ -316,6 +318,15 @@ public class ValueEditorsPreferencePage 
                 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( "ValueEditorsPreferencePage.Add" ), 1 ); //$NON-NLS-1$
@@ -328,6 +339,7 @@ public class ValueEditorsPreferencePage 
         } );
         attributeEditButton = BaseWidgetUtils.createButton( buttonComposite, Messages
             .getString( "ValueEditorsPreferencePage.Edit" ), 1 ); //$NON-NLS-1$
+        attributeEditButton.setEnabled( false );
         attributeEditButton.addSelectionListener( new SelectionAdapter()
         {
             public void widgetSelected( SelectionEvent e )
@@ -337,6 +349,7 @@ public class ValueEditorsPreferencePage 
         } );
         attributeRemoveButton = BaseWidgetUtils.createButton( buttonComposite, Messages
             .getString( "ValueEditorsPreferencePage.Remove" ), 1 ); //$NON-NLS-1$
+        attributeRemoveButton.setEnabled( false );
         attributeRemoveButton.addSelectionListener( new SelectionAdapter()
         {
             public void widgetSelected( SelectionEvent e )
@@ -392,6 +405,15 @@ public class ValueEditorsPreferencePage 
             }
         } );
 
+        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( "ValueEditorsPreferencePage.Add" ), 1 ); //$NON-NLS-1$
         syntaxAddButton.addSelectionListener( new SelectionAdapter()
@@ -403,6 +425,7 @@ public class ValueEditorsPreferencePage 
         } );
         syntaxEditButton = BaseWidgetUtils.createButton( buttonComposite, Messages
             .getString( "ValueEditorsPreferencePage.Edit" ), 1 ); //$NON-NLS-1$
+        syntaxEditButton.setEnabled( false );
         syntaxEditButton.addSelectionListener( new SelectionAdapter()
         {
             public void widgetSelected( SelectionEvent e )
@@ -412,6 +435,7 @@ public class ValueEditorsPreferencePage 
         } );
         syntaxRemoveButton = BaseWidgetUtils.createButton( buttonComposite, Messages
             .getString( "ValueEditorsPreferencePage.Remove" ), 1 ); //$NON-NLS-1$
+        syntaxRemoveButton.setEnabled( false );
         syntaxRemoveButton.addSelectionListener( new SelectionAdapter()
         {
             public void widgetSelected( SelectionEvent e )



Mime
View raw message