IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window != null) { IWorkbenchPage page= window.getActivePage(); if (page != null) { IEditorPart editor= page.getActiveEditor(); if (editor instanceof ITextEditor) return (JavaEditor) editor; } } return null;
return fEditor;
	private ITextEditor getActiveEditor() {		IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow();		if (window != null) {			IWorkbenchPage page= window.getActivePage();			if (page != null) {				IEditorPart editor= page.getActiveEditor();				if (editor instanceof ITextEditor)					return (JavaEditor) editor;			}		}		return null;	}