org.eclipse.ui.browser.IWorkbenchBrowserSupport Java Examples

The following examples show how to use org.eclipse.ui.browser.IWorkbenchBrowserSupport. 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 vote down vote up
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: CoreUtil.java    From codewind-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
public static Control addLinkToDialog(Composite parent, String linkLabel, String linkUrl) {
	Link link = new Link(parent, SWT.WRAP);
	link.setText("<a>" + linkLabel + "</a>"); //$NON-NLS-1$ //$NON-NLS-2$
	link.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent event) {
			try {
				IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
				IWebBrowser browser = browserSupport.getExternalBrowser();
				URL url = new URL(linkUrl);
				browser.openURL(url);
			} catch (Exception e) {
				Logger.logError("An error occurred trying to open an external browser at: " + link, e); //$NON-NLS-1$
			}
		}
	});
	return link;
}
 
Example #3
Source File: ShowHelpCommand.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public Object execute(ExecutionEvent event) throws ExecutionException {
    try {
        Properties globalProperties = PlatformUtil.getStudioGlobalProperties();
        String url = null;
        if (globalProperties != null) {
            url = globalProperties.getProperty(HELP_URL_PROPERTY);
        } else {
            url = "http://www.bonitasoft.com/bos_redirect.php?bos_redirect_id=74";
        }
        url = url.concat("&").concat(majorVersion());
        IWebBrowser browser = PlatformUI.getWorkbench().getBrowserSupport()
                .createBrowser(IWorkbenchBrowserSupport.AS_EDITOR, BonitaPreferenceConstants.HELP_BROWSER_ID, "Quick Start", "");
        browser.openURL(new URL(url));

    } catch (Exception ex) {
        BonitaStudioLog.error(ex);
    }
    return null;
}
 
Example #4
Source File: OpenApplicationCommand.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public Object execute(ExecutionEvent event) throws ExecutionException {
    try {
        URL url = getURL();

        IWebBrowser browser;
        browser = PlatformUI.getWorkbench().getBrowserSupport().createBrowser(IWorkbenchBrowserSupport.AS_EDITOR,
                BonitaPreferenceConstants.APPLICATION_BROWSER_ID, "Bonita Application", "");
        browser.openURL(url);

    } catch (Exception e) {
        BonitaStudioLog.error(e);
        ErrorDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                "error",
                "error starting server",
                Status.OK_STATUS);
    }

    return null;
}
 
Example #5
Source File: OpenBrowserOperation.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void openAsView(IWorkbenchPage page) throws PartInitException {
    WebBrowserView view = null;
    IViewReference findViewReference = page.findViewReference(WebBrowserView.WEB_BROWSER_VIEW_ID,
            WebBrowserUtil.encodeStyle(id, IWorkbenchBrowserSupport.AS_VIEW));
    if (findViewReference == null) {
        view = (WebBrowserView) page.showView(WebBrowserView.WEB_BROWSER_VIEW_ID,
                WebBrowserUtil.encodeStyle(id, IWorkbenchBrowserSupport.AS_VIEW),
                IWorkbenchPage.VIEW_CREATE);
    } else {
        view = (WebBrowserView) findViewReference.getView(true);
    }
    if (name != null && name.length() > 0) {
        view.setBrowserViewName(name);
    }
    if (view != null) {
        view.setURL(url.toExternalForm());
        if (bringPartToTop) {
            page.bringToTop(view);
        }
    }
}
 
Example #6
Source File: OpenBrowserUtil.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private static void internalOpen(final URL url, final boolean useExternalBrowser) {
	BusyIndicator.showWhile(null, new Runnable() {
		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$
			}
		}
	});
}
 
Example #7
Source File: OpenBrowserUtil.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
private static void internalOpen(final URL url, final boolean useExternalBrowser) {
	BusyIndicator.showWhile(null, new Runnable() {
		@Override
		public void run() {
			URL helpSystemUrl= PlatformUI.getWorkbench().getHelpSystem().resolve(url.toExternalForm(), true);
			try {
				IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
				IWebBrowser browser;
				if (useExternalBrowser)
					browser= browserSupport.getExternalBrowser();
				else
					browser= browserSupport.createBrowser(null);
				browser.openURL(helpSystemUrl);
			} catch (PartInitException ex) {
			}
		}
	});
}
 
