Bug 54922 [implementation] Java editor disposes default StyledText caret's image
Build id: 200403040800 Java editor, according to the insert mode, sets a special Caret in the StyledText. I've two problem with that: 1- This caret is not bidi aware 2- At some point they dispose the image of the StyledText default Caret We (SWT Team) have some major changes (still to be release) in StyledText that will expose this UI bug. Here is the stack trace: java.lang.Exception: Stack trace at java.lang.Thread.dumpStack(Thread.java:1064) at org.eclipse.swt.graphics.Image.dispose(Image.java:825) at org.eclipse.ui.texteditor.AbstractTextEditor.disposeNonDefaultCaret (AbstractTextEditor.java:4378) at org.eclipse.ui.texteditor.AbstractTextEditor.updateCaret (AbstractTextEditor.java:4359) at org.eclipse.ui.texteditor.AbstractTextEditor.handleInsertModeChanged (AbstractTextEditor.java:4399) at org.eclipse.ui.texteditor.AbstractTextEditor.setInsertMode (AbstractTextEditor.java:4234) at org.eclipse.ui.texteditor.AbstractTextEditor.switchToNextInsertMode (AbstractTextEditor.java:4266) at org.eclipse.ui.texteditor.AbstractTextEditor.access$4 (AbstractTextEditor.java:4253) at org.eclipse.ui.texteditor.AbstractTextEditor$ToggleInsertModeAction.run (AbstractTextEditor.java:808) at org.eclipse.ui.texteditor.TextNavigationAction.runWithEvent (TextNavigationAction.java:106) at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:68) at org.eclipse.ui.internal.commands.Command.execute(Command.java:160) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand (WorkbenchKeyboard.java:475) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press (WorkbenchKeyboard.java:887) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent (WorkbenchKeyboard.java:931) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings (WorkbenchKeyboard.java:568) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$2 (WorkbenchKeyboard.java:500) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$1.handleEvent (WorkbenchKeyboard.java:256) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:705) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:809) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:834) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:819) at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1720) at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1716) at org.eclipse.swt.widgets.Control.WM_KEYDOWN(Control.java:3487) at org.eclipse.swt.widgets.Control.windowProc(Control.java:2971) at org.eclipse.swt.widgets.Display.windowProc(Display.java:2962) at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method) at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:1362) at org.eclipse.swt.internal.BidiUtil.windowProc(BidiUtil.java:647) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1438) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2100) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1509) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1480) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench (Workbench.java:257) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:139) at org.eclipse.ui.internal.ide.IDEApplication.run (IDEApplication.java:48) at org.eclipse.core.internal.runtime.PlatformActivator$1.run (PlatformActivator.java:260) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:173) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:106) 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.basicRun(Main.java:305) at org.eclipse.core.launcher.Main.run(Main.java:745) at org.eclipse.core.launcher.Main.main(Main.java:713)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/JavaEditorPreferencePage.java
gd.horizontalSpan= 2;
		checkBox.setLayoutData(gd);
		checkBox.addSelectionListener(fCheckBoxListener);
		
		fCheckBoxes.put(checkBox, key);
		
		return checkBox;
	}
	
	private Text addTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber) {
		return getTextControl(addLabelledTextField(composite, label, key, textLimit, indentation, isNumber));
	}
	
	private static Label getLabelControl(Control[] labelledTextField){
		return (Label)labelledTextField[0];
	}
	private static Text getTextControl(Control[] labelledTextField){
		return (Text)labelledTextField[1];
	}
	
	/**
	 * Returns an array of size 2:
	 *  - first element is of type <code>Label</code>
	 *  - second element is of type <code>Text</code>
	 * Use <code>getLabelControl</code> and <code>getTextControl</code> to get the 2 controls.
	 * 
	 * @param composite 	the parent composite
	 * @param label			the text field's label
	 * @param key			the preference key
	 * @param textLimit		the text limit