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/internal/ui/actions/ActionUtil.java
return true;
			
		if (isOnBuildPath((IJavaElement)element))
			return true;
		MessageDialog.openInformation(shell, 
			ActionMessages.getString("ActionUtil.notOnBuildPath.title"),  
			ActionMessages.getString("ActionUtil.notOnBuildPath.message")); 
		return false;
	}
	public static boolean isOnBuildPath(IJavaElement element) {	
        
        if (element.getElementType() == IJavaElement.JAVA_PROJECT)
            return true;
		IJavaProject project= element.getJavaProject();
		try {
			if (!project.isOnClasspath(element))
				return false;
			IProject resourceProject= project.getProject();
			if (resourceProject == null)
				return false;
			IProjectNature nature= resourceProject.getNature(JavaCore.NATURE_ID);
			
			if (nature != null)
				return true;
		} catch (CoreException e) {
		}
		return false;
	}
}