Bug 334387 [Compatibility] NPE thrown when opening preferences dialog from inline refactoring menu
1. Place your text cursor on a field. 2. Alt+Shift+R 3. Wait for the balloon popup to appear then click the dropdown > Preferences... 4. An NPE is thrown. org.eclipse.swt.SWTException: Widget is disposed at org.eclipse.swt.SWT.error(SWT.java:4093) at org.eclipse.swt.SWT.error(SWT.java:4008) at org.eclipse.swt.SWT.error(SWT.java:3979) at org.eclipse.swt.widgets.Widget.error(Widget.java:468) at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:340) at org.eclipse.swt.widgets.Control.getParent(Control.java:1387) at org.eclipse.e4.ui.internal.workbench.swt.ShellActivationListener.deactivate(ShellActivationListener.java:132) at org.eclipse.e4.ui.internal.workbench.swt.ShellActivationListener.access$0(ShellActivationListener.java:131) at org.eclipse.e4.ui.internal.workbench.swt.ShellActivationListener$4.widgetDisposed(ShellActivationListener.java:197) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:123) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1058) at org.eclipse.swt.widgets.Widget.release(Widget.java:808) at org.eclipse.swt.widgets.Widget.dispose(Widget.java:446) at org.eclipse.swt.widgets.Decorations.dispose(Decorations.java:447) at org.eclipse.swt.widgets.Shell.dispose(Shell.java:714) at org.eclipse.swt.widgets.Decorations.closeWidget(Decorations.java:309) at org.eclipse.swt.widgets.Shell.close(Shell.java:537) at org.eclipse.jdt.internal.ui.refactoring.reorg.RenameInformationPopup.close(RenameInformationPopup.java:354) at org.eclipse.jdt.internal.ui.refactoring.reorg.RenameLinkedMode.linkedModeLeft(RenameLinkedMode.java:584) at org.eclipse.jdt.internal.ui.refactoring.reorg.RenameLinkedMode.access$2(RenameLinkedMode.java:581) at org.eclipse.jdt.internal.ui.refactoring.reorg.RenameLinkedMode$EditorSynchronizer.left(RenameLinkedMode.java:117) at org.eclipse.jface.text.link.LinkedModeModel.exit(LinkedModeModel.java:341) at org.eclipse.jdt.internal.ui.refactoring.reorg.RenameLinkedMode.cancel(RenameLinkedMode.java:386) at org.eclipse.jdt.internal.ui.refactoring.reorg.RenameInformationPopup$14.run(RenameInformationPopup.java:770) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/ShellActivationListener.java
Object context = window.getContext();
			WorkbenchSWTActivator.trace("/trace/workbench",
					"setting mwindow context " + context, null);
			
			shell.setData(ECLIPSE_CONTEXT_SHELL_CONTEXT, context);
			break;
		}
	}
	private void activate(Shell shell) {
		final IEclipseContext parentContext = application.getContext();
		final IEclipseContext shellContext = getShellContext(shell,
				parentContext);
		SafeRunner.run(new ISafeRunnable() {
			public void run() throws Exception {
				
				shellContext.activate();
			}
			public void handleException(Throwable exception) {
				WorkbenchSWTActivator.trace("/trace/workbench",
						"failed setting dialog child", exception);
			}
		});
	}
	private void deactivate(Shell shell) {
		Shell parent = (Shell) shell.getParent();
		if (parent == null) {
			
			
			IEclipseContext currentlyActive = application.getContext()
					.getActiveChild();