Bug 12102 AddImport in editor does not work for empty selection
Code resolve now works in that case and all actions must be adjusted
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/AddImportOnSelectionAction.java
private ITextEditor fEditor;
	
	public AddImportOnSelectionAction(ITextEditor editor) {	
		super(JavaEditorMessages.getString("AddImportOnSelection.label"));		 
		setToolTipText(JavaEditorMessages.getString("AddImportOnSelection.tooltip")); 
		setDescription(JavaEditorMessages.getString("AddImportOnSelection.description")); 
		
		fEditor= editor;
		WorkbenchHelp.setHelp(this, IJavaHelpContextIds.ADD_IMPORT_ON_SELECTION_ACTION);	
	}
	
	public AddImportOnSelectionAction() {
		this(null);
	}
	
	public void setContentEditor(ITextEditor editor) {
		fEditor= editor;
	}
	
	public void update() {
		boolean isEnabled= false;
		ISelection selection= fEditor.getSelectionProvider().getSelection();
		if (selection instanceof ITextSelection) {
			isEnabled= (((ITextSelection)selection).getLength() > 0);
		}
		setEnabled(isEnabled);
	}