Bug 86177 [implementation][preferences] crash with non-"system default" foreground/background colors
This happened with a clean install of 3.1M5a, on a fresh workspace. 1. Change the background and foreground colors to be not "system default" Window -> Preferences -> General -> Editors -> Text Editors Select Background color and uncheck "System Default" Select Foreground color and uncheck "System Default" 2. Go to the Java syntax coloring page and click "OK" Window -> Preferences -> Java -> Editor -> Syntax Coloring Click OK. An error dialog will show up saying, "An error has occurred." You can't go back to eclipse, and you're forced to kill eclipse. The error log has this stack trace: !ENTRY org.eclipse.ui 4 4 2005-02-22 13:22:33.31 !MESSAGE Unhandled event loop exception !ENTRY org.eclipse.ui 4 0 2005-02-22 13:22:33.31 !MESSAGE Argument not valid !STACK 0 java.lang.IllegalArgumentException: Argument not valid at org.eclipse.swt.SWT.error(SWT.java:2823) at org.eclipse.swt.SWT.error(SWT.java:2762) at org.eclipse.swt.SWT.error(SWT.java:2733) at org.eclipse.swt.graphics.TextStyle.<init>(TextStyle.java:73) at org.eclipse.swt.custom.StyledTextRenderer.getTextLayout(StyledTextRenderer.java:437) at org.eclipse.swt.custom.StyledTextRenderer.drawLine(StyledTextRenderer.java:114) at org.eclipse.swt.custom.StyledText.performPaint(StyledText.java:5748) at org.eclipse.swt.custom.StyledText.handlePaint(StyledText.java:5129) at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:4791) 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.Widget.sendEvent(Widget.java:866) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:851) at org.eclipse.swt.widgets.Composite.WM_PAINT(Composite.java:1078) at org.eclipse.swt.widgets.Control.windowProc(Control.java:3076) at org.eclipse.swt.widgets.Display.windowProc(Display.java:3480) at org.eclipse.swt.internal.win32.OS.RedrawWindow(Native Method) at org.eclipse.swt.widgets.Control.update(Control.java:2907) at org.eclipse.swt.widgets.Display.update(Display.java:3382) at org.eclipse.jface.window.Window.runEventLoop(Window.java:724) at org.eclipse.jface.window.Window.open(Window.java:696) at org.eclipse.jface.dialogs.MessageDialog.openError(MessageDialog.java:319) at org.eclipse.jface.preference.PreferenceDialog$12.handleException(PreferenceDialog.java:890) at org.eclipse.core.internal.runtime.InternalPlatform.handleException(InternalPlatform.java:697) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1017) at org.eclipse.core.runtime.Platform.run(Platform.java:757) at org.eclipse.jface.preference.PreferenceDialog.okPressed(PreferenceDialog.java:833) at org.eclipse.jface.preference.PreferenceDialog.buttonPressed(PreferenceDialog.java:220) at org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog.buttonPressed(WorkbenchPreferenceDialog.java:246) at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:543) 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:2908) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2541) 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:2908) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2541) 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:333) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:150) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) 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)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaSourceViewer.java
super.createControl(parent, styles);
		fBackspaceManager= new SmartBackspaceManager();
		fBackspaceManager.install(this);
		
		StyledText text= getTextWidget();
		text.addBidiSegmentListener(new  BidiSegmentListener() {
			public void lineGetSegments(BidiSegmentEvent event) {
				if (redraws())
					event.segments= getBidiLineSegments(event.lineOffset, event.lineText);
			}
		});
	}
	
	/**
	 * Returns the backspace manager for this viewer.
	 * 
	 * @return the backspace manager for this viewer, or <code>null</code> if
	 *         there is none
	 * @since 3.0
	 */
	public SmartBackspaceManager getBackspaceManager() {
		return fBackspaceManager;
	}
	
	/*
	 * @see org.eclipse.jface.text.source.SourceViewer#handleDispose()
	 */
	protected void handleDispose() {
		if (fBackspaceManager != null) {
			fBackspaceManager.uninstall();