import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
/**
* Method declared on SourceViewerConfiguration
*/
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
- try {
- IFile f = ((IFileEditorInput) fEditor.getEditorInput()).getFile();
- return new PHPTextHover(f.getProject());
- } catch (NullPointerException e) {
- // this exception occurs, if getTextHover is called by preference pages !
+ IEditorInput editorInput = fEditor.getEditorInput();
+ if (editorInput instanceof IFileEditorInput) {
+ try {
+ IFile f = ((IFileEditorInput) editorInput).getFile();
+ return new PHPTextHover(f.getProject());
+ } catch (NullPointerException e) {
+ // this exception occurs, if getTextHover is called by preference pages !
+ }
}
return new PHPTextHover(null);
}