Exemplo n.º 1
0
 /**
  * Opens the internal HelpView and address it to the given doc url.
  *
  * @param url
  */
 public static void openHelp(String url) {
   IWorkbenchPage page = getActivePage();
   if (page != null) {
     try {
       IViewPart part = page.showView(HELP_VIEW_ID);
       if (part != null) {
         HelpView view = (HelpView) part;
         view.showHelp(url);
       }
     } catch (PartInitException e) {
       IdeLog.logError(UIPlugin.getDefault(), e);
     }
   } else {
     IdeLog.logWarning(
         UIPlugin.getDefault(),
         "Could not open the help view. Active page was null."); //$NON-NLS-1$
   }
 }
Exemplo n.º 2
0
 /**
  * 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;
 }
Exemplo n.º 3
0
  /**
   * 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;
  }