X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/SelectionConverter.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/SelectionConverter.java index 7fb9328..21f7c26 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/SelectionConverter.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/actions/SelectionConverter.java @@ -10,13 +10,13 @@ *******************************************************************************/ package net.sourceforge.phpdt.internal.ui.actions; -import java.util.Iterator; +//import java.util.Iterator; import net.sourceforge.phpdt.core.ICompilationUnit; import net.sourceforge.phpdt.core.IJavaElement; -import net.sourceforge.phpdt.core.IType; +//import net.sourceforge.phpdt.core.IType; import net.sourceforge.phpdt.core.JavaModelException; -import net.sourceforge.phpdt.internal.ui.util.ExceptionHandler; +//import net.sourceforge.phpdt.internal.ui.util.ExceptionHandler; import net.sourceforge.phpdt.ui.IWorkingCopyManager; //import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.phpeditor.PHPEditor; @@ -68,20 +68,20 @@ public class SelectionConverter { * An empty array is returned if one of the elements stored in the * structured selection is not of tupe IJavaElement */ - public static IJavaElement[] getElements(IStructuredSelection selection) { - if (!selection.isEmpty()) { - IJavaElement[] result = new IJavaElement[selection.size()]; - int i = 0; - for (Iterator iter = selection.iterator(); iter.hasNext(); i++) { - Object element = (Object) iter.next(); - if (!(element instanceof IJavaElement)) - return EMPTY_RESULT; - result[i] = (IJavaElement) element; - } - return result; - } - return EMPTY_RESULT; - } +// public static IJavaElement[] getElements(IStructuredSelection selection) { +// if (!selection.isEmpty()) { +// IJavaElement[] result = new IJavaElement[selection.size()]; +// int i = 0; +// for (Iterator iter = selection.iterator(); iter.hasNext(); i++) { +// Object element = (Object) iter.next(); +// if (!(element instanceof IJavaElement)) +// return EMPTY_RESULT; +// result[i] = (IJavaElement) element; +// } +// return result; +// } +// return EMPTY_RESULT; +// } public static boolean canOperateOn(PHPEditor editor) { if (editor == null) @@ -108,16 +108,16 @@ public class SelectionConverter { return result; } - public static IJavaElement[] codeResolveOrInputHandled(PHPEditor editor, - Shell shell, String title) { - try { - return codeResolveOrInput(editor); - } catch (JavaModelException e) { - ExceptionHandler.handle(e, shell, title, ActionMessages - .getString("SelectionConverter.codeResolve_failed")); //$NON-NLS-1$ - } - return null; - } +// public static IJavaElement[] codeResolveOrInputHandled(PHPEditor editor, +// Shell shell, String title) { +// try { +// return codeResolveOrInput(editor); +// } catch (JavaModelException e) { +// ExceptionHandler.handle(e, shell, title, ActionMessages +// .getString("SelectionConverter.codeResolve_failed")); //$NON-NLS-1$ +// } +// return null; +// } /** * Converts the text selection provided by the given editor a Java element @@ -139,16 +139,16 @@ public class SelectionConverter { return candidate; } - public static IJavaElement codeResolveOrInputHandled(PHPEditor editor, - Shell shell, String title, String message) { - try { - return codeResolveOrInput(editor, shell, title, message); - } catch (JavaModelException e) { - ExceptionHandler.handle(e, shell, title, ActionMessages - .getString("SelectionConverter.codeResolveOrInput_failed")); //$NON-NLS-1$ - } - return null; - } +// public static IJavaElement codeResolveOrInputHandled(PHPEditor editor, +// Shell shell, String title, String message) { +// try { +// return codeResolveOrInput(editor, shell, title, message); +// } catch (JavaModelException e) { +// ExceptionHandler.handle(e, shell, title, ActionMessages +// .getString("SelectionConverter.codeResolveOrInput_failed")); //$NON-NLS-1$ +// } +// return null; +// } public static IJavaElement[] codeResolve(PHPEditor editor) throws JavaModelException { @@ -161,29 +161,29 @@ public class SelectionConverter { * by asking the user if code reolve returned more than one result. If the * selection doesn't cover a Java element null is returned. */ - public static IJavaElement codeResolve(PHPEditor editor, Shell shell, - String title, String message) throws JavaModelException { - IJavaElement[] elements = codeResolve(editor); - if (elements == null || elements.length == 0) - return null; - IJavaElement candidate = elements[0]; - if (elements.length > 1) { - candidate = OpenActionUtil.selectJavaElement(elements, shell, - title, message); - } - return candidate; - } +// public static IJavaElement codeResolve(PHPEditor editor, Shell shell, +// String title, String message) throws JavaModelException { +// IJavaElement[] elements = codeResolve(editor); +// if (elements == null || elements.length == 0) +// return null; +// IJavaElement candidate = elements[0]; +// if (elements.length > 1) { +// candidate = OpenActionUtil.selectJavaElement(elements, shell, +// title, message); +// } +// return candidate; +// } - public static IJavaElement[] codeResolveHandled(PHPEditor editor, - Shell shell, String title) { - try { - return codeResolve(editor); - } catch (JavaModelException e) { - ExceptionHandler.handle(e, shell, title, ActionMessages - .getString("SelectionConverter.codeResolve_failed")); //$NON-NLS-1$ - } - return null; - } +// public static IJavaElement[] codeResolveHandled(PHPEditor editor, +// Shell shell, String title) { +// try { +// return codeResolve(editor); +// } catch (JavaModelException e) { +// ExceptionHandler.handle(e, shell, title, ActionMessages +// .getString("SelectionConverter.codeResolve_failed")); //$NON-NLS-1$ +// } +// return null; +// } public static IJavaElement getElementAtOffset(PHPEditor editor) throws JavaModelException { @@ -191,18 +191,18 @@ public class SelectionConverter { .getSelectionProvider().getSelection()); } - public static IType getTypeAtOffset(PHPEditor editor) - throws JavaModelException { - IJavaElement element = SelectionConverter.getElementAtOffset(editor); - IType type = (IType) element.getAncestor(IJavaElement.TYPE); - if (type == null) { - ICompilationUnit unit = SelectionConverter - .getInputAsCompilationUnit(editor); - if (unit != null) - type = unit.findPrimaryType(); - } - return type; - } +// public static IType getTypeAtOffset(PHPEditor editor) +// throws JavaModelException { +// IJavaElement element = SelectionConverter.getElementAtOffset(editor); +// IType type = (IType) element.getAncestor(IJavaElement.TYPE); +// if (type == null) { +// ICompilationUnit unit = SelectionConverter +// .getInputAsCompilationUnit(editor); +// if (unit != null) +// type = unit.findPrimaryType(); +// } +// return type; +// } public static IJavaElement getInput(PHPEditor editor) { if (editor == null) @@ -215,13 +215,13 @@ public class SelectionConverter { return manager.getWorkingCopy(input); } - public static ICompilationUnit getInputAsCompilationUnit(PHPEditor editor) { - Object editorInput = SelectionConverter.getInput(editor); - if (editorInput instanceof ICompilationUnit) - return (ICompilationUnit) editorInput; - else - return null; - } +// public static ICompilationUnit getInputAsCompilationUnit(PHPEditor editor) { +// Object editorInput = SelectionConverter.getInput(editor); +// if (editorInput instanceof ICompilationUnit) +// return (ICompilationUnit) editorInput; +// else +// return null; +// } private static IJavaElement[] codeResolve(IJavaElement input, ITextSelection selection) throws JavaModelException {