Bug 47838 Make refactoring menu selection sensitive in editor [refactoring]
M5 Currently all refactoring actions are enabled in the editor's context menu. Make them selection dependent. Check if code resolve might be enough (no need to create an AST).
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/IntroduceFactoryAction.java
*/
	public IntroduceFactoryAction(IWorkbenchSite site) {
		super(site);
		setText(RefactoringMessages.getString("IntroduceFactoryAction.label")); 
		setToolTipText(RefactoringMessages.getString("IntroduceFactoryAction.tooltipText")); 
		setDescription(RefactoringMessages.getString("IntroduceFactoryAction.description")); 
		WorkbenchHelp.setHelp(this, IJavaHelpContextIds.INTRODUCE_FACTORY_ACTION);
	}
	
	/*
	 * @see SelectionDispatchAction#run(IStructuredSelection)
	 */
	public void run(IStructuredSelection selection) {
		try {
			
			if (canEnable(selection)) {
				IMethod	method= getSingleSelectedMethod(selection);
				ICompilationUnit unit= method.getCompilationUnit();
				ISourceRange nameRange= method.getNameRange();
				ITextSelection textSel= new TextSelection(nameRange.getOffset(), nameRange.getLength());
				IntroduceFactoryRefactoring refactoring= createRefactoring(unit, textSel);
				if (refactoring == null)
					return;
				new RefactoringStarter().activate(refactoring, createWizard(refactoring), getShell(), DIALOG_MESSAGE_TITLE, false);
			}
		} catch (CoreException e) {
			ExceptionHandler.handle(e, DIALOG_MESSAGE_TITLE, RefactoringMessages.getString("IntroduceFactoryAction.exception")); 
		}
	}
	/* (non-Javadoc)