示例#1
0
  public ILaunchConfiguration getSelectedLaunchConfiguration() {
    if (!fLaunchConfigButton.getSelection()) return null;

    String configName = fLaunchConfigCombo.getText();
    try {
      ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
      ILaunchConfigurationType type =
          manager.getLaunchConfigurationType(EclipseLaunchShortcut.CONFIGURATION_TYPE);
      ILaunchConfigurationType type2 =
          manager.getLaunchConfigurationType(IPDELauncherConstants.OSGI_CONFIGURATION_TYPE);
      ILaunchConfiguration[] configs = manager.getLaunchConfigurations(type);
      ILaunchConfiguration[] configs2 = manager.getLaunchConfigurations(type2);
      ILaunchConfiguration[] configurations =
          new ILaunchConfiguration[configs.length + configs2.length];
      System.arraycopy(configs, 0, configurations, 0, configs.length);
      System.arraycopy(configs2, 0, configurations, configs.length, configs2.length);
      for (int i = 0; i < configurations.length; i++) {
        if (configurations[i].getName().equals(configName)
            && !DebugUITools.isPrivate(configurations[i])) return configurations[i];
      }
    } catch (CoreException e) {
      PDEPlugin.logException(e);
    }
    return null;
  }
示例#2
0
  protected String computeName() {
    String label = fLabel;

    ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
    if (config != null && !DebugUITools.isPrivate(config)) {
      String type = null;
      try {
        type = config.getType().getName();
      } catch (CoreException e) {
      }
      StringBuilder buffer = new StringBuilder();
      buffer.append(config.getName());
      if (type != null) {
        buffer.append(" ["); // $NON-NLS-1$
        buffer.append(type);
        buffer.append("] "); // $NON-NLS-1$
      }
      buffer.append(label);
      label = buffer.toString();
    }

    if (fLaunch.isTerminated()) {
      return ConsoleMessages.ConsoleMessages_console_terminated + label;
    }

    return label;
  }
示例#3
0
 private String[] getLaunchConfigurations() {
   ArrayList list = new ArrayList();
   try {
     ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
     ILaunchConfigurationType type =
         manager.getLaunchConfigurationType(EclipseLaunchShortcut.CONFIGURATION_TYPE);
     ILaunchConfiguration[] configs = manager.getLaunchConfigurations(type);
     for (int i = 0; i < configs.length; i++) {
       if (!DebugUITools.isPrivate(configs[i])) list.add(configs[i].getName());
     }
     // add osgi launch configs to the list
     type = manager.getLaunchConfigurationType(IPDELauncherConstants.OSGI_CONFIGURATION_TYPE);
     configs = manager.getLaunchConfigurations(type);
     for (int i = 0; i < configs.length; i++) {
       if (!DebugUITools.isPrivate(configs[i])) list.add(configs[i].getName());
     }
   } catch (CoreException e) {
     PDEPlugin.logException(e);
   }
   return (String[]) list.toArray(new String[list.size()]);
 }
  /**
   * 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;
  }