@Override public void addPropertyChangeListener(IPropertyChangeListener listener) { fOpenAction.addPropertyChangeListener(listener); }
@Override public void run(IStructuredSelection selection) { if (!checkEnabled(selection)) return; run(selection.toArray()); }
@Override public int getAccelerator() { return fOpenAction.getAccelerator(); }
@Override public void selectionChanged(IStructuredSelection selection) { setEnabled(checkEnabled(selection)); }
ITypeRoot input= EditorUtility.getEditorInputJavaElement(fEditor, false); if (input == null) { setStatusLineMessage(); return; elements= selectOpenableElements(elements); if (elements == null || elements.length == 0) { if (!ActionUtil.isProcessable(fEditor)) return; setStatusLineMessage(); return; element= SelectionConverter.selectJavaElement(elements, getShell(), getDialogTitle(), ActionMessages.OpenAction_select_element); if (element == null) return; run(new Object[] {element} ); } catch (InvocationTargetException e) { ExceptionHandler.handle(e, getShell(), getDialogTitle(), ActionMessages.OpenAction_error_message); } catch (InterruptedException e) {
Object element= elements[i]; try { Object javaElement= getElementToOpen(element); if (javaElement instanceof IPackageFragment) { if (fEditor == null) { setStatusLineMessage(); return; ErrorDialog.openError(getShell(), getDialogTitle(), ActionMessages.OpenAction_error_message, children.length == 1 ? children[0] : status);
/** * Creates a new <code>OpenEditorActionGroup</code>. The group requires * that the selection provided by the given selection provider is of type * {@link IStructuredSelection}. * * @param site the site that will own the action group. * @param specialSelectionProvider the selection provider used instead of the * sites selection provider. * * @since 3.4 */ public OpenEditorActionGroup(IWorkbenchPartSite site, ISelectionProvider specialSelectionProvider) { fSite= site; fOpen= new OpenAction(fSite); fOpen.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_EDITOR); fSelectionProvider= specialSelectionProvider == null ? fSite.getSelectionProvider() : specialSelectionProvider; initialize(); if (specialSelectionProvider != null) fOpen.setSpecialSelectionProvider(specialSelectionProvider); }
public void run(ITextSelection selection) { if (!isProcessable()) return; try { IJavaElement[] elements= SelectionConverter.codeResolveForked(fEditor, false); if (elements == null || elements.length == 0) { IEditorStatusLine statusLine= (IEditorStatusLine) fEditor.getAdapter(IEditorStatusLine.class); if (statusLine != null) statusLine.setMessage(true, ActionMessages.OpenAction_error_messageBadSelection, null); getShell().getDisplay().beep(); return; } IJavaElement element= elements[0]; if (elements.length > 1) { element= SelectionConverter.selectJavaElement(elements, getShell(), getDialogTitle(), ActionMessages.OpenAction_select_element); if (element == null) return; } int type= element.getElementType(); if (type == IJavaElement.JAVA_PROJECT || type == IJavaElement.PACKAGE_FRAGMENT_ROOT || type == IJavaElement.PACKAGE_FRAGMENT) element= EditorUtility.getEditorInputJavaElement(fEditor, false); run(new Object[] {element} ); } catch (InvocationTargetException e) { ExceptionHandler.handle(e, getShell(), getDialogTitle(), ActionMessages.OpenAction_error_message); } catch (InterruptedException e) { // ignore } }
/** * Creates a new <code>OpenActionGroup</code>. The group requires * that the selection provided by the part's selection provider is of type <code> * org.eclipse.jface.viewers.IStructuredSelection</code>. * * @param part the view part that owns this action group */ public OpenEditorActionGroup(IViewPart part) { fSite= part.getSite(); fOpen= new OpenAction(fSite); fOpen.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_EDITOR); initialize(fSite.getSelectionProvider()); }
@Override public void run() { IJavaElement inputElement= fInfoView.getOrignalInput(); new OpenAction(fInfoView.getViewSite()).run(new Object[] { inputElement }); } }
Object element= elements[i]; try { element= getElementToOpen(element); boolean activateOnOpen= fEditor != null ? true : OpenStrategy.activateOnOpen(); IEditorPart part= EditorUtility.openInEditor(element, activateOnOpen); ErrorDialog.openError(getShell(), getDialogTitle(), ActionMessages.OpenAction_error_message, children.length == 1 ? children[0] : status);
public TypeHierarchyViewer(Composite parent, IContentProvider contentProvider, TypeHierarchyLifeCycle lifeCycle, IWorkbenchPart part) { super(new Tree(parent, SWT.SINGLE)); fLabelProvider= new HierarchyLabelProvider(lifeCycle); setLabelProvider(new DecoratingJavaLabelProvider(fLabelProvider, true)); setUseHashlookup(true); setContentProvider(contentProvider); setComparator(new HierarchyViewerSorter(lifeCycle)); fOpen= new OpenAction(part.getSite()); addOpenListener(new IOpenListener() { public void open(OpenEvent event) { fOpen.run(); } }); ColoredViewersManager.install(this); JavaUIHelp.setHelp(this, IJavaHelpContextIds.TYPE_HIERARCHY_VIEW); }
public Object getElementToOpen(Object object) throws JavaModelException { if (object instanceof IJavaElement) fLastOpenedElement= (IJavaElement)object; else fLastOpenedElement= null; return super.getElementToOpen(object); }
@Override public ImageDescriptor getDisabledImageDescriptor() { return fOpenAction.getDisabledImageDescriptor(); }
@Override public HelpListener getHelpListener() { return fOpenAction.getHelpListener(); }
public String getActionDefinitionId() { return fOpenAction.getActionDefinitionId(); }
@Override public String getDescription() { return fOpenAction.getDescription(); }
ITypeRoot input= EditorUtility.getEditorInputJavaElement(fEditor, false); if (input == null) { setStatusLineMessage(); return; elements= selectOpenableElements(elements); if (elements == null || elements.length == 0) { if (!ActionUtil.isProcessable(fEditor)) return; setStatusLineMessage(); return; if (needsUserSelection(elements, input)) { element= SelectionConverter.selectJavaElement(elements, getShell(), getDialogTitle(), ActionMessages.OpenAction_select_element); if (element == null) return; run(new Object[] {element} ); } catch (InvocationTargetException e) { ExceptionHandler.handle(e, getShell(), getDialogTitle(), ActionMessages.OpenAction_error_message); } catch (InterruptedException e) {
Object element= elements[i]; try { Object javaElement= getElementToOpen(element); if (javaElement instanceof IPackageFragment) { if (fEditor == null) { setStatusLineMessage(); return; ErrorDialog.openError(getShell(), getDialogTitle(), ActionMessages.OpenAction_error_message, children.length == 1 ? children[0] : status);
/** * Creates a new <code>OpenEditorActionGroup</code>. The group requires * that the selection provided by the given selection provider is of type * {@link IStructuredSelection}. * * @param site the site that will own the action group. * @param specialSelectionProvider the selection provider used instead of the * sites selection provider. * * @since 3.4 */ public OpenEditorActionGroup(IWorkbenchPartSite site, ISelectionProvider specialSelectionProvider) { fSite= site; fOpen= new OpenAction(fSite); fOpen.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_EDITOR); fSelectionProvider= specialSelectionProvider == null ? fSite.getSelectionProvider() : specialSelectionProvider; initialize(); if (specialSelectionProvider != null) fOpen.setSpecialSelectionProvider(specialSelectionProvider); }