directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r614173 - /directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditAliasesDialog.java
Date Tue, 22 Jan 2008 11:05:27 GMT
Author: pamarcelot
Date: Tue Jan 22 03:05:22 2008
New Revision: 614173

URL: http://svn.apache.org/viewvc?rev=614173&view=rev
Log:
Improvement for DIRSTUDIO-238 (Automatically add an alias when the 'ok' button is selected).

Modified:
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditAliasesDialog.java

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditAliasesDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditAliasesDialog.java?rev=614173&r1=614172&r2=614173&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditAliasesDialog.java
(original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditAliasesDialog.java
Tue Jan 22 03:05:22 2008
@@ -28,7 +28,6 @@
 import org.apache.directory.studio.schemaeditor.PluginUtils;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.TableEditor;
 import org.eclipse.swt.events.KeyAdapter;
@@ -43,6 +42,7 @@
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Listener;
@@ -72,6 +72,22 @@
     /** The dirty flag */
     private boolean dirty = false;
 
+    /** The listener used to override the listerner on the RETURN key */
+    private Listener returnKeyListener = new Listener()
+    {
+        public void handleEvent( Event event )
+        {
+            if ( event.detail == SWT.TRAVERSE_RETURN )
+            {
+                event.detail = SWT.TRAVERSE_TAB_NEXT;
+                closeTableEditor();
+            }
+        }
+    };
+
+    /** The {@link Display} */
+    private Display display;
+
     // UI Fields
     private Table aliasesTable;
     private TableEditor tableEditor;
@@ -104,6 +120,8 @@
                 lowerCasedAliases.add( alias.toLowerCase() );
             }
         }
+
+        display = Activator.getDefault().getWorkbench().getDisplay();
     }
 
 
@@ -364,6 +382,7 @@
         newEditor.selectAll();
         newEditor.setFocus();
         tableEditor.setEditor( newEditor, item, 0 );
+        display.addFilter( SWT.Traverse, returnKeyListener );
     }
 
 
@@ -406,6 +425,7 @@
             saveTableEditorText();
             text.dispose();
         }
+        display.removeFilter( SWT.Traverse, returnKeyListener );
     }
 
 
@@ -440,16 +460,6 @@
     {
         super.configureShell( newShell );
         newShell.setText( "Edit Aliases" );
-    }
-
-
-    /* (non-Javadoc)
-    * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
-    */
-    protected void createButtonsForButtonBar( Composite parent )
-    {
-        createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false );
-        createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL,
false );
     }
 
 



Mime
View raw message