Java Code Examples for org.eclipse.ui.browser.IWorkbenchBrowserSupport#createBrowser()
The following examples show how to use
org.eclipse.ui.browser.IWorkbenchBrowserSupport#createBrowser() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OpenAppAction.java From codewind-eclipse with Eclipse Public License 2.0 | 8 votes |
public static void openAppInBrowser(CodewindApplication app) { URL appRootUrl = app.getRootUrl(); if (appRootUrl == null) { Logger.logError("The application could not be opened in the browser because the url is null: " + app.name); //$NON-NLS-1$ return; } try { // Use the app's ID as the browser ID so that if this is called again on the same app, // the browser will be re-used IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport(); IWebBrowser browser = browserSupport .createBrowser(IWorkbenchBrowserSupport.NAVIGATION_BAR | IWorkbenchBrowserSupport.LOCATION_BAR, app.projectID, app.name, NLS.bind(Messages.BrowserTooltipApp, app.name)); browser.openURL(appRootUrl); } catch (PartInitException e) { Logger.logError("Error opening app in browser", e); //$NON-NLS-1$ } }
Example 2
Source File: WorkbenchBrowserUtil.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
/** * Opens an URL with the default settings (which will typically open in an internal browser with no toolbar/url * bar/etc). * * @param url * @return */ public static IWebBrowser openURL(String url) { try { IWorkbenchBrowserSupport workbenchBrowserSupport = PlatformUI.getWorkbench().getBrowserSupport(); IWebBrowser webBrowser = workbenchBrowserSupport.createBrowser(null); if (webBrowser != null) { webBrowser.openURL(new URL(url)); } return webBrowser; } catch (Exception e) { IdeLog.logError(UIPlugin.getDefault(), e); } return null; }
Example 3
Source File: BrowserUtilities.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
public static IWebBrowser launchBrowser(String targetUrl) throws MalformedURLException, PartInitException { Workbench workbench = Workbench.getInstance(); if (workbench == null) { throw new PartInitException("No workbench is available"); } IWorkbenchBrowserSupport browserSupport = workbench.getBrowserSupport(); URL url = new URL(targetUrl); IWebBrowser browser = browserSupport.createBrowser(IWorkbenchBrowserSupport.AS_EXTERNAL, null, "GWT", "GWT"); browser.openURL(url); return browser; }
Example 4
Source File: ShowBrowserEditorAction.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public void run(IAction action) { try { IWorkbenchBrowserSupport workbenchBrowserSupport = PlatformUI.getWorkbench().getBrowserSupport(); if (workbenchBrowserSupport.isInternalWebBrowserAvailable()) { IWebBrowser webBrowser = workbenchBrowserSupport.createBrowser(IWorkbenchBrowserSupport.AS_EDITOR | IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.NAVIGATION_BAR | IWorkbenchBrowserSupport.STATUS, null, null, null); if (webBrowser != null) { webBrowser.openURL(null); } } } catch (PartInitException e) { IdeLog.logError(BrowserPlugin.getDefault(), e); } }
Example 5
Source File: OpenTektonDashboardAction.java From codewind-eclipse with Eclipse Public License 2.0 | 4 votes |
@Override public void run() { if (conn == null) { // should not be possible Logger.logError("OpenTektonDashboardAction ran but no remote connection was selected"); //$NON-NLS-1$ return; } TektonDashboard tekton = conn.getTektonDashboard(); if (tekton == null) { // Should not happen since the action should not show if there is no dashboard Logger.logError("OpenTektonDashboardAction ran but there is no tekton dashboard in the environment"); //$NON-NLS-1$ return; } if (!tekton.hasTektonDashboard()) { Logger.logError("Tekton dashboard is not available: " + tekton.getTektonMessage()); //$NON-NLS-1$ String errorMsg = tekton.isNotInstalled() ? Messages.ActionOpenTektonDashboardNotInstalled : Messages.ActionOpenTektonDashboardOtherError; MessageDialog.openError(Display.getDefault().getActiveShell(), Messages.ActionOpenTektonDashboardErrorDialogTitle, errorMsg); return; } URL url = tekton.getTektonUrl(); if (url == null) { Logger.logError("OpenTektonDashboardAction ran but could not get the url"); //$NON-NLS-1$ return; } try { IWebBrowser browser = null; IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport(); if (CoreUtil.isWindows()) { // Use the external browser if available since the dashboard does not display // well in the internal browser on Windows browser = browserSupport.getExternalBrowser(); } if (browser == null) { // Use the app's ID as the browser ID so that if this is called again on the same app, // the browser will be re-used browser = browserSupport .createBrowser(IWorkbenchBrowserSupport.NAVIGATION_BAR | IWorkbenchBrowserSupport.LOCATION_BAR, conn.getConid() + "_tektonDashboard", conn.getName(), NLS.bind(Messages.BrowserTooltipTektonDashboard, conn.getName())); } browser.openURL(url); } catch (PartInitException e) { Logger.logError("Error opening the Tekton dashboard in browser", e); //$NON-NLS-1$ } }
Example 6
Source File: OpenPerfMonitorAction.java From codewind-eclipse with Eclipse Public License 2.0 | 4 votes |
@Override public void run() { if (app == null) { // should not be possible Logger.logError("OpenPerformanceMonitorAction ran but no application was selected"); //$NON-NLS-1$ return; } if (!app.isRunning()) { CoreUtil.openDialog(true, Messages.OpenAppAction_CantOpenNotRunningAppTitle, Messages.OpenAppAction_CantOpenNotRunningAppMsg); return; } if (!app.hasPerfDashboard()) { CoreUtil.openDialog(true, Messages.GenericActionNotSupported, Messages.PerfDashboardNotSupported); return; } URL url = app.getPerfDashboardUrl(); if (url == null) { Logger.logError("OpenPerformanceMonitorAction ran but could not get the url"); //$NON-NLS-1$ return; } try { IWebBrowser browser = null; IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport(); if (CoreUtil.isWindows()) { // Use the external browser if available since the performance page does not display // well in the internal browser on Windows browser = browserSupport.getExternalBrowser(); } if (browser == null) { // Use the app's ID as the browser ID so that if this is called again on the same app, // the browser will be re-used browser = browserSupport .createBrowser(IWorkbenchBrowserSupport.NAVIGATION_BAR | IWorkbenchBrowserSupport.LOCATION_BAR, app.projectID + "_" + CoreConstants.PERF_MONITOR, app.name, NLS.bind(Messages.BrowserTooltipPerformanceMonitor, app.name)); } browser.openURL(url); } catch (PartInitException e) { Logger.logError("Error opening the performance dashboard in browser", e); //$NON-NLS-1$ } }
Example 7
Source File: OpenAppMonitorAction.java From codewind-eclipse with Eclipse Public License 2.0 | 4 votes |
@Override public void run() { if (app == null) { // should not be possible Logger.logError("OpenAppMonitorAction ran but no application was selected"); //$NON-NLS-1$ return; } if (!app.isRunning()) { CoreUtil.openDialog(true, Messages.OpenAppAction_CantOpenNotRunningAppTitle, Messages.OpenAppAction_CantOpenNotRunningAppMsg); return; } URL url = app.getMetricsDashboardUrl(); if (url == null) { // this should not happen Logger.logError("OpenAppMonitorAction ran but could not construct the url"); //$NON-NLS-1$ return; } app.confirmMetricsAvailable(); if (!app.hasMetricsDashboard()) { CoreUtil.openDialog(true, Messages.GenericActionNotSupported, Messages.AppMonitorNotSupported); return; } try { IWebBrowser browser = null; IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport(); if (CoreUtil.isWindows()) { // Use the external browser if available since the page does not display // well in the internal browser on Windows browser = browserSupport.getExternalBrowser(); } if (browser == null) { // Use the app's ID as the browser ID so that if this is called again on the same app, // the browser will be re-used browser = browserSupport .createBrowser(IWorkbenchBrowserSupport.NAVIGATION_BAR | IWorkbenchBrowserSupport.LOCATION_BAR, app.projectID + "_" + CoreConstants.VIEW_MONITOR, app.name, NLS.bind(Messages.BrowserTooltipAppMonitor, app.name)); } browser.openURL(url); } catch (PartInitException e) { Logger.logError("Error opening the metrics dashboard in browser", e); //$NON-NLS-1$ } }