Example #8
Source File: WorkbenchBrowserUtil.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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 #9
Source File: UIUtils.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Opens the internal help in the Studio's internal browser.
 * 
 * @param url
 * @return A boolean value indicating a successful operations or not.
 */
public static boolean openHelpInBrowser(String url)
{
	IWorkbench workbench = PlatformUI.getWorkbench();
	if (workbench != null)
	{
		IWorkbenchHelpSystem helpSystem = workbench.getHelpSystem();
		URL resolvedURL = helpSystem.resolve(url, true);
		if (resolvedURL != null)
		{
			return openInBroswer(resolvedURL, true, IWorkbenchBrowserSupport.AS_EDITOR
					| IWorkbenchBrowserSupport.STATUS);
		}
		else
		{
			IdeLog.logError(UIPlugin.getDefault(), "Unable to resolve the Help URL for " + url); //$NON-NLS-1$
			return false;
		}
	}
	return false;
}
 
Example #10
Source File: IDEUtil.java    From codewind-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
public static void openExternalBrowser(String urlStr) {
	try {
		IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
		IWebBrowser browser = browserSupport.getExternalBrowser();
		URL url = new URL(urlStr);
		browser.openURL(url);
	} catch (Exception e) {
		Logger.logError("An error occurred trying to open an external browser at: " + urlStr, e); //$NON-NLS-1$
	}
}
 
Example #11
Source File: OpenBrowserOperation.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected void openBrowser() throws PartInitException {
    IWebBrowser browser = null;
    WebBrowserUtil.isInternalBrowserOperational = null;
    if (useInternalBrowser &&
            PlatformUI.getWorkbench().getBrowserSupport().isInternalWebBrowserAvailable()) {
        IWorkbenchWindow workbenchWindow = WebBrowserUIPlugin.getInstance().getWorkbench()
                .getActiveWorkbenchWindow();
        final IWorkbenchPage page = workbenchWindow.getActivePage();
        try {
            if (openAsView) {
                openAsView(page);
            } else {
                openAsEditor(page);
            }
        } catch (Exception e) {
            Trace.trace(Trace.SEVERE, "Error opening Web browser", e); //$NON-NLS-1$
        }
    } else if (browserIsSet()) {
        browser = externalBrowser;
        if (browser == null) {
            browser = PlatformUI.getWorkbench().getBrowserSupport().createBrowser(
                    IWorkbenchBrowserSupport.AS_EDITOR,
                    TYPE_ID, "", ""); //$NON-NLS-1$
        }
    }
    if (browser != null) {
        browser.openURL(url);
    }
    WebBrowserUtil.isInternalBrowserOperational = false;
    WebBrowserPreference.setBrowserChoice(WebBrowserPreference.EXTERNAL);
}
 
Example #12
Source File: SystemBrowserAdapter.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Display arbitary url.
 * 
 * @param url
 */
public void displayURL( String url )
{
	// if ( !Program.launch( url ) )
	// {
	//			ViewerPlugin.logError( ViewerPlugin.getFormattedResourceString( "viewer.browser.systemBrowser.noprogramforurl", //$NON-NLS-1$
	// new Object[]{
	// url
	// } ),
	// null );
	// }

	// use WorkbenchBrowserSupport so we needn't to provide browser
	// configuration
	IWorkbenchBrowserSupport support = PlatformUI.getWorkbench( )
			.getBrowserSupport( );
	try
	{
		IWebBrowser browser = support.getExternalBrowser( );
		browser.openURL( new URL( url ) );
	}
	catch ( Exception e )
	{
		ViewerPlugin.logError( ViewerPlugin.getFormattedResourceString( "viewer.browser.systemBrowser.noprogramforurl", //$NON-NLS-1$
				new Object[]{
					url
				} ),
				null );
	}
}
 
