Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 27810 Details for
Bug 109844
[KeyBindings] misc: ESC handling with Emacs bindings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Broken patch to WorkbenchKeyboard
Bug109844-org.eclipse.ui.workbench.patch (text/plain), 4.39 KB, created by
Douglas Pollock
on 2005-10-04 11:17:06 EDT
(
hide
)
Description:
Broken patch to WorkbenchKeyboard
Filename:
MIME Type:
Creator:
Douglas Pollock
Created:
2005-10-04 11:17:06 EDT
Size:
4.39 KB
patch
obsolete
>Index: WorkbenchKeyboard.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/WorkbenchKeyboard.java,v >retrieving revision 1.80 >diff -u -r1.80 WorkbenchKeyboard.java >--- WorkbenchKeyboard.java 18 May 2005 19:00:46 -0000 1.80 >+++ WorkbenchKeyboard.java 4 Oct 2005 15:16:44 -0000 >@@ -23,6 +23,8 @@ > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Status; > import org.eclipse.jface.bindings.Binding; >+import org.eclipse.jface.bindings.keys.IKeyLookup; >+import org.eclipse.jface.bindings.keys.KeyLookupFactory; > import org.eclipse.jface.bindings.keys.KeySequence; > import org.eclipse.jface.bindings.keys.KeyStroke; > import org.eclipse.jface.bindings.keys.ParseException; >@@ -767,16 +769,59 @@ > } > > KeySequence sequenceBeforeKeyStroke = state.getCurrentSequence(); >- for (Iterator iterator = potentialKeyStrokes.iterator(); iterator >- .hasNext();) { >- KeySequence sequenceAfterKeyStroke = KeySequence.getInstance( >- sequenceBeforeKeyStroke, (KeyStroke) iterator.next()); >- if (isPartialMatch(sequenceAfterKeyStroke)) { >- incrementState(sequenceAfterKeyStroke); >+ >+ /* >+ * Let's try to treat ESC as ALT. To do this, we're going to need to >+ * expand the sequenceBeforeKeyStroke with all of the potential strokes, >+ * thereby getting all of the possible sequences after the key stroke >+ * has been pressed. If the last key stroke in the >+ * sequenceBeforeKeyStroke is ESC and the potential stroke does not >+ * already have an ALT modifier, then the ESC can be removed and the >+ * potential stroke can be augmented with an ALT modifier. >+ */ >+ final KeyStroke[] keyStrokes = sequenceBeforeKeyStroke.getKeyStrokes(); >+ final List potentialSequences = new ArrayList(); >+ final Iterator potentialItr = potentialKeyStrokes.iterator(); >+ final IKeyLookup lookup = KeyLookupFactory.getDefault(); >+ while (potentialItr.hasNext()) { >+ final KeyStroke potentialStroke = (KeyStroke) potentialItr.next(); >+ potentialSequences.add(KeySequence.getInstance( >+ sequenceBeforeKeyStroke, potentialStroke)); >+ if ((potentialStroke.getModifierKeys() & lookup.getAlt()) == 0) { >+ if (keyStrokes.length > 0) { >+ final KeyStroke lastKeyStroke = keyStrokes[keyStrokes.length - 1]; >+ if ((lastKeyStroke.getModifierKeys() == KeyStroke.NO_KEY) >+ && (lastKeyStroke.getNaturalKey() == lookup >+ .formalKeyLookup(IKeyLookup.ESC_NAME))) { >+ final KeyStroke modifiedStroke = KeyStroke.getInstance( >+ potentialStroke.getModifierKeys() >+ | lookup.getAlt(), potentialStroke >+ .getNaturalKey()); >+ if (keyStrokes.length == 1) { >+ potentialSequences.add(KeySequence >+ .getInstance(modifiedStroke)); >+ } else { >+ final KeyStroke[] modifiedKeyStrokes = new KeyStroke[keyStrokes.length]; >+ System.arraycopy(keyStrokes, 0, modifiedKeyStrokes, >+ 0, keyStrokes.length - 1); >+ modifiedKeyStrokes[keyStrokes.length - 1] = modifiedStroke; >+ potentialSequences.add(KeySequence >+ .getInstance(modifiedKeyStrokes)); >+ } >+ } >+ } >+ } >+ } >+ >+ final Iterator iterator = potentialSequences.iterator(); >+ while (iterator.hasNext()) { >+ final KeySequence potentialSequence = (KeySequence) iterator.next(); >+ if (isPartialMatch(potentialSequence)) { >+ incrementState(potentialSequence); > return true; > >- } else if (isPerfectMatch(sequenceAfterKeyStroke)) { >- final Binding binding = getPerfectMatch(sequenceAfterKeyStroke); >+ } else if (isPerfectMatch(potentialSequence)) { >+ final Binding binding = getPerfectMatch(potentialSequence); > try { > return executeCommand(binding, event) || !sequenceBeforeKeyStroke > .isEmpty(); >@@ -796,6 +841,19 @@ > // We don't want to swallow keyboard navigation keys. > return false; > >+ } else { >+ // Check to see if we have a trailing ESC. >+ final KeyStroke[] potentialStrokes = potentialSequence >+ .getKeyStrokes(); >+ if (keyStrokes.length > 0) { >+ final KeyStroke lastKeyStroke = potentialStrokes[potentialStrokes.length - 1]; >+ if ((lastKeyStroke.getModifierKeys() == KeyStroke.NO_KEY) >+ && (lastKeyStroke.getNaturalKey() == lookup >+ .formalKeyLookup(IKeyLookup.ESC_NAME))) { >+ incrementState(potentialSequence); >+ return true; >+ } >+ } > } > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 109844
: 27810