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/SelfEncapsulateFieldAction.java
} catch (JavaModelException e) {
		}
		if (field == null) {
			MessageDialog.openInformation(
				getShell(), getDialogTitle(),
				ActionMessages.getFormattedString("SelfEncapsulateFieldAction.dialog.field_doesnot_exit", selectedField.getElementName()));  
			return;
		}
		
		try  {	
			SelfEncapsulateFieldRefactoring refactoring= createRefactoring(field);
			if (refactoring == null)
				return;
			new RefactoringStarter().activate(
				refactoring, 
				new SelfEncapsulateFieldWizard(refactoring), getShell(), getDialogTitle(), true);
		} catch (JavaModelException e) {
			ExceptionHandler.handle(e, getDialogTitle(),
				ActionMessages.getString("SelfEncapsulateFieldAction.dialog.cannot_perform")); 
		}
	}
	private SelfEncapsulateFieldRefactoring createRefactoring(IField field) throws JavaModelException {
		return SelfEncapsulateFieldRefactoring.create(field);
	}
		
	private String getDialogTitle() {
		return ActionMessages.getString("SelfEncapsulateFieldAction.dialog.title"); 
	}	
}