本文整理汇总了Java中org.netbeans.spi.project.support.ant.PropertyUtils.getGlobalProperties方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyUtils.getGlobalProperties方法的具体用法?Java PropertyUtils.getGlobalProperties怎么用?Java PropertyUtils.getGlobalProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.spi.project.support.ant.PropertyUtils
的用法示例。
在下文中一共展示了PropertyUtils.getGlobalProperties方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
protected @Override void setUp() throws Exception {
super.setUp();
clearWorkDir();
MockLookup.setLayersAndInstances(getClass().getClassLoader());
NbPlatform.reset();
user = new File(getWorkDir(), "user");
user.mkdirs();
System.setProperty("netbeans.user", user.getAbsolutePath());
install = new File(getWorkDir(), "install");
TestBase.makePlatform(install);
// Now set up build.properties accordingly:
InstalledFileLocatorImpl.registerDestDir(install);
EditableProperties ep = PropertyUtils.getGlobalProperties();
ep.put("nbplatform.default.netbeans.dest.dir", install.getAbsolutePath());
ep.put("nbplatform.default.harness.dir", "${nbplatform.default.netbeans.dest.dir}/harness");
PropertyUtils.putGlobalProperties(ep);
install2 = new File(getWorkDir(), "install2");
TestBase.makePlatform(install2);
NbPlatform.addPlatform("install2", install2, "install2");
}
示例2: testRestored
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
public void testRestored() throws Exception {
UpdateTask.getDefault().run();
EditableProperties ep = PropertyUtils.getGlobalProperties();
JavaPlatform platform = JavaPlatformManager.getDefault().getDefaultPlatform();
String ver = platform.getSpecification().getVersion().toString();
assertEquals("Default source level must be set up", ver, ep.getProperty("default.javac.source"));
assertEquals("Default source level must be set up", ver, ep.getProperty("default.javac.target"));
}
示例3: readVariables
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
public static Map<String, String> readVariables() {
Map<String, String> vs = new HashMap<String, String>();
EditableProperties ep = PropertyUtils.getGlobalProperties();
for (Map.Entry<String, String> entry : ep.entrySet()) {
if (entry.getKey().startsWith(VARIABLE_PREFIX)) {
vs.put(entry.getKey().substring(VARIABLE_PREFIX.length()), FileUtil.normalizeFile(new File(entry.getValue())).getAbsolutePath());
}
}
return vs;
}
示例4: prepareProject
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
private void prepareProject(
@NonNull final String platformName,
@NullAllowed final String sourceLevel,
@NullAllowed final String targetLevel,
@NullAllowed final String profile) throws IOException {
scratch = TestUtil.makeScratchDir(this);
projdir = scratch.createFolder("proj");
helper = ProjectGenerator.createProject(projdir, "test");
assertNotNull(helper);
prj = ProjectManager.getDefault().findProject(projdir);
assertNotNull(prj);
EditableProperties props = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
props.setProperty("javac.source", "${def}");
props.setProperty("javac.target",
targetLevel == null ?
"${def}" :
targetLevel);
props.setProperty("platform.active", platformName);
props.setProperty("def",
sourceLevel != null ?
sourceLevel :
JAVAC_SOURCE);
if (profile != null) {
props.setProperty("javac.profile", profile); //NOI18N
}
helper.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, props);
props = PropertyUtils.getGlobalProperties();
props.put("default.javac.source", DEFAULT_JAVAC_SOURCE);
PropertyUtils.putGlobalProperties(props);
eval = helper.getStandardPropertyEvaluator();
assertNotNull(eval);
}
示例5: prepareProject
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
private void prepareProject (String platformName) throws IOException {
scratch = TestUtil.makeScratchDir(this);
FileObject projdir = scratch.createFolder("proj");
AntProjectHelper helper = ProjectGenerator.createProject(projdir, "org.netbeans.modules.java.j2seproject");
EditableProperties props = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
props.setProperty("javac.source", "${def}");
props.setProperty ("platform.active",platformName);
props.setProperty("def", "1.2");
helper.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, props);
props = PropertyUtils.getGlobalProperties();
props.put("default.javac.source", "4.3");
PropertyUtils.putGlobalProperties(props);
sources = projdir.createFolder("src");
projdir.createFolder("test");
}
示例6: readVariables
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
private List<Variable> readVariables() {
List<Variable> vs = new ArrayList<Variable>();
EditableProperties ep = PropertyUtils.getGlobalProperties();
for (Map.Entry<String, String> entry : ep.entrySet()) {
if (entry.getKey().startsWith(VARIABLE_PREFIX)) {
vs.add(new Variable(entry.getKey().substring(VARIABLE_PREFIX.length()), FileUtil.normalizeFile(new File(entry.getValue()))));
}
}
return vs;
}
示例7: setupEnvironmentVariables
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
void setupEnvironmentVariables(List<String> importProblems) throws IOException {
if (workspace == null) {
return;
}
EditableProperties ep = PropertyUtils.getGlobalProperties();
boolean changed = false;
for (DotClassPathEntry entry : cp.getClassPathEntries()) {
if (entry.getKind() != DotClassPathEntry.Kind.VARIABLE) {
continue;
}
String s = EclipseUtils.splitVariable(entry.getRawPath())[0];
Workspace.Variable v = getVariable(s);
if (v != null) {
s = "var."+PropertyUtils.getUsablePropertyName(s); //NOI18N
if (ep.getProperty(s) == null) {
ep.setProperty(s, v.getLocation());
changed = true;
} else if (!ep.getProperty(s).equals(v.getLocation())) {
importProblems.add(org.openide.util.NbBundle.getMessage(EclipseProject.class, "MSG_IDEVariableMismatch", s, ep.getProperty(s), v.getLocation())); //NOI18N
}
} else {
importProblems.add(org.openide.util.NbBundle.getMessage(EclipseProject.class, "MSG_IDEVariableNotFound", s)); //NOI18N
ep.setProperty(s, ""); //NOI18N
changed = true;
}
}
if (changed) {
PropertyUtils.putGlobalProperties(ep);
}
}
示例8: getGlobalProperties
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
/**
* Load global properties defined by the IDE in the user directory.
* Currently loads ${netbeans.user}/build.properties if it exists.
* <p>
* Acquires read access.
* <p>
* @return user properties (empty if missing or malformed)
*/
@NonNull
public static EditableProperties getGlobalProperties() {
return PropertyUtils.getGlobalProperties();
}