本文整理汇总了Java中org.netbeans.spi.project.support.ant.PropertyUtils.resolveFile方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyUtils.resolveFile方法的具体用法?Java PropertyUtils.resolveFile怎么用?Java PropertyUtils.resolveFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.spi.project.support.ant.PropertyUtils
的用法示例。
在下文中一共展示了PropertyUtils.resolveFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isValidPanel
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
@Messages({
"WARN_MakeSharable.absolutePath=<html>Please make sure that the absolute path in the Libraries Folder field is valid for all users.<html>",
"WARN_makeSharable.relativePath=<html>Please make sure that the relative path in the Libraries Folder field is valid for all users.<html>"
})
boolean isValidPanel() {
String location = getLibraryLocation();
boolean wrong = false;
if (new File(location).isAbsolute()) {
settings.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, WARN_MakeSharable_absolutePath());
wrong = true;
} else {
File projectLoc = FileUtil.toFile(helper.getProjectDirectory());
File libLoc = PropertyUtils.resolveFile(projectLoc, location);
if (!CollocationQuery.areCollocated(projectLoc, libLoc)) {
settings.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, WARN_makeSharable_relativePath());
wrong = true;
}
}
if (!wrong) {
settings.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, null);
}
return true;
}
示例2: resolveNbDestDir
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
private static File resolveNbDestDir(File root, File customNbDestDir, PropertyEvaluator eval) throws IOException {
File nbdestdir;
if (customNbDestDir == null) {
String nbdestdirS = eval.getProperty(NETBEANS_DEST_DIR);
if (nbdestdirS == null) {
throw new IOException("No netbeans.dest.dir defined in " + root); // NOI18N
}
nbdestdir = PropertyUtils.resolveFile(root, nbdestdirS);
} else {
nbdestdir = customNbDestDir;
}
if (! nbdestdir.exists()) {
LOG.log(Level.INFO, "Project in " + root // NOI18N
+ " is missing its platform '" + eval.getProperty("nbplatform.active") + "', switching to default platform"); // NOI18N
NbPlatform p2 = NbPlatform.getDefaultPlatform();
if (p2 != null)
nbdestdir = p2.getDestDir();
}
return nbdestdir;
}
示例3: rememberLibraryLocation
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
private void rememberLibraryLocation() {
libraryWithinProject = false;
absolutesRelPath = null;
libraryPath = helper.getAntProjectHelper().getLibrariesLocation();
if (libraryPath != null) {
File prjRoot = FileUtil.toFile(project.getProjectDirectory());
libraryFile = PropertyUtils.resolveFile(prjRoot, libraryPath);
if (FileOwnerQuery.getOwner(Utilities.toURI(libraryFile)) == project &&
libraryFile.getAbsolutePath().startsWith(prjRoot.getAbsolutePath())) {
//do not update the relative path if within the project..
libraryWithinProject = true;
FileObject fo = FileUtil.toFileObject(libraryFile);
if (new File(libraryPath).isAbsolute() && fo != null) {
// if absolte path within project, it will get moved/copied..
absolutesRelPath = FileUtil.getRelativePath(project.getProjectDirectory(), fo);
}
}
}
}
示例4: browseForLibraryLocation
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
/**
* File chooser implementation for browsing for shared library location.
* @param current
* @param comp
* @param projectLocation
* @return relative or absolute path to project libraries folder.
*/
@Messages({
"LBL_Browse_Libraries_Title=Select Libraries Folder",
"ASCD_Browse_Libraries_Title=Browse for the Folder with Library Definitions."
})
public static String browseForLibraryLocation(String current, Component comp, File projectLocation) {
File lib = PropertyUtils.resolveFile(projectLocation, current);
if (!lib.exists()) {
lib = lib.getParentFile();
}
lib = FileUtil.normalizeFile(lib);
FileChooser chooser = new FileChooser(projectLocation, null);
// for now variable based paths are disabled for reference to libraries folder
// can be revisit if it is needed
chooser.setCurrentDirectory(lib);
chooser.setFileSelectionMode( JFileChooser.DIRECTORIES_ONLY );
chooser.setDialogTitle(LBL_Browse_Libraries_Title());
chooser.getAccessibleContext().setAccessibleDescription(ASCD_Browse_Libraries_Title());
if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(comp)) {
String[] files;
try {
files = chooser.getSelectedPaths();
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
return null;
}
if (files.length == 1) {
String currentLibrariesLocation = files[0];
return currentLibrariesLocation;
}
}
return null;
}
示例5: evaluateClusterPathEntry
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
/**
* Resolves single cluster path entry with respect to project root and ${nbplatform.active} root.
* @param rawEntry Single cluster.path entry as stored in platform.properties
* @param root Project root
* @param eval Project property evaluator
* @param nbPlatformRoot Platform root used to replace ${nbplatform.active} references in the entry
* @return Absolute path to entry
*/
public static File evaluateClusterPathEntry(String rawEntry, File root, PropertyEvaluator eval, File nbPlatformRoot) {
// When cluster does not exist, it is either bare name or one with different number
final Pattern pat = Pattern.compile("(?:.*[\\\\/])?([^/\\\\]*?)([0-9.]+)?[/\\\\]?$");
final String nbDirProp = "${" + SuiteProperties.ACTIVE_NB_PLATFORM_DIR_PROPERTY + "}";
if (rawEntry.startsWith(nbDirProp)) {
rawEntry = nbPlatformRoot.getAbsolutePath()
+ rawEntry.substring(nbDirProp.length());
}
File path = PropertyUtils.resolveFile(root, eval.evaluate(rawEntry));
if (! path.exists()) {
// search for corresponding numbered cluster
final Matcher cm = pat.matcher(path.getAbsolutePath());
if (cm.matches()) {
File parent = path.getParentFile();
if (parent != null) {
File[] alternate = parent.listFiles(new FilenameFilter() {
public @Override boolean accept(File dir, String name) {
Matcher am = pat.matcher(name);
return am.matches() && cm.group(1).equalsIgnoreCase(am.group(1));
}
});
if (alternate == null) {
// not found, just return what we have
return path;
}
if (alternate.length > 0 && alternate[0].isDirectory()) {
return alternate[0];
}
}
}
}
return path;
}
示例6: findModulesInSuite
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
private static File[] findModulesInSuite(File root, PropertyEvaluator eval) throws IOException {
String modulesS = eval.getProperty("modules"); // NOI18N
if (modulesS == null) {
modulesS = ""; // NOI18N
}
String[] modulesA = PropertyUtils.tokenizePath(modulesS);
File[] modules = new File[modulesA.length];
for (int i = 0; i < modulesA.length; i++) {
modules[i] = PropertyUtils.resolveFile(root, modulesA[i]);
}
return modules;
}
示例7: check
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
private void check(String srcS, File jarF) throws Exception {
File srcF = PropertyUtils.resolveFile(nbRootFile(), srcS);
FileObject src = FileUtil.toFileObject(srcF);
assertNotNull("have " + srcF, src);
URL u = FileUtil.getArchiveRoot(Utilities.toURI(jarF).toURL());
assertEquals("right results for " + u,
Collections.singletonList(src),
trimGenerated(Arrays.asList(SourceForBinaryQuery.findSourceRoots(u).getRoots())));
}
示例8: RelativePath
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
private RelativePath(@NonNull String filePath, @NonNull File base) {
Parameters.notNull("filePath", filePath);
Parameters.notNull("base", base);
this.filePath = filePath;
this.base = base;
this.resolvedFile = PropertyUtils.resolveFile(base, filePath);
}
示例9: store
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
public void store() throws IOException {
Preferences prefs = prefs(suiteProject);
prefs.putBoolean(GENERATE_FOR_WINDOWS, windowsModel.isSelected());
prefs.putBoolean(GENERATE_FOR_LINUX, linuxModel.isSelected());
prefs.putBoolean(GENERATE_FOR_SOLARIS, solarisModel.isSelected());
prefs.putBoolean(GENERATE_FOR_MAC, macModel.isSelected());
prefs.putBoolean(USE_PACK200_COMPRESSION, pack200Model.isSelected());
String licenseName = (String) licenseModel.getSelectedItem();
if (licenseName != null) {
int index = licenseModel.getNames().indexOf(licenseName);
if (index != -1) {
String type = licenseModel.getTypes().get(index);
if (type.equals(LICENSE_TYPE_FILE)) {
File suiteLocation = FileUtil.toFile(suiteProject.getProjectDirectory());
File f = PropertyUtils.resolveFile(suiteLocation, licenseName);
String rel = PropertyUtils.relativizeFile(suiteLocation, f);
if (rel != null) {
prefs.put(LICENSE_FILE, rel);
} else {
prefs.put(LICENSE_FILE, f.getAbsolutePath());
}
prefs.remove(LICENSE_TYPE);
} else {
prefs.put(LICENSE_TYPE, type);
prefs.remove(LICENSE_FILE);
}
}
}
}
示例10: getLibrariesLocation
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
public static File getLibrariesLocation(AuxiliaryConfiguration aux, File projectFolder) {
String text = getLibrariesLocationText(aux);
if (text != null) {
return PropertyUtils.resolveFile(projectFolder, text);
}
return null;
}
示例11: resolveFile
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
static File resolveFile(File directory, String subpath) {
subpath = subpath.trim();
if (subpath.startsWith("/")) { // NOI18N
subpath = subpath.substring(1);
}
return PropertyUtils.resolveFile(directory, subpath);
}
示例12: valid
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
@Override
boolean valid(WizardDescriptor settings) {
if (cbSharable.isSelected()) {
String location = txtLibFolder.getText();
if (projectLocation != null) {
if (new File(location).isAbsolute()) {
settings.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE,
NbBundle.getMessage(PanelOptionsVisual.class, "WARN_PanelOptionsVisual.absolutePath"));
} else {
File projectLoc = FileUtil.normalizeFile(new File(projectLocation));
File libLoc = PropertyUtils.resolveFile(projectLoc, location);
if (!CollocationQuery.areCollocated(projectLoc, libLoc)) {
settings.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE,
NbBundle.getMessage(PanelOptionsVisual.class, "WARN_PanelOptionsVisual.relativePath"));
}
}
}
}
if (mainClassTextField.isVisible () && mainClassTextField.isEnabled ()) {
if (!valid) {
settings.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE,
NbBundle.getMessage(PanelOptionsVisual.class,"ERROR_IllegalMainClassName")); //NOI18N
}
return this.valid;
}
else {
return true;
}
}
示例13: EclipseProjectReference
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
public EclipseProjectReference(Project project, String eclipseProjectLocation, String eclipseWorkspaceLocation, long timestamp, String key) {
this.eclipseProjectLocation = PropertyUtils.resolveFile(FileUtil.toFile(project.getProjectDirectory()), eclipseProjectLocation);
if (eclipseWorkspaceLocation != null) {
this.eclipseWorkspaceLocation = PropertyUtils.resolveFile(FileUtil.toFile(project.getProjectDirectory()), eclipseWorkspaceLocation);
} else {
this.eclipseWorkspaceLocation = null;
}
this.timestamp = timestamp;
this.key = key;
this.project = project;
}
示例14: valid
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
@Override
boolean valid(WizardDescriptor settings) {
if (!JavaFXPlatformUtils.isJavaFXEnabled(getSelectedPlatform())) {
setBottomPanelAreaVisible(false);
settings.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE,
NbBundle.getMessage(PanelOptionsVisual.class, "WARN_PanelOptionsVisual.notFXPlatform")); // NOI18N
return false;
}
setBottomPanelAreaVisible(true);
if (cbSharable.isSelected()) {
String location = txtLibFolder.getText();
if (projectLocation != null) {
if (new File(location).isAbsolute()) {
settings.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE,
NbBundle.getMessage(PanelOptionsVisual.class, "WARN_PanelOptionsVisual.absolutePath")); // NOI18N
} else {
File projectLoc = FileUtil.normalizeFile(new File(projectLocation));
File libLoc = PropertyUtils.resolveFile(projectLoc, location);
if (!CollocationQuery.areCollocated(projectLoc.toURI(), libLoc.toURI())) {
settings.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE,
NbBundle.getMessage(PanelOptionsVisual.class, "WARN_PanelOptionsVisual.relativePath")); // NOI18N
}
}
}
}
if (mainClassTextField.isVisible() && mainClassTextField.isEnabled()) {
if (!isMainClassValid) {
settings.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE,
NbBundle.getMessage(PanelOptionsVisual.class, "ERROR_IllegalMainClassName")); // NOI18N
return false;
}
}
if (txtPreloaderProject.isVisible() && txtPreloaderProject.isEnabled()) {
if (!isPreloaderNameValid) {
settings.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE,
NbBundle.getMessage(PanelOptionsVisual.class, "ERROR_IllegalPreloaderProjectName")); // NOI18N
return false;
}
}
if (fxmlTextField.isVisible()) {
if (!isFXMLNameValid) {
settings.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE,
NbBundle.getMessage(PanelOptionsVisual.class, "ERROR_IllegalFXMLName")); // NOI18N
return false;
}
}
return true;
}
示例15: getAbsoluteClusterPath
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
private File getAbsoluteClusterPath() {
String maybeRelPath = clusterDirText.getText();
return PropertyUtils.resolveFile(prjDir, maybeRelPath);
}