Bug 85192 [KeyBindings] preference page: ArrayIndexOutOfBounds if add special key while modifier pressed
I20050214-0927 Window>Preferences>General>Keys>Modify Key Sequence "Name:" text field Hold Ctrl key Click the Insert Special Key button Select an entry java.lang.ArrayIndexOutOfBoundsException: -1 at java.util.ArrayList.get(ArrayList.java:326) at org.eclipse.jface.bindings.keys.KeySequenceText.insertStrokeAt (KeySequenceText.java:682) at org.eclipse.jface.bindings.keys.KeySequenceText.insert (KeySequenceText.java:659) at org.eclipse.ui.internal.commands.KeysPreferencePage$8.widgetSelected (KeysPreferencePage.java:754) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:89) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:842) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2878) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2516) at org.eclipse.jface.window.Window.runEventLoop(Window.java:718) at org.eclipse.jface.window.Window.open(Window.java:696) at org.eclipse.ui.internal.OpenPreferencesAction.run (OpenPreferencesAction.java:66) at org.eclipse.jface.action.Action.runWithEvent(Action.java:1003) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:557) at org.eclipse.jface.action.ActionContributionItem.access$2 (ActionContributionItem.java:507) at org.eclipse.jface.action.ActionContributionItem$6.handleEvent (ActionContributionItem.java:421) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:842) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2878) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2516) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1612) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1578) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:293) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102) at org.eclipse.core.internal.runtime.PlatformActivator$1.run (PlatformActivator.java:228) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:332) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:149) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:268) at org.eclipse.core.launcher.Main.basicRun(Main.java:260) at org.eclipse.core.launcher.Main.run(Main.java:887) at org.eclipse.core.launcher.Main.main(Main.java:871)
bundles/org.eclipse.jface/src/org/eclipse/jface/bindings/keys/KeySequenceText.java
}
		/**
		 * Handles the key pressed and released events on the wrapped text
		 * widget. This makes sure to either add the pressed key to the
		 * temporary key stroke, or complete the current temporary key stroke
		 * and prompt for the next. In the case of a key release, this makes
		 * sure that the temporary stroke is correctly displayed --
		 * corresponding with modifier keys that may have been released.
		 * 
		 * @param event
		 *            The triggering event; must not be <code>null</code>.
		 */
		public void handleEvent(Event event) {
			KeyStroke[] keyStrokes = getKeySequence().getKeyStrokes();
			
			if (event.type == SWT.KeyDown) {
				keyStrokes = handleKeyDown(event, keyStrokes);
			} else if (event.type == SWT.KeyUp) {
				keyStrokes = handleKeyUp(event, keyStrokes);
			}
			
			setKeySequence(KeySequence.getInstance(keyStrokes));
			
			event.doit = false;
		}
		/**
		 * Handles the case where the key event is an <code>SWT.KeyDown</code>
		 * event. This either causes a deletion (if it is an unmodified
		 * backspace key stroke), or an insertion (if it is any other key).
		 *