public OpenInBrowserAction(
     BootDashModel model, MultiSelection<BootDashElement> selection, UserInteractions ui) {
   super(selection, ui);
   this.model = model;
   this.setText("Open Web Browser");
   this.setToolTipText("Open a Web Browser on the default URL");
   this.setImageDescriptor(BootDashActivator.getImageDescriptor("icons/open_browser.gif"));
   this.setDisabledImageDescriptor(
       BootDashActivator.getImageDescriptor("icons/open_browser_disabled.gif"));
   if (model != null) {
     model.addElementStateListener(
         listener =
             new ElementStateListener() {
               public void stateChanged(BootDashElement e) {
                 Display.getDefault()
                     .asyncExec(
                         new Runnable() {
                           public void run() {
                             updateEnablement();
                           }
                         });
               }
             });
   }
 }
 @Override
 protected List<IPageSection> createSections() {
   SshDebugLaunchUIModel model =
       new SshDebugLaunchUIModel(BootDashActivator.getDefault().getModel());
   return Arrays.asList(
       new IPageSection[] {
         SelectProjectLaunchTabSection.create(this, model.project),
         SelectRunTargetLaunchTabSection.create(this, model.cfTarget),
         StringFieldLaunchTabSection.create(this, model.appName)
       });
 }
 public List<RequestMapping> getRequestMappings() {
   try {
     String json = rest.getForObject(target + "/mappings", String.class);
     if (json != null) {
       // System.out.println("Got some json:\n"+json);
       return parse(json);
     }
   } catch (Exception e) {
     BootDashActivator.log(e);
   }
   return null;
 }
 /**
  * Returns the raw string found in the requestmapping info. This is a 'toString' value of
  * java.lang.reflect.Method object.
  */
 public String getMethodString() {
   try {
     if (beanInfo != null) {
       if (beanInfo.has("method")) {
         return beanInfo.getString("method");
       }
     }
   } catch (Exception e) {
     BootDashActivator.log(e);
   }
   return null;
 }
  @Override
  protected synchronized void doCloudOp(IProgressMonitor monitor)
      throws Exception, OperationCanceledException {
    model.setState(RefreshState.LOADING);
    try {

      // 1. Fetch basic list of applications. Should be the "faster" of
      // the
      // two refresh operations

      List<CloudApplication> apps = requests.getApplicationsWithBasicInfo();

      Map<CloudAppInstances, IProject> updatedApplications =
          new HashMap<CloudAppInstances, IProject>();
      if (apps != null) {

        Map<String, String> existingProjectToAppMappings =
            this.model.getProjectToAppMappingStore().getMapping();

        for (CloudApplication app : apps) {

          String projectName = existingProjectToAppMappings.get(app.getName());
          IProject project = null;
          if (projectName != null) {
            project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
            if (project == null || !project.isAccessible()) {
              project = null;
            }
          }

          // No stats available at this stage. Just set stats to null
          // for now.
          updatedApplications.put(new CloudAppInstances(app, null), project);
        }
      }

      this.model.updateElements(updatedApplications);

      // 2. Launch the slower app stats/instances refresh operation.
      this.model.getOperationsExecution().runOpAsynch(new AppInstancesRefreshOperation(this.model));
      this.model.getOperationsExecution().runOpAsynch(new HealthCheckRefreshOperation(this.model));
      model.setState(RefreshState.READY);
    } catch (Exception e) {
      model.setState(RefreshState.error(e));
      BootDashActivator.log(e);
    }
  }
  private void fillContextMenu(IMenuManager manager) {
    for (RunStateAction a : actions.getRunStateActions()) {
      addVisible(manager, a);
    }
    addVisible(manager, actions.getOpenBrowserAction());
    addVisible(manager, actions.getOpenConsoleAction());
    addVisible(manager, actions.getOpenInPackageExplorerAction());
    addVisible(manager, actions.getShowPropertiesViewAction());

    manager.add(new Separator());

    addVisible(manager, actions.getOpenConfigAction());
    addVisible(manager, actions.getDuplicateConfigAction());
    addVisible(manager, actions.getDeleteConfigsAction());

    manager.add(new Separator());

    addVisible(manager, actions.getExposeRunAppAction());
    addVisible(manager, actions.getExposeDebugAppAction());
    addSubmenu(
        manager,
        "Deploy and Run On...",
        BootDashActivator.getImageDescriptor("icons/run-on-cloud.png"),
        actions.getRunOnTargetActions());
    addSubmenu(
        manager,
        "Deploy and Debug On...",
        BootDashActivator.getImageDescriptor("icons/debug-on-cloud.png"),
        actions.getDebugOnTargetActions());

    manager.add(new Separator());

    for (AddRunTargetAction a : actions.getAddRunTargetActions()) {
      addVisible(manager, a);
    }
    manager.add(new Separator());

    IAction removeTargetAction = actions.getRemoveRunTargetAction();
    if (removeTargetAction != null) {
      addVisible(manager, removeTargetAction);
    }

    IAction refreshAction = actions.getRefreshRunTargetAction();
    if (refreshAction != null) {
      addVisible(manager, refreshAction);
    }

    IAction restartOnlyAction = actions.getRestartOnlyApplicationAction();
    if (restartOnlyAction != null) {
      addVisible(manager, restartOnlyAction);
    }

    IAction selectManifestAction = actions.getSelectManifestAction();
    if (selectManifestAction != null) {
      addVisible(manager, selectManifestAction);
    }

    IAction restartWithRemoteDevClientAction = actions.getRestartWithRemoteDevClientAction();
    if (restartWithRemoteDevClientAction != null) {
      addVisible(manager, actions.getRestartWithRemoteDevClientAction());
    }

    IAction deleteAppsAction = actions.getDeleteAppsAction();
    if (deleteAppsAction != null) {
      addVisible(manager, deleteAppsAction);
    }

    IAction updatePasswordAction = actions.getUpdatePasswordAction();
    if (updatePasswordAction != null) {
      addVisible(manager, updatePasswordAction);
    }

    IAction openCloudAdminConsoleAction = actions.getOpenCloudAdminConsoleAction();
    if (openCloudAdminConsoleAction != null) {
      addVisible(manager, openCloudAdminConsoleAction);
    }

    IAction toggleCloudConnectAction = actions.getToggleTargetConnectionAction();
    if (toggleCloudConnectAction != null) {
      addVisible(manager, toggleCloudConnectAction);
    }

    IAction reconnectConsole = actions.getReconnectCloudConsole();
    if (reconnectConsole != null) {
      addVisible(manager, reconnectConsole);
    }

    //		manager.add
    //		addVisible(manager, new Separator());
    //		addVisible(manager, refreshAction);
    //		addVisible(manager, action2);
    // Other plug-ins can contribute there actions here
    //		manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
  }