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
* </p>
		 * <p>
		 * If the insertion point is not at the end of the sequence, then
		 * incomplete strokes will not be immediately inserted. Only when the
		 * sequence is completed is the stroke inserted. This is a requirement
		 * as the widget must always represent a valid key sequence. The
		 * insertion point is tracked using <code>insertionIndex</code>,
		 * which is an index into the key stroke array.
		 * </p>
		 * 
		 * @param event
		 *            The triggering key down event; must not be
		 *            <code>null</code>.
		 * @param keyStrokes
		 *            The key strokes into which the current stroke should be
		 *            inserted. This value must not be <code>null</code>, and
		 *            must represent a valid key sequence.
		 */
		private final KeyStroke[] insertKeyStroke(final Event event,
				KeyStroke[] keyStrokes) {
			
			int key = SWTKeySupport.convertEventToUnmodifiedAccelerator(event);
			KeyStroke stroke = SWTKeySupport.convertAcceleratorToKeyStroke(key);
			/*
			 * Only insert the stroke if it is *not ScrollLock. Let's not get
			 * silly
			 */
			if ((SWT.NUM_LOCK == stroke.getNaturalKey())
					|| (SWT.CAPS_LOCK == stroke.getNaturalKey())
					|| (SWT.SCROLL_LOCK == stroke.getNaturalKey())) {