Package runjettyrun.utils

Source Code of runjettyrun.utils.BrowserUtil

package runjettyrun.utils;

import java.net.URL;

import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.browser.IWebBrowser;
import org.eclipse.ui.browser.IWorkbenchBrowserSupport;

public class BrowserUtil {
  public static IWebBrowser openSystemBrowser(String browserid, String url,boolean embed) {
    try {
      IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
      IWebBrowser browser = null;
      if(embed){
        browser = browserSupport.createBrowser(browserid); //$NON-NLS-1$
      }else{
        browser = browserSupport.getExternalBrowser();
      }
      browser.openURL(new URL(url));
      return browser;
    } catch (Exception e) {
      return null;
    }
  }
}
TOP

Related Classes of runjettyrun.utils.BrowserUtil

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.