Bug 94560 Introduce factory active for classses not on build path
- create a class not on the build path - select a constructor in the outliner - activate Introduce Factory Observe: the refactoring tries to start which generates exceptions in the log. The standard dialog box should be shown instead informing the user that the CU isn' on the build path. Tobias, can you please look into this. Will be an easy fix.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/IntroduceFactoryAction.java
setToolTipText(RefactoringMessages.IntroduceFactoryAction_tooltipText); 
		setDescription(RefactoringMessages.IntroduceFactoryAction_description); 
		PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.INTRODUCE_FACTORY_ACTION);
	}
	
	
	
	/*
	 * @see SelectionDispatchAction#selectionChanged(IStructuredSelection)
	 */
	public void selectionChanged(IStructuredSelection selection) {
		try {
			setEnabled(RefactoringAvailabilityTester.isIntroduceFactoryAvailable(selection));
		} catch (JavaModelException e) {
			if (JavaModelUtil.isExceptionToBeLogged(e))
				JavaPlugin.log(e);
			setEnabled(false);
		}
	}
	/*
	 * @see SelectionDispatchAction#run(IStructuredSelection)
	 */
	public void run(IStructuredSelection selection) {
		try {
			
			if (RefactoringAvailabilityTester.isIntroduceFactoryAvailable(selection)) {
				IMethod method= (IMethod) selection.getFirstElement();
				ISourceRange range= method.getNameRange();
				RefactoringExecutionStarter.startIntroduceFactoryRefactoring(method.getCompilationUnit(), new TextSelection(range.getOffset(), range.getLength()), getShell());
			}