Bug 65249 Refactoring actions enabled in CU from CVS
3.0RC1 In a CU from CVS the refactoring actions are enabled and when invoked show dialogs about wrong selection, sometimes an exception is thrown: java.lang.NullPointerException at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringActions.co nvertToEnclosingOrPrimaryType(RefactoringActions.java:50) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringActions.ge tEnclosingOrPrimaryType(RefactoringActions.java:43) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.getSingleSelectedTy pe(ExtractInterfaceAction.java:168) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run(ExtractInterfac eAction.java:155) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(Select ionDispatchAction.java:216) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispa tchAction.java:188) at org.eclipse.jface.action.Action.runWithEvent(Action.java:881) at org.eclipse.ui.actions.RetargetAction.runWithEvent(RetargetAction.jav a:212) at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginActio n.java:211) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:915) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContri butionItem.java:866) at org.eclipse.jface.action.ActionContributionItem$7.handleEvent(ActionC ontributionItem.java:785) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2716) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2382) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1363) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1334) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.jav a:253) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:96 ) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformAct ivator.java:334) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.ja va:273) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.ja va:128) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:185) at org.eclipse.core.launcher.Main.run(Main.java:638) at org.eclipse.core.launcher.Main.main(Main.java:622) java.lang.NullPointerException
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/InlineAction.java
}
	
	private boolean tryInlineMethod(ICompilationUnit cu, ITextSelection selection){
		InlineMethodRefactoring inlineMethodRef= InlineMethodRefactoring.create(
			cu, selection.getOffset(), selection.getLength(),
			JavaPreferencesSettings.getCodeGenerationSettings());
		if (inlineMethodRef == null)	
			return false;
		fInlineMethod.run(selection);
		return true;
	}
	
	private ICompilationUnit getCompilationUnit() {
		return SelectionConverter.getInputAsCompilationUnit(fEditor);
	}
	/*
	 * @see org.eclipse.jdt.ui.actions.SelectionDispatchAction#run(org.eclipse.jface.viewers.IStructuredSelection)
	 */
	public void run(IStructuredSelection selection) {
		if (fInlineConstant.isEnabled())
			fInlineConstant.run(selection);
		else if (fInlineMethod.isEnabled())
			fInlineMethod.run(selection);
		else	
			
			
			Assert.isTrue(! fInlineTemp.isEnabled());
	}
}