ISourceContainer[] getSourceContainers(String location, String id) throws CoreException {

    ISourceContainer[] containers = (ISourceContainer[]) fSourceContainerMap.get(location);
    if (containers != null) {
      return containers;
    }

    ArrayList result = new ArrayList();
    ModelEntry entry = MonitorRegistry.findEntry(id);

    boolean match = false;

    IMonitorModelBase[] models = entry.getWorkspaceModels();
    for (int i = 0; i < models.length; i++) {
      if (isPerfectMatch(models[i], new Path(location))) {
        IResource resource = models[i].getUnderlyingResource();
        // if the plug-in matches a workspace model,
        // add the project and any libraries not coming via a container
        // to the list of source containers, in that order
        if (resource != null) {
          addProjectSourceContainers(resource.getProject(), result);
        }
        match = true;
        break;
      }
    }

    if (!match) {
      File file = new File(location);
      if (file.isFile()) {
        // in case of linked plug-in projects that map to an external JARd plug-in,
        // use source container that maps to the library in the linked project.
        ISourceContainer container = getArchiveSourceContainer(location);
        if (container != null) {
          containers = new ISourceContainer[] {container};
          fSourceContainerMap.put(location, containers);
          return containers;
        }
      }

      models = entry.getExternalModels();
      for (int i = 0; i < models.length; i++) {
        if (isPerfectMatch(models[i], new Path(location))) {
          // try all source zips found in the source code locations
          IClasspathEntry[] entries = MDEClasspathContainer.getExternalEntries(models[i]);
          for (int j = 0; j < entries.length; j++) {
            IRuntimeClasspathEntry rte = convertClasspathEntry(entries[j]);
            if (rte != null) result.add(rte);
          }
          break;
        }
      }
    }

    IRuntimeClasspathEntry[] entries =
        (IRuntimeClasspathEntry[]) result.toArray(new IRuntimeClasspathEntry[result.size()]);
    containers = JavaRuntime.getSourceContainers(entries);
    fSourceContainerMap.put(location, containers);
    return containers;
  }
 public static String[] getFeaturePaths() {
   IFeatureModel[] models = MDECore.getDefault().getFeatureModelManager().getModels();
   ArrayList list = new ArrayList();
   for (int i = 0; i < models.length; i++) {
     String location = models[i].getInstallLocation();
     if (location != null)
       list.add(location + IPath.SEPARATOR + ICoreConstants.FEATURE_FILENAME_DESCRIPTOR);
   }
   return (String[]) list.toArray(new String[list.size()]);
 }
  /*
   * (non-Javadoc)
   * @see org.eclipse.pde.ui.launcher.AbstractPDELaunchConfiguration#getProgramArguments(org.eclipse.debug.core.ILaunchConfiguration)
   */
  public String[] getProgramArguments(ILaunchConfiguration configuration) throws CoreException {
    ArrayList programArgs = new ArrayList();

    programArgs.add("-dev"); // $NON-NLS-1$
    programArgs.add(
        ClasspathHelper.getDevEntriesProperties(
            getConfigDir(configuration).toString() + "/dev.properties",
            fAllBundles)); //$NON-NLS-1$

    saveConfigurationFile(configuration);
    programArgs.add("-configuration"); // $NON-NLS-1$
    programArgs.add(
        "file:"
            + new Path(getConfigDir(configuration).getPath())
                .addTrailingSeparator()
                .toString()); //$NON-NLS-1$

    String[] args = super.getProgramArguments(configuration);
    for (int i = 0; i < args.length; i++) {
      programArgs.add(args[i]);
    }
    return (String[]) programArgs.toArray(new String[programArgs.size()]);
  }
  public static Dictionary[] getPlatformProperties(String[] profiles, MinimalState state) {
    if (profiles == null || profiles.length == 0)
      return new Dictionary[] {getTargetEnvironment(state)};

    // add java profiles for those EE's that have a .profile file in the current system bundle
    ArrayList result = new ArrayList(profiles.length);
    for (int i = 0; i < profiles.length; i++) {
      IExecutionEnvironment environment =
          JavaRuntime.getExecutionEnvironmentsManager().getEnvironment(profiles[i]);
      if (environment != null) {
        Properties profileProps = environment.getProfileProperties();
        if (profileProps != null) {
          Dictionary props = TargetPlatformHelper.getTargetEnvironment(state);
          String systemPackages = profileProps.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES);
          if (systemPackages != null) props.put(Constants.FRAMEWORK_SYSTEMPACKAGES, systemPackages);
          String ee = profileProps.getProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT);
          if (ee != null) props.put(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, ee);
          result.add(props);
        }
      }
    }
    if (result.size() > 0) return (Dictionary[]) result.toArray(new Dictionary[result.size()]);
    return new Dictionary[] {TargetPlatformHelper.getTargetEnvironment(state)};
  }