Bug 14390 npe on sorting in outline
20020418+ (20020418.2) java.lang.NullPointerException at org.eclipse.jdt.internal.ui.text.link.LinkedPositionUI.initializeHighlightColor (LinkedPositionUI.java:109) at org.eclipse.jdt.internal.ui.text.link.LinkedPositionUI.propertyChange (LinkedPositionUI.java:100) at org.eclipse.ui.plugin.AbstractUIPlugin$CompatibilityPreferenceStore.fireProperty ChangeEvent(AbstractUIPlugin.java:247) at org.eclipse.ui.plugin.AbstractUIPlugin$1.propertyChange (AbstractUIPlugin.java:188) at org.eclipse.core.runtime.Preferences.firePropertyChangeEvent (Preferences.java:505) at org.eclipse.core.runtime.Preferences.setValue(Preferences.java:563) at org.eclipse.ui.plugin.AbstractUIPlugin$CompatibilityPreferenceStore.setValue (AbstractUIPlugin.java:457) at org.eclipse.jdt.internal.ui.javaeditor.JavaOutlinePage$LexicalSortingAction.valu eChanged(JavaOutlinePage.java:569) at org.eclipse.jdt.internal.ui.javaeditor.JavaOutlinePage$LexicalSortingAction.run (JavaOutlinePage.java:558) at org.eclipse.jface.action.Action.runWithEvent(Action.java:590) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:407) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java(Compiled Code)) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java(Compiled Code)) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java(Compiled Code)) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java (Compiled Code)) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java(Compiled Code)) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java (Compiled Code)) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java (Compiled Code)) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java (Compiled Code)) at org.eclipse.ui.internal.Workbench.run(Workbench.java:816) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:643) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:349) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:195) at org.eclipse.core.launcher.Main.run(Main.java:541) at org.eclipse.core.launcher.Main.main(Main.java:396)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/link/LinkedPositionUI.java
private void leave(int flags) {
		if ((flags & UNINSTALL) != 0)
			fManager.uninstall((flags & COMMIT) != 0);
		fgStore.removePropertyChangeListener(this);
		
		if (fFrameColor != null) {
			fFrameColor.dispose();
			fFrameColor= null;
		}			
		
		StyledText text= fViewer.getTextWidget();	
		text.removePaintListener(this);
		text.removeModifyListener(this);
		text.removeVerifyListener(this);
		ITextViewerExtension extension= (ITextViewerExtension) fViewer;
		extension.removeVerifyKeyListener(this);
		fViewer.removeTextInputListener(this);
		
		try {
			IRegion region= fViewer.getVisibleRegion();
			IDocument document= fViewer.getDocument();
			if (((flags & COMMIT) != 0) &&
				((flags & DOCUMENT_CHANGED) == 0) &&
				((flags & UPDATE_CARET) != 0))
			{
				Position[] positions= document.getPositions(CARET_POSITION);
				if ((positions != null) && (positions.length != 0)) {
					int offset= positions[0].getOffset() - region.getOffset();		
					if ((offset >= 0) && (offset <= region.getLength()))
						text.setSelection(offset, offset);