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 2009/10/20 11:38:38 UTC

svn commit: r827017 - in /directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors: attributetype/AttributeTypeEditorOverviewPage.java objectclass/ObjectClassEditorOverviewPage.java

Author: pamarcelot
Date: Tue Oct 20 09:38:37 2009
New Revision: 827017

URL: http://svn.apache.org/viewvc?rev=827017&view=rev
Log:
o Fix for DIRSTUDIO-568 (When editing an AT or OC, using the scroll wheel may trigger a combo change).
o Fixed the appearance of the aliases Text widget and the superiors Table on Ubuntu (where border were not correctly painted).

Modified:
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java?rev=827017&r1=827016&r2=827017&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java Tue Oct 20 09:38:37 2009
@@ -63,7 +63,10 @@
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.PartInitException;
@@ -653,7 +656,20 @@
             setEditorDirty();
         }
     };
-
+    
+    /** The filter listener for Mouse Wheel events */
+    private Listener mouseWheelFilter = new Listener()
+    {
+    	public void handleEvent( Event event )
+    	{
+    		// Hiding Mouse Wheel events for Combo widgets
+    		if ( event.widget instanceof Combo )
+    		{
+    			event.doit = false;
+    		}
+    	}
+    };
+    
 
     /**
      * Default constructor.
@@ -691,9 +707,6 @@
         // Matching Rules Section
         createMatchingRulesSection( form.getBody(), toolkit );
 
-        //        // Enabling or disabling the fields
-        //        setFieldsEditableState();
-
         // Filling the UI with values from the attribute type
         fillInUiFields();
 
@@ -738,16 +751,16 @@
             .createLabel( client_general_information, Messages.getString( "AttributeTypeEditorOverviewPage.Aliases" ) );
         Composite aliasComposite = toolkit.createComposite( client_general_information );
         GridLayout aliasCompositeGridLayout = new GridLayout( 2, false );
-        aliasCompositeGridLayout.horizontalSpacing = 0;
-        aliasCompositeGridLayout.verticalSpacing = 0;
-        aliasCompositeGridLayout.marginHeight = 0;
-        aliasCompositeGridLayout.marginWidth = 0;
+        toolkit.paintBordersFor( aliasComposite );
+        aliasCompositeGridLayout.marginHeight = 1;
+        aliasCompositeGridLayout.marginWidth = 1;
         aliasComposite.setLayout( aliasCompositeGridLayout );
         aliasComposite.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
         aliasesText = toolkit.createText( aliasComposite, "" ); //$NON-NLS-1$
-        aliasesText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        aliasesText.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false ) );
         aliasesButton = toolkit.createButton( aliasComposite, Messages
             .getString( "AttributeTypeEditorOverviewPage.EditAliases" ), SWT.PUSH );
+        aliasesButton.setLayoutData( new GridData( SWT.NONE, SWT.CENTER, false, false ) );
 
         // OID Field
         toolkit.createLabel( client_general_information, Messages.getString( "AttributeTypeEditorOverviewPage.OID" ) );
@@ -783,6 +796,7 @@
         usageCombo.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
         initUsageCombo();
 
+
         // SYNTAX Combo
         toolkit
             .createLabel( client_general_information, Messages.getString( "AttributeTypeEditorOverviewPage.Syntax" ) );
@@ -1187,6 +1201,8 @@
         equalityComboViewer.addSelectionChangedListener( equalityComboViewerListener );
         orderingComboViewer.addSelectionChangedListener( orderingComboViewerListener );
         substringComboViewer.addSelectionChangedListener( substringComboViewerListener );
+        
+        Display.getCurrent().addFilter( SWT.MouseWheel, mouseWheelFilter );
     }
 
 
@@ -1214,6 +1230,8 @@
         equalityComboViewer.removeSelectionChangedListener( equalityComboViewerListener );
         orderingComboViewer.removeSelectionChangedListener( orderingComboViewerListener );
         substringComboViewer.removeSelectionChangedListener( substringComboViewerListener );
+        
+        Display.getCurrent().removeFilter( SWT.MouseWheel, mouseWheelFilter );
     }
 
 

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java?rev=827017&r1=827016&r2=827017&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java Tue Oct 20 09:38:37 2009
@@ -67,7 +67,10 @@
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.IWorkbenchPage;
@@ -827,6 +830,19 @@
             }
         }
     };
+    
+    /** The filter listener for Mouse Wheel events */
+    private Listener mouseWheelFilter = new Listener()
+    {
+    	public void handleEvent( Event event )
+    	{
+    		// Hiding Mouse Wheel events for Combo widgets
+    		if ( event.widget instanceof Combo )
+    		{
+    			event.doit = false;
+    		}
+    	}
+    };
 
 
     /**
@@ -916,16 +932,16 @@
         toolkit.createLabel( client_general_information, Messages.getString( "ObjectClassEditorOverviewPage.Aliases" ) );
         Composite aliasComposite = toolkit.createComposite( client_general_information );
         GridLayout aliasCompositeGridLayout = new GridLayout( 2, false );
-        aliasCompositeGridLayout.horizontalSpacing = 0;
-        aliasCompositeGridLayout.verticalSpacing = 0;
-        aliasCompositeGridLayout.marginHeight = 0;
-        aliasCompositeGridLayout.marginWidth = 0;
+        toolkit.paintBordersFor( aliasComposite );
+        aliasCompositeGridLayout.marginHeight = 1;
+        aliasCompositeGridLayout.marginWidth = 1;
         aliasComposite.setLayout( aliasCompositeGridLayout );
         aliasComposite.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
         aliasesText = toolkit.createText( aliasComposite, "" ); //$NON-NLS-1$
-        aliasesText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        aliasesText.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false ) );
         aliasesButton = toolkit.createButton( aliasComposite, Messages
             .getString( "ObjectClassEditorOverviewPage.EditAliases" ), SWT.PUSH );
+        aliasesButton.setLayoutData( new GridData( SWT.NONE, SWT.CENTER, false, false ) );
 
         // OID Field
         toolkit.createLabel( client_general_information, Messages.getString( "ObjectClassEditorOverviewPage.OID" ) );
@@ -951,14 +967,14 @@
             .getString( "ObjectClassEditorOverviewPage.SuperiorClasses" ) );
         Composite superiorsComposite = toolkit.createComposite( client_general_information );
         GridLayout superiorsCompositeGridLayout = new GridLayout( 2, false );
-        superiorsCompositeGridLayout.horizontalSpacing = 0;
-        superiorsCompositeGridLayout.verticalSpacing = 0;
-        superiorsCompositeGridLayout.marginHeight = 0;
-        superiorsCompositeGridLayout.marginWidth = 0;
+        toolkit.paintBordersFor( superiorsComposite );
+        superiorsCompositeGridLayout.marginHeight = 1;
+        superiorsCompositeGridLayout.marginWidth = 1;
         superiorsComposite.setLayout( superiorsCompositeGridLayout );
         superiorsComposite.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
         superiorsTable = toolkit.createTable( superiorsComposite, SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL
             | SWT.V_SCROLL );
+        toolkit.paintBordersFor( superiorsTable );
         GridData gridData = new GridData( SWT.FILL, SWT.NONE, true, false, 1, 2 );
         gridData.heightHint = 45;
         gridData.minimumHeight = 45;
@@ -1210,6 +1226,8 @@
         superiorsTable.addMouseListener( superiorsTableListener );
         mandatoryAttributesTable.addMouseListener( mandatoryAttributesTableListener );
         optionalAttributesTable.addMouseListener( optionalAttributesTableListener );
+        
+        Display.getCurrent().addFilter( SWT.MouseWheel, mouseWheelFilter );
     }
 
 
@@ -1235,6 +1253,8 @@
         optionalAttributesTable.removeMouseListener( optionalAttributesTableListener );
         addButtonOptionalTable.removeSelectionListener( addButtonOptionalTableListener );
         removeButtonOptionalTable.removeSelectionListener( removeButtonOptionalTableListener );
+        
+        Display.getCurrent().removeFilter( SWT.MouseWheel, mouseWheelFilter );
     }