/** * 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 void checkPluginPropertiesConsistency(Map map, File configDir) { File runtimeDir = new File(configDir, IPDEBuildConstants.BUNDLE_CORE_RUNTIME); if (runtimeDir.exists() && runtimeDir.isDirectory()) { long timestamp = runtimeDir.lastModified(); Iterator iter = map.values().iterator(); while (iter.hasNext()) { if (hasChanged((IMonitorModelBase) iter.next(), timestamp)) { CoreUtility.deleteContent(runtimeDir); break; } } } }
private static synchronized String getSymbolicName(String path) { if (fCachedLocations == null) fCachedLocations = new HashMap(); File file = new File(path); if (file.exists() && !fCachedLocations.containsKey(path)) { try { Dictionary dictionary = MinimalState.loadManifest(file); String value = (String) dictionary.get(Constants.BUNDLE_SYMBOLICNAME); if (value != null) { ManifestElement[] elements = ManifestElement.parseHeader(Constants.BUNDLE_SYMBOLICNAME, value); String id = elements.length > 0 ? elements[0].getValue() : null; if (id != null) fCachedLocations.put(path, elements[0].getValue()); } } catch (IOException e) { } catch (BundleException e) { } } return (String) fCachedLocations.get(path); }
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; }