private static void handleViewError(String id, PartInitException e) { StatusUtil.handleStatus(e.getStatus(), "View could not be opened: " + id, //$NON-NLS-1$ StatusManager.SHOW); }
/** * Creates a new exception object. Note that as of 3.5, this constructor * expects exactly one exception object in the given array, with all other * array positions being <code>null</code>. The restriction may be lifted in * the future, and clients of this class must not make this assumption. * * @param references * @param exceptions */ public MultiPartInitException(IWorkbenchPartReference[] references, PartInitException[] exceptions) { super(exceptions[findFirstException(exceptions)].getStatus()); this.references = references; this.exceptions = exceptions; }
private IEditorPart showWithoutReuse(Object element) throws PartInitException { try { return EditorUtility.openInEditor(element, false); } catch (PartInitException e) { if (e.getStatus().getCode() != IJavaStatusConstants.EDITOR_NO_EDITOR_INPUT) { throw e; } } return null; }
private IEditorPart showWithoutReuse(Object element) throws PartInitException { try { return EditorUtility.openInEditor(element, false); } catch (PartInitException e) { if (e.getStatus().getCode() != IJavaStatusConstants.EDITOR_NO_EDITOR_INPUT) { throw e; } } return null; }
@Override public void handleException(Throwable exception) { if (exception instanceof PartInitException) { PartInitException pie = (PartInitException) exception; ErrorDialog.openError(getSite().getShell(), SearchMessages.DefaultSearchViewPage_show_match, SearchMessages.DefaultSearchViewPage_error_no_editor, pie.getStatus()); } }
public static void handleOpen ( final IWorkbenchPage page, final String connectionId, final String factoryId, final String configurationId ) { try { page.openEditor ( new ConfigurationEditorInput ( connectionId, factoryId, configurationId ), MultiConfigurationEditor.EDITOR_ID, true ); } catch ( final PartInitException e ) { StatusManager.getManager ().handle ( e.getStatus () ); } } }
@Override public void run ( final IAction action ) { final MultiStatus status = new MultiStatus ( Activator.PLUGIN_ID, 0, this.message, null ); for ( final Item item : this.items ) { try { processItem ( item ); } catch ( final PartInitException e ) { status.add ( e.getStatus () ); } } if ( !status.isOK () ) { showError ( status ); } }
@Override public void run ( final IAction action ) { final MultiStatus status = new MultiStatus ( Activator.PLUGIN_ID, 0, this.message, null ); for ( final Item item : this.items ) { try { processItem ( item ); } catch ( final PartInitException e ) { status.add ( e.getStatus () ); } } if ( !status.isOK () ) { showError ( status ); } }
public static void handleOpen ( final IWorkbenchPage page, final ISelection selection ) { final MultiStatus status = new MultiStatus ( Activator.PLUGIN_ID, 0, "Open editor", null ); final IEditorInput[] inputs = EditorHelper.createInput ( selection ); for ( final IEditorInput input : inputs ) { try { if ( input instanceof ConfigurationEditorInput ) { page.openEditor ( input, MultiConfigurationEditor.EDITOR_ID, true ); } else if ( input instanceof FactoryEditorInput ) { page.openEditor ( input, FactoryEditor.EDITOR_ID, true ); } } catch ( final PartInitException e ) { status.add ( e.getStatus () ); } } }
/** * Opens external file, the editor that is used is based on best guess from * file name. * * @param file * the external file */ protected void openExternalFile(File file) { try { boolean activate = OpenStrategy.activateOnOpen(); IEditorDescriptor desc = IDE.getEditorDescriptor(file.getName()); IDE.openEditor(getWorkbenchPage(), file.toURI(), desc.getId(), activate); } catch (PartInitException e) { ErrorDialog.openError(getWorkbenchPage().getWorkbenchWindow() .getShell(), UIText.OpenWorkingFileAction_openWorkingFileShellTitle, e .getMessage(), e.getStatus()); } }
public void open() { // Create the browser IWorkbenchBrowserSupport support= PlatformUI.getWorkbench().getBrowserSupport(); IWebBrowser browser; try { browser= support.createBrowser(null); } catch (PartInitException e) { EditorsPlugin.logErrorStatus("Could not create Web browser for URLHyperlink", e.getStatus()); //$NON-NLS-1$ super.open(); return; } try { browser.openURL(new URL(fURLString)); } catch (PartInitException e) { super.open(); } catch (MalformedURLException e) { super.open(); } } }
@Override public void run() { URL helpSystemUrl= PlatformUI.getWorkbench().getHelpSystem().resolve(url.toExternalForm(), true); if (helpSystemUrl == null) { // can happen if org.eclipse.help.ui is not available return; // the resolve() method already wrote "Unable to instantiate help UI" to the log } try { IWorkbenchBrowserSupport browserSupport= PlatformUI.getWorkbench().getBrowserSupport(); IWebBrowser browser; if (useExternalBrowser) browser= browserSupport.getExternalBrowser(); else browser= browserSupport.createBrowser(null); browser.openURL(helpSystemUrl); } catch (PartInitException ex) { // XXX: show dialog? JavaPlugin.logErrorStatus("Opening Javadoc failed", ex.getStatus()); //$NON-NLS-1$ } } });
@Override public void run() { URL helpSystemUrl= PlatformUI.getWorkbench().getHelpSystem().resolve(url.toExternalForm(), true); if (helpSystemUrl == null) { // can happen if org.eclipse.help.ui is not available return; // the resolve() method already wrote "Unable to instantiate help UI" to the log } try { IWorkbenchBrowserSupport browserSupport= PlatformUI.getWorkbench().getBrowserSupport(); IWebBrowser browser; if (useExternalBrowser) browser= browserSupport.getExternalBrowser(); else browser= browserSupport.createBrowser(null); browser.openURL(helpSystemUrl); } catch (PartInitException ex) { // XXX: show dialog? JavaPlugin.logErrorStatus("Opening Javadoc failed", ex.getStatus()); //$NON-NLS-1$ } } });
@Override public void open() { // Create the browser IWorkbenchBrowserSupport support= PlatformUI.getWorkbench().getBrowserSupport(); IWebBrowser browser; try { browser= support.createBrowser(null); } catch (PartInitException e) { EditorsPlugin.logErrorStatus("Could not create Web browser for URLHyperlink", e.getStatus()); //$NON-NLS-1$ super.open(); return; } try { browser.openURL(new URL(getURLString())); } catch (PartInitException e) { super.open(); } catch (MalformedURLException e) { super.open(); } } }
/** * Shows the Navigator view and sets its selection to the resources * selected in this action's selection provider. */ @Override public void run() { List<IResource> v = getResources(getStructuredSelection()); if (v.isEmpty()) { return; } try { IViewPart view = page.showView(IPageLayout.ID_RES_NAV); if (view instanceof ISetSelectionTarget) { ISelection selection = new StructuredSelection(v); ((ISetSelectionTarget) view).selectReveal(selection); } } catch (PartInitException e) { ErrorDialog.openError(page.getWorkbenchWindow().getShell(), ResourceNavigatorMessages.ShowInNavigator_errorMessage, e.getMessage(), e.getStatus()); } }
/** * Creates page 0 of the multi-page editor, which contains a text editor. */ void createTextEditor() { try { editor = new BndTextEditor(); int index = addPage(editor, getEditorInput()); setPageText(index, editor.getTitle()); } catch (PartInitException e) { ErrorDialog.openError(getSite().getShell(), "Error creating nested text editor", null, e.getStatus()); } }
/** * Creates page 0 of the multi-page editor, which contains a text editor. */ void createTextEditor() { try { editor = new BndTextEditor(); int index = addPage(editor, getEditorInput()); setPageText(index, editor.getTitle()); } catch (PartInitException e) { ErrorDialog.openError(getSite().getShell(), "Error creating nested text editor", null, e.getStatus()); } }
@Override public Object execute(final ExecutionEvent event) throws ExecutionException { final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil .getActiveWorkbenchWindowChecked(event); final IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage(); if (activePage == null) { return null; } try { activePage.showView(viewId); } catch (PartInitException e) { IStatus status = StatusUtil .newStatus(e.getStatus(), e.getMessage()); StatusManager.getManager().handle(status, StatusManager.SHOW); } return null; } }
/** * Opens a editor on the given file resource. * * @param file * the workspace file */ protected void openWorkspaceFile(IFile file) { try { boolean activate = OpenStrategy.activateOnOpen(); IDE.openEditor(getWorkbenchPage(), file, activate); } catch (PartInitException e) { ErrorDialog.openError(getWorkbenchPage().getWorkbenchWindow() .getShell(), UIText.OpenWorkingFileAction_openWorkingFileShellTitle, e .getMessage(), e.getStatus()); } }
protected void createSourcePage() { structuredTextEditor = new StructuredTextEditor(); try { int index = addPage(structuredTextEditor, getEditorInput()); setPageText(index, Messages._UI_LABEL_SOURCE); structuredTextEditor.update(); structuredTextEditor.setEditorPart(this); structuredTextEditor.addPropertyListener(this); firePropertyChange(PROP_TITLE); } catch (PartInitException e) { ErrorDialog.openError(getSite().getShell(), "Error creating nested text editor", null, e.getStatus()); //$NON-NLS-1$ } }