### Eclipse Workspace Patch 1.0 #P com.metamatrix.ui Index: src/com/metamatrix/ui/text/StyledTextEditor.java =================================================================== RCS file: /cvs/dev/com.metamatrix.ui/src/com/metamatrix/ui/text/Attic/StyledTextEditor.java,v retrieving revision 1.1.2.3 diff -u -r1.1.2.3 StyledTextEditor.java --- src/com/metamatrix/ui/text/StyledTextEditor.java 1 Oct 2008 05:39:57 -0000 1.1.2.3 +++ src/com/metamatrix/ui/text/StyledTextEditor.java 23 Jun 2010 03:32:31 -0000 @@ -110,6 +110,8 @@ * @since 5.5.3 */ private static final String UNDO_ID = ActionFactory.UNDO.getId(); + + private boolean bHaveFocus = false; // =========================================================================================================================== // Class Methods @@ -419,6 +421,7 @@ this.copyAction = new ContextMenuAction(COPY_ID); } + this.copyAction.setAccelerator(SWT.CTRL | 'C'); this.copyAction.setEnabledState(); return this.copyAction; } @@ -430,6 +433,7 @@ this.cutAction = new ContextMenuAction(CUT_ID); } + this.cutAction.setAccelerator(SWT.CTRL | 'X'); this.cutAction.setEnabledState(); return this.cutAction; } @@ -441,6 +445,7 @@ this.findAction = new ContextMenuAction(FIND_ID); } + this.findAction.setAccelerator(SWT.CTRL | 'F'); this.findAction.setEnabledState(); return this.findAction; } @@ -452,6 +457,7 @@ this.pasteAction = new ContextMenuAction(PASTE_ID); } + this.pasteAction.setAccelerator(SWT.CTRL | 'V'); this.pasteAction.setEnabledState(); return this.pasteAction; } @@ -463,6 +469,7 @@ this.redoAction = new ContextMenuAction(REDO_ID); } + this.redoAction.setAccelerator(SWT.CTRL | 'Y'); this.redoAction.setEnabledState(); return this.redoAction; } @@ -474,6 +481,7 @@ this.selectAllAction = new ContextMenuAction(SELECT_ALL_ID); } + this.selectAllAction.setAccelerator(SWT.CTRL | 'A'); this.selectAllAction.setEnabledState(); return this.selectAllAction; } @@ -485,6 +493,7 @@ this.undoAction = new ContextMenuAction(UNDO_ID); } + this.undoAction.setAccelerator(SWT.CTRL | 'Z'); this.undoAction.setEnabledState(); return this.undoAction; } @@ -540,18 +549,7 @@ * @since 5.5.3 */ protected void handleFocusGained(FocusEvent e) { - if (this.findAction != null) { - this.findAction.setAccelerator(SWT.CTRL | 'F'); - } - - if (this.selectAllAction != null) { - this.selectAllAction.setAccelerator(SWT.CTRL | 'A'); - } - - if (this.undoAction != null) { - this.undoAction.setAccelerator(SWT.CTRL | 'Z'); - this.redoAction.setAccelerator(SWT.CTRL | 'Y'); - } + bHaveFocus = true; } /** @@ -560,18 +558,7 @@ * @since 5.5.3 */ protected void handleFocusLost(FocusEvent e) { - if (this.findAction != null) { - this.findAction.setAccelerator(0); - } - - if (this.selectAllAction != null) { - this.selectAllAction.setAccelerator(0); - } - - if (this.undoAction != null) { - this.undoAction.setAccelerator(0); - this.redoAction.setAccelerator(0); - } + bHaveFocus = false; } /** @@ -662,6 +649,11 @@ * @since 5.5.3 */ public void keyReleased(KeyEvent e) { + + if ( !this.bHaveFocus ) { + return; + } + IAction action = null; int accelerator = SWTKeySupport.convertEventToUnmodifiedAccelerator(e);