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/ExtractInterfaceAction.java
private static boolean canRunOn(IType type) throws JavaModelException {
		return ExtractInterfaceRefactoring.isAvailable(type);
	}
		
	private IJavaElement[] resolveElements() {
		return SelectionConverter.codeResolveHandled(fEditor, getShell(),  RefactoringMessages.getString("OpenRefactoringWizardAction.refactoring"));  
	}
	private static RefactoringWizard createWizard(ExtractInterfaceRefactoring refactoring){
		return new ExtractInterfaceWizard(refactoring);
	}
	
	private void startRefactoring(IType type) throws JavaModelException {
		ExtractInterfaceRefactoring refactoring= ExtractInterfaceRefactoring.create(type, JavaPreferencesSettings.getCodeGenerationSettings());
		Assert.isNotNull(refactoring);
		
		if (!ActionUtil.isProcessable(getShell(), refactoring.getInputType()))
			return;
		Object newElementToProcess= new RefactoringStarter().activate(refactoring, createWizard(refactoring), getShell(), RefactoringMessages.getString("OpenRefactoringWizardAction.refactoring"), true); 
		if (newElementToProcess == null)
			return;
		IStructuredSelection mockSelection= new StructuredSelection(newElementToProcess);
		selectionChanged(mockSelection);
		if (isEnabled())
			run(mockSelection);
		else
			MessageDialog.openInformation(getShell(), RefactoringMessages.getString("ExtractInterfaceAction.Refactoring"), RefactoringMessages.getString("ExtractInterfaceAction.not_possible")); 
	}
}