コード例 #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
 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()]);
 }