/** * Reads a target definition file from the tests/targets/target-files location with the given * name. Note that ".target" will be appended. * * @param name * @return target definition * @throws Exception */ protected ITargetDefinition readOldTarget(String name) throws Exception { URL url = MacroPlugin.getBundleContext() .getBundle() .getEntry("/tests/targets/target-files/" + name + ".target"); File file = new File(FileLocator.toFileURL(url).getFile()); ITargetDefinition target = getNewTarget(); FileInputStream stream = new FileInputStream(file); TargetDefinitionPersistenceHelper.initFromXML(target, stream); stream.close(); return target; }
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; }