public void displayURL(String url) throws Exception { try { IWebBrowser browser = getExternalBrowser(); if (browser != null) { browser.openURL(new URL(url)); } } catch (PartInitException pie) { ErrorUtil.displayErrorDialog(pie.getLocalizedMessage()); } }
public void mouseUp(MouseEvent e) { if (commitLink.getSelectionText().length() != 0) return; try { getShell().dispose(); CommitEditor.open(new RepositoryCommit(revision .getRepository(), revision.getCommit())); } catch (PartInitException pie) { Activator.logError(pie.getLocalizedMessage(), pie); } } });
private String openInEditor(String path, File buildFile) { File buildFileParent = null; if (buildFile != null) { buildFileParent = buildFile.getParentFile(); } IFile file = AntUtil.getFileForLocation(path, buildFileParent); if (file != null && file.exists()) { try { IWorkbenchPage p = getEditorSite().getPage(); if (p != null) { IDE.openEditor(p, file, isActivePart()); } return null; } catch (PartInitException e) { return e.getLocalizedMessage(); } } File externalFile = new File(path); if (externalFile.exists()) { new ExternalHyperlink(externalFile, -1).linkActivated(); return null; } return IAntCoreConstants.EMPTY_STRING; }
private void open(KeyReference keyReference) { if (keyReference == null) return; try { IEditorPart part= keyReference.element != null ? EditorUtility.openInEditor(keyReference.element, true) : EditorUtility.openInEditor(keyReference.resource, true); if (part != null) EditorUtility.revealInEditor(part, keyReference.offset, keyReference.length); } catch (PartInitException x) { String message= null; IWorkbenchAdapter wbAdapter= ((IAdaptable)keyReference).getAdapter(IWorkbenchAdapter.class); if (wbAdapter != null) message= Messages.format(PropertiesFileEditorMessages.OpenAction_error_messageArgs, new String[] { wbAdapter.getLabel(keyReference), x.getLocalizedMessage() } ); if (message == null) message= Messages.format(PropertiesFileEditorMessages.OpenAction_error_message, x.getLocalizedMessage()); MessageDialog.openError(fShell, PropertiesFileEditorMessages.OpenAction_error_messageProblems, message); } }
private void open(KeyReference keyReference) { if (keyReference == null) return; try { IEditorPart part= keyReference.element != null ? EditorUtility.openInEditor(keyReference.element, true) : EditorUtility.openInEditor(keyReference.resource, true); if (part != null) EditorUtility.revealInEditor(part, keyReference.offset, keyReference.length); } catch (PartInitException x) { String message= null; IWorkbenchAdapter wbAdapter= ((IAdaptable)keyReference).getAdapter(IWorkbenchAdapter.class); if (wbAdapter != null) message= Messages.format(PropertiesFileEditorMessages.OpenAction_error_messageArgs, new String[] { wbAdapter.getLabel(keyReference), x.getLocalizedMessage() } ); if (message == null) message= Messages.format(PropertiesFileEditorMessages.OpenAction_error_message, x.getLocalizedMessage()); MessageDialog.openError(fShell, PropertiesFileEditorMessages.OpenAction_error_messageProblems, message); } }
private void open(KeyReference keyReference) { if (keyReference == null) return; try { IEditorPart part= EditorUtility.openInEditor(keyReference.storage, true); EditorUtility.revealInEditor(part, keyReference.offset, keyReference.length); } catch (JavaModelException e) { JavaPlugin.log(new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IJavaStatusConstants.INTERNAL_ERROR, PropertiesFileEditorMessages.OpenAction_error_message, e)); ErrorDialog.openError(fShell, getErrorDialogTitle(), PropertiesFileEditorMessages.OpenAction_error_messageProblems, e.getStatus()); } catch (PartInitException x) { String message= null; IWorkbenchAdapter wbAdapter= (IWorkbenchAdapter)((IAdaptable)keyReference).getAdapter(IWorkbenchAdapter.class); if (wbAdapter != null) message= Messages.format(PropertiesFileEditorMessages.OpenAction_error_messageArgs, new String[] { wbAdapter.getLabel(keyReference), x.getLocalizedMessage() } ); if (message == null) message= Messages.format(PropertiesFileEditorMessages.OpenAction_error_message, x.getLocalizedMessage()); MessageDialog.openError(fShell, PropertiesFileEditorMessages.OpenAction_error_messageProblems, message); } }
public void run() { String fileName = getResolvedURL(getElement(), URI); if (fileName != null && fileName.length() > 0) { IPath includedPath = new Path(fileName); includedPath.makeAbsolute(); IFile file = getFile(includedPath); if (file != null && file.exists()) { try { IDE.openEditor(getPage(), file); return; } catch (PartInitException e) { PDPlugin.getAlerts().warning( "Message.Warning.Title", e.getLocalizedMessage());//$NON-NLS-1$ } } } PDPlugin.getAlerts().warning( "Message.Warning.Title", "Taglib.OpenFile.ERROR");//$NON-NLS-1$ //$NON-NLS-2$ }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { ExtendedMarkersView part = getView(event); if (part == null) return null; try { String count = ExtendedMarkersView.newSecondaryID(part); String defaultName = NLS.bind(MarkerMessages.newViewTitle, new Object[] { part.getSite().getRegisteredName(), count }); InputDialog dialog = new InputDialog(part.getSite().getShell(), NLS .bind(MarkerMessages.NewViewHandler_dialogTitle, new String[] { part.getSite() .getRegisteredName() }), MarkerMessages.NewViewHandler_dialogMessage, defaultName, getValidator()); if (dialog.open() != Window.OK) return this; IViewPart newPart = part.getSite().getPage() .showView(part.getSite().getId(), count, IWorkbenchPage.VIEW_ACTIVATE); if (newPart instanceof ExtendedMarkersView) { ((ExtendedMarkersView) newPart).initializeTitle(dialog .getValue()); } } catch (PartInitException e) { throw new ExecutionException(e.getLocalizedMessage(), e); } return this; }