if (sel instanceof ITextSelection){ IEditorPart part = getTargetPage().getActiveEditor(); if (part != null) { IEditorInput input = part.getEditorInput(); IResource r = (IResource) input.getAdapter(IResource.class); if (r != null) { switch(r.getType()){ case IResource.FILE: this.selection = new StructuredSelection(r); if (action != null) { setActionEnablement(action); } break; } } } }
	public void selectionChanged(IAction action, ISelection sel) {		if (sel instanceof IStructuredSelection) {			this.selection = (IStructuredSelection) sel;			if (action != null) {				setActionEnablement(action);			}		}	}