*/
public class EditorUtility {
- public static boolean isEditorInput(Object element, IEditorPart editor) {
- if (editor != null) {
- try {
- return editor.getEditorInput().equals(getEditorInput(element));
- } catch (JavaModelException x) {
- PHPeclipsePlugin.log(x.getStatus());
- }
- }
- return false;
- }
+// public static boolean isEditorInput(Object element, IEditorPart editor) {
+// if (editor != null) {
+// try {
+// return editor.getEditorInput().equals(getEditorInput(element));
+// } catch (JavaModelException x) {
+// PHPeclipsePlugin.log(x.getStatus());
+// }
+// }
+// return false;
+// }
/**
* Tests if a cu is currently shown in an editor
* @return the IEditorPart if shown, null if element is not open in an
* editor
*/
- public static IEditorPart isOpenInEditor(Object inputElement) {
- IEditorInput input = null;
-
- try {
- input = getEditorInput(inputElement);
- } catch (JavaModelException x) {
- PHPeclipsePlugin.log(x.getStatus());
- }
-
- if (input != null) {
- IWorkbenchPage p = PHPeclipsePlugin.getActivePage();
- if (p != null) {
- return p.findEditor(input);
- }
- }
-
- return null;
- }
+// public static IEditorPart isOpenInEditor(Object inputElement) {
+// IEditorInput input = null;
+//
+// try {
+// input = getEditorInput(inputElement);
+// } catch (JavaModelException x) {
+// PHPeclipsePlugin.log(x.getStatus());
+// }
+//
+// if (input != null) {
+// IWorkbenchPage p = PHPeclipsePlugin.getActivePage();
+// if (p != null) {
+// return p.findEditor(input);
+// }
+// }
+//
+// return null;
+// }
/**
* Opens a Java editor for an element such as <code>IJavaElement</code>,
* If the current active editor edits a java element return it, else return
* null
*/
- public static IJavaElement getActiveEditorJavaInput() {
- IWorkbenchPage page = PHPeclipsePlugin.getActivePage();
- if (page != null) {
- IEditorPart part = page.getActiveEditor();
- if (part != null) {
- IEditorInput editorInput = part.getEditorInput();
- if (editorInput != null) {
- return (IJavaElement) editorInput
- .getAdapter(IJavaElement.class);
- }
- }
- }
- return null;
- }
+// public static IJavaElement getActiveEditorJavaInput() {
+// IWorkbenchPage page = PHPeclipsePlugin.getActivePage();
+// if (page != null) {
+// IEditorPart part = page.getActiveEditor();
+// if (part != null) {
+// IEditorInput editorInput = part.getEditorInput();
+// if (editorInput != null) {
+// return (IJavaElement) editorInput
+// .getAdapter(IJavaElement.class);
+// }
+// }
+// }
+// return null;
+// }
/**
* Gets the working copy of an compilation unit opened in an editor
* @return the corresponding member in the shared working copy or
* <code>null</code> if not found
*/
- public static IMember getWorkingCopy(IMember member)
- throws JavaModelException {
- ICompilationUnit cu = member.getCompilationUnit();
- if (cu != null) {
- ICompilationUnit workingCopy = getWorkingCopy(cu);
- if (workingCopy != null) {
- return JavaModelUtil.findMemberInCompilationUnit(workingCopy,
- member);
- }
- }
- return null;
- }
+// public static IMember getWorkingCopy(IMember member)
+// throws JavaModelException {
+// ICompilationUnit cu = member.getCompilationUnit();
+// if (cu != null) {
+// ICompilationUnit workingCopy = getWorkingCopy(cu);
+// if (workingCopy != null) {
+// return JavaModelUtil.findMemberInCompilationUnit(workingCopy,
+// member);
+// }
+// }
+// return null;
+// }
/**
* Returns the compilation unit for the given java element.