Example #13
Source File: UIUtils.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Open a URL in a browser.
 * 
 * @param url
 * @param internal
 *            In case true, the system will try to open the internal browser if it's available.
 * @param style
 *            the Browser's style, in case an internal browser is requested.
 * @return A boolean value indicating a successful operations or not.
 */
public static boolean openInBroswer(URL url, boolean internal, int style)
{
	IWorkbench workbench = PlatformUI.getWorkbench();
	if (workbench != null)
	{
		IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
		try
		{
			if (internal && support.isInternalWebBrowserAvailable())
			{

				support.createBrowser(style, INTERNAL_HELP_BROWSER_ID, null, null).openURL(url);

			}
			else
			{
				support.getExternalBrowser().openURL(url);
			}
		}
		catch (PartInitException e)
		{
			IdeLog.logError(UIPlugin.getDefault(), "Error opening the help", e); //$NON-NLS-1$
			return false;
		}
		return true;
	}
	return false;
}
 
Example #14
Source File: ViewReleaseNotesCommandHandler.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public Object execute(ExecutionEvent event) throws ExecutionException
{
	if (RELEASE_NOTES_URL == null)
	{
		return null;
	}

	try
	{
		IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();

		if (support.isInternalWebBrowserAvailable())
		{
			support.createBrowser(
					IWorkbenchBrowserSupport.NAVIGATION_BAR | IWorkbenchBrowserSupport.LOCATION_BAR
							| IWorkbenchBrowserSupport.AS_EDITOR | IWorkbenchBrowserSupport.STATUS,
					"ViewReleaseNotes", //$NON-NLS-1$
					null, // Set the name to null. That way the browser tab will display the title of page loaded in
							// the browser.
					null).openURL(RELEASE_NOTES_URL);
		}
		else
		{
			support.getExternalBrowser().openURL(RELEASE_NOTES_URL);
		}
	}
	catch (PartInitException e)
	{
		IdeLog.logError(UIPlugin.getDefault(), e);
	}

	return null;
}
 
Example #15
Source File: BrowserPlugin.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public synchronized IWorkbenchBrowserSupport getBrowserSupport()
{
	if (defaultWorkbenchBrowser == null)
	{
		defaultWorkbenchBrowser = new WorkbenchBrowserSupport();
	}
	return defaultWorkbenchBrowser;
}
 
Example #16
Source File: ShowBrowserEditorAction.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
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 #17
Source File: BrowserUtilities.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
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 #18
Source File: OpenUriSelectionListener.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
OpenUriSelectionListener(Supplier<Map<String, String>> queryParameterProvider,
    BiConsumer<Exception, URI> errorHandler, IWorkbenchBrowserSupport browserSupport) {
  this.queryParameterProvider = queryParameterProvider;
  this.errorHandler = errorHandler;
  this.browserSupport = browserSupport;
}
 
Example #19
Source File: BrowserCommandHandler.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public Object execute(ExecutionEvent event) throws ExecutionException
{
	if (browserURL == null)
	{
		return null;
	}

	try
	{
		IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();

		if (support.isInternalWebBrowserAvailable())
		{
			support.createBrowser(
					IWorkbenchBrowserSupport.NAVIGATION_BAR | IWorkbenchBrowserSupport.LOCATION_BAR
							| IWorkbenchBrowserSupport.AS_EDITOR | IWorkbenchBrowserSupport.STATUS, browserId,
					null, // Set the name to null so that the browser tab will display the title of page loaded in
							// the browser
					null).openURL(browserURL);
		}
		else
		{
			support.getExternalBrowser().openURL(browserURL);
		}
	}
	catch (PartInitException e)
	{
		IdeLog.logError(UIPlugin.getDefault(), e);
	}

	return null;
}
 
Example #20
Source File: OpenUrlAction.java    From workspacemechanic with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void run() {
  IWorkbenchBrowserSupport support
      = PlatformUI.getWorkbench().getBrowserSupport();
  try {
    support.getExternalBrowser().openURL(url);
  } catch (PartInitException e) {
    throw new IllegalStateException(
        "Eeep! Coudn't initialize part.", e);
  }
}
 
