public URL[] getRoots() { String val = eval.getProperty(propName); if (val != null) { File f = helper.resolveFile(val); if (f != null) { try { return new URL[] {f.toURI().toURL()}; } catch (MalformedURLException e) { Exceptions.printStackTrace(e); } } } return new URL[0]; }
@CheckForNull private File resolveFile(String path) { if (path == null || path.isEmpty()) { return null; } return project.getHelper().resolveFile(path); }
@CheckForNull private File resolveFile(String path) { if (path == null || path.isEmpty()) { return null; } return project.getProjectHelper().resolveFile(path); }
private File resolveFile(String path) { if (path == null || path.isEmpty()) { return null; } return FileUtil.normalizeFile(project.getProjectHelper().resolveFile(path)); }
private List<PathResourceImplementation> getGeneratedSrcRoots(String buildDir, String[] paths) { List<PathResourceImplementation> ret = new ArrayList<PathResourceImplementation>(); File buidDirFile = projectHelper.resolveFile(buildDir); for (String path : paths) { File genAddOns = new File(buidDirFile, path); if (genAddOns.exists() && genAddOns.isDirectory()) { File[] subDirs = genAddOns.listFiles(); for (File subDir : subDirs) { try { URL url = subDir.toURI().toURL(); if (!subDir.exists()) { assert !url.toExternalForm().endsWith("/"); //NOI18N url = new URL(url.toExternalForm() + '/'); //NOI18N } ret.add(ClassPathSupport.createResource(url)); } catch (MalformedURLException ex) { Exceptions.printStackTrace(ex); } } } } return ret; }
private File getFile(String propname) { String prop = helper.getStandardPropertyEvaluator().getProperty(propname); if (prop != null) { return helper.resolveFile(prop); } return null; }
File getTestClassesDirectory() { String testClassesDir = evaluator().getProperty(ProjectProperties.BUILD_TEST_CLASSES_DIR); if (testClassesDir == null) { return null; } return helper.resolveFile(testClassesDir); }
File getTestClassesDirectory() { String testClassesDir = evaluator().getProperty(ProjectProperties.BUILD_TEST_CLASSES_DIR); if (testClassesDir == null) { return null; } return helper.resolveFile(testClassesDir); }
private File getFile(String propname) { String prop = helper.getStandardPropertyEvaluator().getProperty(propname); if (prop != null) { return helper.resolveFile(prop); } return null; }
File getTestClassesDirectory() { String testClassesDir = evaluator().getProperty(ProjectProperties.BUILD_TEST_CLASSES_DIR); if (testClassesDir == null) { return null; } return helper.resolveFile(testClassesDir); }
void loadIncludesExcludes(IncludeExcludeVisualizer v) { Set<File> roots = new HashSet<File>(); for (DefaultTableModel model : new DefaultTableModel[] {SOURCE_ROOTS_MODEL, TEST_ROOTS_MODEL}) { for (Object row : model.getDataVector()) { File d = (File) ((Vector) row).elementAt(0); if (d.isDirectory()) { roots.add(d); } } } try { String webDocRoot = WEB_DOCBASE_DIR_MODEL.getText(0, WEB_DOCBASE_DIR_MODEL.getLength()); File d = project.getAntProjectHelper().resolveFile(webDocRoot); if (d.isDirectory()) { roots.add(d); } } catch (BadLocationException ex) { Exceptions.printStackTrace(ex); } v.setRoots(roots.toArray(new File[roots.size()])); v.setIncludePattern(includes); v.setExcludePattern(excludes); }
private String createForeignFileReference(String filePath) { if (filePath == null) { // not set at all return null; } if (filePath.isEmpty()) { // empty value will be saved return ""; // NOI18N } File file = project.getProjectHelper().resolveFile(filePath); return project.getReferenceHelper().createForeignFileReference(file, null); }
private void updateReference(String value, String key, boolean main) { File absFile = ahelper.resolveFile(value); String newVal = relative ? PropertyUtils.relativizeFile(FileUtil.toFile(ahelper.getProjectDirectory()), absFile) : absFile.getAbsolutePath(); if (newVal == null) { //fallback newVal = absFile.getAbsolutePath(); } if (!newVal.equals(value)) { if (main) { refhelper.createForeignFileReferenceAsIs(newVal, key); } else { refhelper.createExtraForeignFileReferenceAsIs(newVal, key); } } } }
private File resolveFile(String propertyName) { String propValue = project.getEvaluator().getProperty(propertyName); if (propValue == null) { return null; } return project.getProjectHelper().resolveFile(propValue); }
public void saveLicenseFile() throws IOException { if (licenseContent != null) { assert licensePath != null; //path needs to exist once we have content? String evaluated = evaluator.evaluate(licensePath); assert evaluated != null; File file = antHelper.resolveFile(evaluated); FileObject fo; if (!file.exists()) { fo = FileUtil.createData(file); } else { fo = FileUtil.toFileObject(file); } OutputStream out = fo.getOutputStream(); try { FileUtil.copy(new ByteArrayInputStream(licenseContent.getBytes()), out); } finally { out.close(); } } }
public void saveLicenseFile() throws IOException { if (licenseContent != null) { assert licensePath != null; //path needs to exist once we have content? String evaluated = evaluator.evaluate(licensePath); assert evaluated != null; File file = antHelper.resolveFile(evaluated); FileObject fo; if (!file.exists()) { fo = FileUtil.createData(file); } else { fo = FileUtil.toFileObject(file); } OutputStream out = fo.getOutputStream(); try { FileUtil.copy(new ByteArrayInputStream(licenseContent.getBytes()), out); } finally { out.close(); } } }
public List<Item> itemsList(String... values) { List<Item> items = new ArrayList<>(values.length); for (String p : values) { Item item; if (isWellKnownPath(p)) { // some well know classpath item = Item.create(p); } else { File f = null; String eval = evaluator.evaluate(p); if (eval != null) { f = antProjectHelper.resolveFile(eval); } if (f == null || !f.exists()) { item = Item.createBroken(eval, p); } else { item = Item.create(eval, p); } } items.add(item); } return items; }
private File getFile(String propname) { String prop = helper.getAntProjectHelper().getStandardPropertyEvaluator().getProperty(propname); if (prop != null) { return helper.getAntProjectHelper().resolveFile(prop); } else { return null; } }
private FileObject getSharedLibraryFolderLocation() { String libLoc = helper.getLibrariesLocation(); if (libLoc != null) { String libLocEval = evaluator.evaluate(libLoc); File file = null; if (libLocEval != null) { file = helper.resolveFile(libLocEval); } FileObject libLocFO = FileUtil.toFileObject(file); if (libLocFO != null) { //#126366 this can happen when people checkout the project but not the libraries description //that is located outside the project FileObject libLocParent = libLocFO.getParent(); return libLocParent; } } return null; }
private static void copyRequiredLibraries(AntProjectHelper h, ReferenceHelper rh) throws IOException { if (!h.isSharableProject()) { return; } if (rh.getProjectLibraryManager().getLibrary("junit") == null // NOI18N && LibraryManager.getDefault().getLibrary("junit") != null) { // NOI18N rh.copyLibrary(LibraryManager.getDefault().getLibrary("junit")); // NOI18N } if (rh.getProjectLibraryManager().getLibrary("junit_4") == null // NOI18N && LibraryManager.getDefault().getLibrary("junit_4") != null) { // NOI18N rh.copyLibrary(LibraryManager.getDefault().getLibrary("junit_4")); // NOI18N } if (rh.getProjectLibraryManager().getLibrary("CopyLibs") == null // NOI18N && LibraryManager.getDefault().getLibrary("CopyLibs") != null) { // NOI18N rh.copyLibrary(LibraryManager.getDefault().getLibrary("CopyLibs")); // NOI18N } if (rh.getProjectLibraryManager().getLibrary("JavaFX2Runtime") == null // NOI18N && LibraryManager.getDefault().getLibrary("JavaFX2Runtime") != null) { // NOI18N File mainPropertiesFile = h.resolveFile(h.getLibrariesLocation()); referenceLibrary(LibraryManager.getDefault().getLibrary("JavaFX2Runtime"), mainPropertiesFile.toURI().toURL(), true); //NOI18N } }