/**
  * Reads and returns the VM arguments specified in the running platform's .ini file, or am empty
  * string if none.
  *
  * @return VM arguments specified in the running platform's .ini file
  */
 public static String getIniVMArgs() {
   File installDirectory = new File(Platform.getInstallLocation().getURL().getFile());
   if (Platform.getOS().equals(Platform.OS_MACOSX))
     installDirectory = new File(installDirectory, "Eclipse.app/Contents/MacOS"); // $NON-NLS-1$
   File eclipseIniFile = new File(installDirectory, "eclipse.ini"); // $NON-NLS-1$
   BufferedReader in = null;
   StringBuffer result = new StringBuffer();
   if (eclipseIniFile.exists()) {
     try {
       in = new BufferedReader(new FileReader(eclipseIniFile));
       String str;
       boolean vmargs = false;
       while ((str = in.readLine()) != null) {
         if (vmargs) {
           if (result.length() > 0) result.append(" "); // $NON-NLS-1$
           result.append(str);
         }
         // start concat'ng if we have vmargs
         if (vmargs == false && str.equals("-vmargs")) // $NON-NLS-1$
         vmargs = true;
       }
     } catch (IOException e) {
       MDECore.log(e);
     } finally {
       if (in != null)
         try {
           in.close();
         } catch (IOException e) {
           MDECore.log(e);
         }
     }
   }
   return result.toString();
 }
 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()]);
 }
 public static boolean matchesCurrentEnvironment(IMonitorModelBase model) {
   BundleContext context = MDECore.getDefault().getBundleContext();
   Dictionary environment = getTargetEnvironment();
   BundleDescription bundle = model.getBundleDescription();
   String filterSpec = bundle != null ? bundle.getPlatformFilter() : null;
   try {
     return filterSpec == null || context.createFilter(filterSpec).match(environment);
   } catch (InvalidSyntaxException e) {
     return false;
   }
 }
 public static Properties getConfigIniProperties() {
   File iniFile =
       new File(TargetPlatform.getLocation(), "configuration/config.ini"); // $NON-NLS-1$
   if (!iniFile.exists()) return null;
   Properties pini = new Properties();
   FileInputStream fis = null;
   try {
     fis = new FileInputStream(iniFile);
     pini.load(fis);
     fis.close();
     return pini;
   } catch (IOException e) {
     MDECore.logException(e);
   } finally {
     try {
       if (fis != null) fis.close();
     } catch (IOException e) {
       MDECore.logException(e);
     }
   }
   return null;
 }
 public static TreeSet getProductNameSet() {
   TreeSet result = new TreeSet();
   IExtension[] extensions =
       MDECore.getDefault()
           .getExtensionsRegistry()
           .findExtensions("org.eclipse.core.runtime.products", true); // $NON-NLS-1$
   for (int i = 0; i < extensions.length; i++) {
     IConfigurationElement[] elements = extensions[i].getConfigurationElements();
     if (elements.length != 1) continue;
     if (!"product".equals(elements[0].getName())) // $NON-NLS-1$
     continue;
     String id = extensions[i].getUniqueIdentifier();
     if (id != null && id.trim().length() > 0) result.add(id);
   }
   return result;
 }
 public static Set getApplicationNameSet() {
   TreeSet result = new TreeSet();
   IExtension[] extensions =
       MDECore.getDefault()
           .getExtensionsRegistry()
           .findExtensions("org.eclipse.core.runtime.applications", true); // $NON-NLS-1$
   for (int i = 0; i < extensions.length; i++) {
     String id = extensions[i].getUniqueIdentifier();
     IConfigurationElement[] elements = extensions[i].getConfigurationElements();
     if (elements.length != 1) continue;
     String visiblity = elements[0].getAttribute("visible"); // $NON-NLS-1$
     boolean visible = visiblity == null ? true : Boolean.valueOf(visiblity).booleanValue();
     if (id != null && visible) {
       result.add(id);
     }
   }
   result.add("org.eclipse.ui.ide.workbench"); // $NON-NLS-1$
   return result;
 }
 public static MDEState getPDEState() {
   return MDECore.getDefault().getModelManager().getState();
 }