@Override public void run(IStructuredSelection selection) { run(getResource(selection)); }
@Override public void selectionChanged(IStructuredSelection selection) { setEnabled(getResource(selection) != null); }
public void run(ITextSelection selection) { IJavaElement input= SelectionConverter.getInput(fEditor); if (!ActionUtil.isProcessable(getShell(), input)) return; try { IJavaElement[] elements= SelectionConverter.codeResolveOrInputForked(fEditor); if (elements == null || elements.length == 0) return; IJavaElement candidate= elements[0]; if (elements.length > 1) { candidate= SelectionConverter.selectJavaElement(elements, getShell(), getDialogTitle(), ActionMessages.ShowInNavigatorView_dialog_message); } if (candidate != null) { run(getResource(candidate)); } } catch (InvocationTargetException e) { ExceptionHandler.handle(e, getDialogTitle(), ActionMessages.SelectionConverter_codeResolve_failed); } catch (InterruptedException e) { // cancelled } }
public void run(IResource resource) { if (resource == null) return; try { IWorkbenchPage page= getSite().getWorkbenchWindow().getActivePage(); IViewPart view= page.showView(IPageLayout.ID_RES_NAV); if (view instanceof ISetSelectionTarget) { ISelection selection= new StructuredSelection(resource); ((ISetSelectionTarget)view).selectReveal(selection); } } catch(PartInitException e) { ExceptionHandler.handle(e, getShell(), getDialogTitle(), ActionMessages.ShowInNavigatorView_error_activation_failed); } }
private boolean openContainer(IContainer container) { if (container != null && container.exists()) try { IViewPart part = PDEPlugin.getActivePage().showView(IPageLayout.ID_RES_NAV); ShowInNavigatorViewAction action = new ShowInNavigatorViewAction(part.getSite()); action.run(container); } catch (PartInitException e) { return false; } return true; }
/** * Creates a new <code>ShowInNavigatorViewAction</code>. The action requires * that the selection provided by the site's selection provider is of type * <code>org.eclipse.jface.viewers.IStructuredSelection</code>. * * @param site the site providing context information for this action */ public ShowInNavigatorViewAction(IWorkbenchSite site) { super(site); setText(ActionMessages.ShowInNavigatorView_label); PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.SHOW_IN_NAVIGATOR_VIEW_ACTION); }
/** * Note: This constructor is for internal use only. Clients should not call this constructor. * @param editor the Java editor */ public ShowInNavigatorViewAction(JavaEditor editor) { this(editor.getEditorSite()); fEditor= editor; setEnabled(SelectionConverter.canOperateOn(fEditor)); }
private IResource getResource(IStructuredSelection selection) { if (selection.size() != 1) return null; Object element= selection.getFirstElement(); if (element instanceof IResource) return (IResource)element; if (element instanceof IJavaElement) return getResource((IJavaElement)element); return null; }
@Override public void run(ITextSelection selection) { IJavaElement input= SelectionConverter.getInput(fEditor); if (!ActionUtil.isProcessable(getShell(), input)) return; try { IJavaElement[] elements= SelectionConverter.codeResolveOrInputForked(fEditor); if (elements == null || elements.length == 0) return; IJavaElement candidate= elements[0]; if (elements.length > 1) { candidate= SelectionConverter.selectJavaElement(elements, getShell(), getDialogTitle(), ActionMessages.ShowInNavigatorView_dialog_message); } if (candidate != null) { run(getResource(candidate)); } } catch (InvocationTargetException e) { ExceptionHandler.handle(e, getDialogTitle(), ActionMessages.SelectionConverter_codeResolve_failed); } catch (InterruptedException e) { // cancelled } }
public void run(IResource resource) { if (resource == null) return; try { IWorkbenchPage page= getSite().getWorkbenchWindow().getActivePage(); IViewPart view= page.showView(JavaPlugin.ID_RES_NAV); if (view instanceof ISetSelectionTarget) { ISelection selection= new StructuredSelection(resource); ((ISetSelectionTarget)view).selectReveal(selection); } } catch(PartInitException e) { ExceptionHandler.handle(e, getShell(), getDialogTitle(), ActionMessages.ShowInNavigatorView_error_activation_failed); } }
/** * Creates a new <code>ShowInNavigatorViewAction</code>. The action requires * that the selection provided by the site's selection provider is of type * <code>org.eclipse.jface.viewers.IStructuredSelection</code>. * * @param site the site providing context information for this action */ public ShowInNavigatorViewAction(IWorkbenchSite site) { super(site); setText(ActionMessages.ShowInNavigatorView_label); PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.SHOW_IN_NAVIGATOR_VIEW_ACTION); }
/** * Note: This constructor is for internal use only. Clients should not call this constructor. * @param editor the Java editor * * @noreference This constructor is not intended to be referenced by clients. */ public ShowInNavigatorViewAction(JavaEditor editor) { this(editor.getEditorSite()); fEditor= editor; setEnabled(SelectionConverter.canOperateOn(fEditor)); }
private IResource getResource(IStructuredSelection selection) { if (selection.size() != 1) return null; Object element= selection.getFirstElement(); if (element instanceof IResource) return (IResource)element; if (element instanceof IJavaElement) return getResource((IJavaElement)element); return null; }
@Override public void run(ITextSelection selection) { IJavaElement input= SelectionConverter.getInput(fEditor); if (!ActionUtil.isProcessable(getShell(), input)) return; try { IJavaElement[] elements= SelectionConverter.codeResolveOrInputForked(fEditor); if (elements == null || elements.length == 0) return; IJavaElement candidate= elements[0]; if (elements.length > 1) { candidate= SelectionConverter.selectJavaElement(elements, getShell(), getDialogTitle(), ActionMessages.ShowInNavigatorView_dialog_message); } if (candidate != null) { run(getResource(candidate)); } } catch (InvocationTargetException e) { ExceptionHandler.handle(e, getDialogTitle(), ActionMessages.SelectionConverter_codeResolve_failed); } catch (InterruptedException e) { // cancelled } }
public void run(IResource resource) { if (resource == null) return; try { IWorkbenchPage page= getSite().getWorkbenchWindow().getActivePage(); IViewPart view= page.showView(JavaPlugin.ID_RES_NAV); if (view instanceof ISetSelectionTarget) { ISelection selection= new StructuredSelection(resource); ((ISetSelectionTarget)view).selectReveal(selection); } } catch(PartInitException e) { ExceptionHandler.handle(e, getShell(), getDialogTitle(), ActionMessages.ShowInNavigatorView_error_activation_failed); } }
@Override public void run(IStructuredSelection selection) { run(getResource(selection)); }
@Override public void selectionChanged(IStructuredSelection selection) { setEnabled(getResource(selection) != null); }
/** * Creates a new <code>ShowInNavigatorViewAction</code>. The action requires * that the selection provided by the site's selection provider is of type * <code>org.eclipse.jface.viewers.IStructuredSelection</code>. * * @param site the site providing context information for this action */ public ShowInNavigatorViewAction(IWorkbenchSite site) { super(site); setText(ActionMessages.ShowInNavigatorView_label); PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.SHOW_IN_NAVIGATOR_VIEW_ACTION); }
/** * Note: This constructor is for internal use only. Clients should not call this constructor. * @param editor the Java editor * * @noreference This constructor is not intended to be referenced by clients. */ public ShowInNavigatorViewAction(JavaEditor editor) { this(editor.getEditorSite()); fEditor= editor; setEnabled(SelectionConverter.canOperateOn(fEditor)); }
private IResource getResource(IStructuredSelection selection) { if (selection.size() != 1) return null; Object element= selection.getFirstElement(); if (element instanceof IResource) return (IResource)element; if (element instanceof IJavaElement) return getResource((IJavaElement)element); return null; }