Examples of IWorkbenchBrowserSupport


Examples of org.eclipse.ui.browser.IWorkbenchBrowserSupport

        link = ((INews) object).getLink();
      else if (object instanceof URI)
        link = (URI) object;

      if (link != null) {
        IWorkbenchBrowserSupport browser = PlatformUI.getWorkbench().getBrowserSupport();
        try {
          browser.createBrowser(WebBrowserView.EDITOR_ID).openURL(link.toURL());
        } catch (PartInitException e) {
          Activator.getDefault().getLog().log(e.getStatus());
        } catch (MalformedURLException e) {
          Activator.getDefault().getLog().log(Activator.getDefault().createErrorStatus(e.getMessage(), e));
        }
View Full Code Here

Examples of org.eclipse.ui.browser.IWorkbenchBrowserSupport

    List< ? > selection = fSelection.toList();
    for (Object object : selection) {
      if (object instanceof INews) {
        INews news = (INews) object;
        if (news.getLink() != null) {
          IWorkbenchBrowserSupport browser = PlatformUI.getWorkbench().getBrowserSupport();
          try {
            browser.createBrowser(WebBrowserView.EDITOR_ID).openURL(news.getLink().toURL());
          } catch (PartInitException e) {
            Activator.getDefault().getLog().log(e.getStatus());
          } catch (MalformedURLException e) {
            Activator.getDefault().getLog().log(Activator.getDefault().createErrorStatus(e.getMessage(), e));
          }
View Full Code Here

Examples of org.eclipse.ui.browser.IWorkbenchBrowserSupport

      /* String */
      else if (object instanceof String)
        link = new URI(URIUtils.fastEncode((String) object));

      if (link != null && link.isAbsolute()) {
        IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
        try {
          IWebBrowser browser = browserSupport.createBrowser(WebBrowserView.EDITOR_ID);

          /* Our own Web Browser Support is used */
          if (browser instanceof EmbeddedWebBrowser) {
            if (fContext != null)
              ((EmbeddedWebBrowser) browser).setContext(fContext);
View Full Code Here

Examples of org.eclipse.ui.browser.IWorkbenchBrowserSupport

        });
    }

    private static void handleUrlClick(final String urlStr) {
        try {
            IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
            IWebBrowser externalBrowser = support.getExternalBrowser();
            if(externalBrowser != null){
                externalBrowser.openURL(new URL(urlStr));
            } else {
                IWebBrowser browser = support.createBrowser(urlStr);
                if(browser != null){
                    browser.openURL(new URL(urlStr));
                }
            }
        } catch (PartInitException e) {
View Full Code Here

Examples of org.eclipse.ui.browser.IWorkbenchBrowserSupport

        });

        txtDescription.getFormText().addHyperlinkListener(new HyperlinkAdapter() {
            @Override
            public void linkActivated(HyperlinkEvent event) {
                IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
                try {
                    IWebBrowser externalBrowser = browserSupport.getExternalBrowser();
                    externalBrowser.openURL(new URL((String) event.getHref()));
                } catch (PartInitException e) {
                    logger.logError("Error opening external browser.", e);
                } catch (MalformedURLException e) {
                    // Ignore
View Full Code Here

Examples of org.eclipse.ui.browser.IWorkbenchBrowserSupport

    private IWorkbenchWindow window;

    public void run(IAction action) {
        try {
            IWorkbenchBrowserSupport browserSupport = window.getWorkbench().getBrowserSupport();
            IWebBrowser browser = browserSupport.createBrowser(6, null, null, null);
            browser.openURL(null);
        } catch (Exception e) {
            logger.logError("Error opening browser", e);
        }
    }
View Full Code Here

Examples of org.eclipse.ui.browser.IWorkbenchBrowserSupport

      if (location != null) {
        url = new URL(location);
      }
      if (browserChoice == WebBrowserPreference.EXTERNAL) {
        try {
          IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
          support.getExternalBrowser().openURL(url);
        }
        catch (Exception e) {
        }
      }
      else {
View Full Code Here

Examples of org.eclipse.ui.browser.IWorkbenchBrowserSupport

            @Override
            public void run() {
                final URL helpSystemUrl = PlatformUI.getWorkbench().getHelpSystem()
                        .resolve(url.toExternalForm(), true);
                try {
                    final IWorkbenchBrowserSupport browserSupport = PlatformUI
                            .getWorkbench().getBrowserSupport();
                    IWebBrowser browser;
                    if (useExternalBrowser) {
                        browser = browserSupport.getExternalBrowser();
                    } else {
                        browser = browserSupport.createBrowser(null);
                    }
                    browser.openURL(helpSystemUrl);
                } catch (final PartInitException ex) {
                    // XXX: show dialog?
                    ErlLogger.error(ex);
View Full Code Here

Examples of org.eclipse.ui.browser.IWorkbenchBrowserSupport

    private void openInBrowser(final IFile file) {
        if (file == null) {
            return;
        }
        final IWorkbench wbench = PlatformUI.getWorkbench();
        final IWorkbenchBrowserSupport browserSupport = wbench.getBrowserSupport();
        try {
            file.refreshLocal(IResource.DEPTH_ZERO, null);
        } catch (final CoreException e1) {
        }
        if (file.exists() && file.isAccessible()) {
            try {
                final int style = IWorkbenchBrowserSupport.NAVIGATION_BAR
                        | IWorkbenchBrowserSupport.AS_EDITOR;
                final String name = file.getName();
                final String browserId = getName() + "_" + name;
                IWebBrowser browser;
                browser = browserSupport.createBrowser(style, browserId, name, null);
                try {
                    browser.openURL(file.getRawLocationURI().toURL());
                } catch (final MalformedURLException e) {
                    // should not happen
                    ErlLogger.error(e);
View Full Code Here

Examples of org.eclipse.ui.browser.IWorkbenchBrowserSupport

        //添加鼠标点击事件
        link.addSelectionListener(new SelectionAdapter(){
          public void widgetSelected(SelectionEvent event){
            //鼠标点击链接后的动作...
            try {
                IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
                support.getExternalBrowser().openURL(new URL(url));
            } catch (Exception e) {
            }
          }
        });
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.