Example #1
0
  public boolean isPVSRunning() {
    ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
    IProcess[] processes = manager.getProcesses();
    for (IProcess p : processes) {
      if (Activator.name.equals(p.getLabel())) {
        return !p.isTerminated();
      }
    }
    return false;
    // TODO: this should later be replaced by:
    // return mode != PVSMode.OFF;

  }
  /**
   * Computes and returns the current name of this console.
   *
   * @return a name for this console
   */
  protected String computeName() {
    String label = null;
    final IProcess process = getProcess();
    final ILaunchConfiguration config = process.getLaunch().getLaunchConfiguration();

    label = process.getAttribute(IProcess.ATTR_PROCESS_LABEL);
    if (label == null) {
      if (config == null) {
        label = process.getLabel();
      } else {
        // check if PRIVATE config
        if (DebugUITools.isPrivate(config)) {
          label = process.getLabel();
        } else {
          String type = null;
          try {
            type = config.getType().getName();
          } catch (final CoreException e) {
          }
          final StringBuffer buffer = new StringBuffer();
          buffer.append("Remote shell connection to: ");
          buffer.append(config.getName());
          if (type != null) {
            buffer.append(" ["); // $NON-NLS-1$
            buffer.append(type);
            buffer.append("] "); // $NON-NLS-1$
          }
          buffer.append(process.getLabel());
          label = buffer.toString();
        }
      }
    }

    if (process.isTerminated()) {
      return MessageFormat.format("<disconnected> {0}", (Object[]) new String[] {label});
    }
    return label;
  }