Example #21
Source File: WebBrowserFactory.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
protected IWebBrowser createExternalBrowser() throws PartInitException {
    return PlatformUI.getWorkbench().getBrowserSupport().createBrowser(IWorkbenchBrowserSupport.AS_EXTERNAL,
            null,
            null,
            null);
}
 
Example #22
Source File: OpenTektonDashboardAction.java    From codewind-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@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 #23
Source File: OpenPerfMonitorAction.java    From codewind-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@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 #24
Source File: OpenAppMonitorAction.java    From codewind-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@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$
}
  }
 
Example #25
Source File: OpenBrowserOperation.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
private void openAsEditor(IWorkbenchPage page) throws PartInitException {
    WebBrowserEditorInput editorInput = new WebBrowserEditorInput(url, IWorkbenchBrowserSupport.AS_EDITOR, id);
    page.openEditor(editorInput, WebBrowserEditor.WEB_BROWSER_EDITOR_ID, true);
}
 
Example #26
Source File: CodewindConnectionComposite.java    From codewind-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected void createControl() {
       GridLayout layout = new GridLayout();
       layout.numColumns = 2;
       layout.marginHeight = 20;
	layout.marginWidth = 8;
	layout.horizontalSpacing = 7;
	layout.verticalSpacing = 7;
       this.setLayout(layout);
       
       createLabel(Messages.CodewindConnectionComposite_ConnNameLabel, this, 1);
       connNameText = createConnText(this, SWT.NONE, 1);
      
       createLabel(Messages.CodewindConnectionComposite_UrlLabel, this, 1);
       connURLText = createConnText(this, SWT.NONE, 1);
       
       createLabel(Messages.CodewindConnectionComposite_UserLabel, this, 1);
       connUserText = createConnText(this, SWT.NONE, 1);
       
       createLabel(Messages.CodewindConnectionComposite_PasswordLabel, this, 1);
       connPassText = createConnText(this, SWT.PASSWORD, 1);
       
       new Label(this, SWT.NONE).setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false, 2, 1));
	
	Link learnMoreLink = new Link(this, SWT.NONE);
	learnMoreLink.setText("<a>" + Messages.RegMgmtLearnMoreLink + "</a>"); //$NON-NLS-1$ //$NON-NLS-2$
	learnMoreLink.setLayoutData(new GridData(GridData.BEGINNING, GridData.END, false, false, 1, 1));
	
	learnMoreLink.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent event) {
			try {
				IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
				IWebBrowser browser = browserSupport.getExternalBrowser();
				URL url = new URL(UIConstants.REMOTE_SETUP_URL);
				browser.openURL(url);
			} catch (Exception e) {
				Logger.logError("An error occurred trying to open an external browser at: " + UIConstants.TEMPLATES_INFO_URL, e); //$NON-NLS-1$
			}
		}
	});

	// Add Context Sensitive Help
	PlatformUI.getWorkbench().getHelpSystem().setHelp(this, CodewindUIPlugin.MAIN_CONTEXTID);

       initialize();
       connNameText.setFocus();
}
 
Example #27
Source File: ExploreBusinessDataModelHandler.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
private IWebBrowser getBrowser() throws PartInitException {
    IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
    return support.getExternalBrowser();
}
 
Example #28
Source File: BrowserAccessor.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private IWebBrowser getExternalBrowser( ) throws PartInitException
{
	IWorkbenchBrowserSupport support = PlatformUI.getWorkbench( )
			.getBrowserSupport( );
	return support.getExternalBrowser( );
}
 
Example #29
Source File: AbstractSelfHelpUI.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
private IWebBrowser getExternalBrowser() throws PartInitException {
	IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
	return support.getExternalBrowser();
}
 
Example #30
Source File: AbstractSelfHelpUI.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
private IWebBrowser getExternalBrowser() throws PartInitException {
	IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
	return support.getExternalBrowser();
}