Java Code Examples for org.netbeans.spi.project.support.ant.PropertyUtils#getGlobalProperties()
The following examples show how to use
org.netbeans.spi.project.support.ant.PropertyUtils#getGlobalProperties() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BrokenPlatformReferenceTest.java From netbeans with Apache License 2.0 | 6 votes |
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"); }
Example 2
Source File: SourceLevelQueryImplTest.java From netbeans with Apache License 2.0 | 6 votes |
private void prepareProject (String platformName) throws IOException { scratch = makeScratchDir(this); projdir = scratch.createFolder("proj"); AntProjectHelper helper = ProjectGenerator.createProject(projdir, "org.netbeans.modules.web.project"); pm = ProjectManager.getDefault(); pp = pm.findProject(projdir); 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"); }
Example 3
Source File: J2SEPlatformModuleTest.java From netbeans with Apache License 2.0 | 5 votes |
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")); }
Example 4
Source File: DefaultReplaceTokenProvider.java From netbeans with Apache License 2.0 | 5 votes |
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; }
Example 5
Source File: SourceLevelQueryImplTest.java From netbeans with Apache License 2.0 | 5 votes |
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); }
Example 6
Source File: SourceLevelQueryImplTest.java From netbeans with Apache License 2.0 | 5 votes |
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"); }
Example 7
Source File: EclipseProject.java From netbeans with Apache License 2.0 | 5 votes |
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); } }
Example 8
Source File: PhpOptions.java From netbeans with Apache License 2.0 | 5 votes |
public void setPhpGlobalIncludePath(String phpGlobalIncludePath) { getPreferences().put(PHP_GLOBAL_INCLUDE_PATH, phpGlobalIncludePath); // update global ant properties as well (global include path can be used in project's include path) EditableProperties globalProperties = PropertyUtils.getGlobalProperties(); globalProperties.setProperty(PhpProjectProperties.GLOBAL_INCLUDE_PATH, phpGlobalIncludePath); try { PropertyUtils.putGlobalProperties(globalProperties); } catch (IOException ex) { Exceptions.printStackTrace(ex); } }
Example 9
Source File: VariablesModel.java From netbeans with Apache License 2.0 | 5 votes |
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; }
Example 10
Source File: EjbJarWebServicesSupport.java From netbeans with Apache License 2.0 | 4 votes |
private boolean updateWsCompileProperties(String serviceName) { /** Ensure wscompile.classpath and wscompile.tools.classpath are * properly defined. * * wscompile.classpath goes in project properties and includes * jaxrpc and qname right now. * * wscompile.tools.classpath is for tools.jar which is needed when * running under the Sun JDK to invoke javac. It is placed in * user.properties so that if we compute it incorrectly (say on a mac) * the user can change it and we will not blow away the change. * Hopefully we can do this better for release. */ boolean globalPropertiesChanged = false; EditableProperties globalProperties = PropertyUtils.getGlobalProperties(); if(globalProperties.getProperty(WSCOMPILE_TOOLS_CLASSPATH) == null) { globalProperties.setProperty(WSCOMPILE_TOOLS_CLASSPATH, "${java.home}\\..\\lib\\tools.jar"); try { PropertyUtils.putGlobalProperties(globalProperties); } catch(java.io.IOException ex) { String mes = "Error saving global properties when adding wscompile.tools.classpath for service '" + serviceName + "'\r\n" + ex.getMessage(); NotifyDescriptor desc = new NotifyDescriptor.Message(mes, NotifyDescriptor.Message.ERROR_MESSAGE); DialogDisplayer.getDefault().notify(desc); } globalPropertiesChanged = true; } boolean projectPropertiesChanged = false; EditableProperties projectProperties = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH); { // Block that adjusts wscompile.client.classpath as necessary. HashSet<String> wscJars = new HashSet<String>(); boolean newWscJars = false; String wscClientClasspath = projectProperties.getProperty(WSCOMPILE_CLASSPATH); if(wscClientClasspath != null) { String[] libs = PropertyUtils.tokenizePath(wscClientClasspath); for(int i = 0; i < libs.length; i++) { wscJars.add(libs[i]); } } for(int i = 0; i < WSCOMPILE_JARS.length; i++) { if(!wscJars.contains(WSCOMPILE_JARS[i])) { wscJars.add(WSCOMPILE_JARS[i]); newWscJars = true; } } if(newWscJars) { StringBuffer newClasspathBuf = new StringBuffer(256); for(Iterator iter = wscJars.iterator(); iter.hasNext(); ) { newClasspathBuf.append(iter.next().toString()); if(iter.hasNext()) { newClasspathBuf.append(":"); } } projectProperties.put(WSCOMPILE_CLASSPATH, newClasspathBuf.toString()); projectPropertiesChanged = true; } } // set tools.jar property if not set if(projectProperties.getProperty(WSCOMPILE_TOOLS_CLASSPATH) == null) { projectProperties.setProperty(WSCOMPILE_TOOLS_CLASSPATH, "${java.home}\\..\\lib\\tools.jar"); // NOI18N projectPropertiesChanged = true; } if(projectPropertiesChanged) { helper.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, projectProperties); } return globalPropertiesChanged || projectPropertiesChanged; }
Example 11
Source File: EjbJarWebServicesClientSupport.java From netbeans with Apache License 2.0 | 4 votes |
private boolean updateWsCompileProperties(String serviceName) { /** Ensure wscompile.classpath and wscompile.tools.classpath are * properly defined. * * wscompile.classpath goes in project properties and includes * jaxrpc and qname right now. * * wscompile.tools.classpath is for tools.jar which is needed when * running under the Sun JDK to invoke javac. It is placed in * user.properties so that if we compute it incorrectly (say on a mac) * the user can change it and we will not blow away the change. * Hopefully we can do this better for release. */ boolean globalPropertiesChanged = false; EditableProperties globalProperties = PropertyUtils.getGlobalProperties(); if(globalProperties.getProperty(WSCOMPILE_TOOLS_CLASSPATH) == null) { globalProperties.setProperty(WSCOMPILE_TOOLS_CLASSPATH, "${java.home}\\..\\lib\\tools.jar"); // NOI18N try { PropertyUtils.putGlobalProperties(globalProperties); } catch(java.io.IOException ex) { String mes = "Error saving global properties when adding wscompile.tools.classpath for service '" + serviceName + "'\r\n" + ex.getMessage(); // NOI18N NotifyDescriptor desc = new NotifyDescriptor.Message(mes, NotifyDescriptor.Message.ERROR_MESSAGE); DialogDisplayer.getDefault().notify(desc); } globalPropertiesChanged = true; } boolean projectPropertiesChanged = false; EditableProperties projectProperties = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH); { // Block that adjusts wscompile.client.classpath as necessary. HashSet<String> wscJars = new HashSet<String>(); boolean newWscJars = false; String wscClientClasspath = projectProperties.getProperty(WSCOMPILE_CLASSPATH); if(wscClientClasspath != null) { String[] libs = PropertyUtils.tokenizePath(wscClientClasspath); for(int i = 0; i < libs.length; i++) { wscJars.add(libs[i]); } } for(int i = 0; i < WSCOMPILE_JARS.length; i++) { if(!wscJars.contains(WSCOMPILE_JARS[i])) { wscJars.add(WSCOMPILE_JARS[i]); newWscJars = true; } } if(newWscJars) { StringBuffer newClasspathBuf = new StringBuffer(256); for(Iterator iter = wscJars.iterator(); iter.hasNext(); ) { newClasspathBuf.append(iter.next().toString()); if(iter.hasNext()) { newClasspathBuf.append(":"); // NOI18N } } projectProperties.put(WSCOMPILE_CLASSPATH, newClasspathBuf.toString()); projectPropertiesChanged = true; } } // set tools.jar property if not set if(projectProperties.getProperty(WSCOMPILE_TOOLS_CLASSPATH) == null) { projectProperties.setProperty(WSCOMPILE_TOOLS_CLASSPATH, "${java.home}\\..\\lib\\tools.jar"); // NOI18N projectPropertiesChanged = true; } if(projectPropertiesChanged) { helper.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, projectProperties); } return globalPropertiesChanged || projectPropertiesChanged; }
Example 12
Source File: WebProjectWebServicesClientSupport.java From netbeans with Apache License 2.0 | 4 votes |
private boolean updateWsCompileProperties(String serviceName) { /** Ensure wscompile.classpath and wscompile.tools.classpath are * properly defined. * * wscompile.classpath goes in project properties and includes * jaxrpc and qname right now. * * wscompile.tools.classpath is for tools.jar which is needed when * running under the Sun JDK to invoke javac. It is placed in * user.properties so that if we compute it incorrectly (say on a mac) * the user can change it and we will not blow away the change. * Hopefully we can do this better for release. */ boolean globalPropertiesChanged = false; EditableProperties globalProperties = PropertyUtils.getGlobalProperties(); if(globalProperties.getProperty(WSCOMPILE_TOOLS_CLASSPATH) == null) { globalProperties.setProperty(WSCOMPILE_TOOLS_CLASSPATH, "${java.home}\\..\\lib\\tools.jar"); // NOI18N try { PropertyUtils.putGlobalProperties(globalProperties); } catch(IOException ex) { NotifyDescriptor desc = new NotifyDescriptor.Message( NbBundle.getMessage(WebProjectWebServicesClientSupport.class,"MSG_ErrorSavingGlobalProperties", serviceName, ex.getMessage()), // NOI18N NotifyDescriptor.ERROR_MESSAGE); DialogDisplayer.getDefault().notify(desc); } globalPropertiesChanged = true; } boolean projectPropertiesChanged = false; EditableProperties projectProperties = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH); { // Block that adjusts wscompile.client.classpath as necessary. HashSet<String> wscJars = new HashSet<String>(); boolean newWscJars = false; String wscClientClasspath = projectProperties.getProperty(WSCOMPILE_CLASSPATH); if(wscClientClasspath != null) { String [] libs = PropertyUtils.tokenizePath(wscClientClasspath); for(int i = 0; i < libs.length; i++) { wscJars.add(libs[i]); } } for(int i = 0; i < WSCOMPILE_JARS.length; i++) { if(!wscJars.contains(WSCOMPILE_JARS[i])) { wscJars.add(WSCOMPILE_JARS[i]); newWscJars = true; } } if(newWscJars) { StringBuffer newClasspathBuf = new StringBuffer(256); for(Iterator iter = wscJars.iterator(); iter.hasNext(); ) { newClasspathBuf.append(iter.next()); if(iter.hasNext()) { newClasspathBuf.append(':'); } } projectProperties.put(WSCOMPILE_CLASSPATH, newClasspathBuf.toString()); projectPropertiesChanged = true; } } // set tools.jar property if not set if(projectProperties.getProperty(WSCOMPILE_TOOLS_CLASSPATH) == null) { projectProperties.setProperty(WSCOMPILE_TOOLS_CLASSPATH, "${java.home}\\..\\lib\\tools.jar"); // NOI18N projectPropertiesChanged = true; } if(projectPropertiesChanged) { helper.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, projectProperties); } return globalPropertiesChanged || projectPropertiesChanged; }
Example 13
Source File: WebProjectWebServicesSupport.java From netbeans with Apache License 2.0 | 4 votes |
private boolean updateWsCompileProperties(String serviceName) { /** Ensure wscompile.classpath and wscompile.tools.classpath are * properly defined. * * wscompile.classpath goes in project properties and includes * jaxrpc and qname right now. * * wscompile.tools.classpath is for tools.jar which is needed when * running under the Sun JDK to invoke javac. It is placed in * user.properties so that if we compute it incorrectly (say on a mac) * the user can change it and we will not blow away the change. * Hopefully we can do this better for release. */ boolean globalPropertiesChanged = false; EditableProperties globalProperties = PropertyUtils.getGlobalProperties(); if(globalProperties.getProperty(WSCOMPILE_TOOLS_CLASSPATH) == null) { globalProperties.setProperty(WSCOMPILE_TOOLS_CLASSPATH, "${java.home}\\..\\lib\\tools.jar"); // NOI18N try { PropertyUtils.putGlobalProperties(globalProperties); } catch(IOException ex) { NotifyDescriptor desc = new NotifyDescriptor.Message( NbBundle.getMessage(WebProjectWebServicesSupport.class,"MSG_ErrorSavingGlobalProperties", serviceName, ex.getMessage()), // NOI18N NotifyDescriptor.ERROR_MESSAGE); DialogDisplayer.getDefault().notify(desc); } globalPropertiesChanged = true; } boolean projectPropertiesChanged = false; EditableProperties projectProperties = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH); { // Block that adjusts wscompile.client.classpath as necessary. HashSet<String> wscJars = new HashSet<String>(); boolean newWscJars = false; String wscClientClasspath = projectProperties.getProperty(WSCOMPILE_CLASSPATH); if(wscClientClasspath != null) { String [] libs = PropertyUtils.tokenizePath(wscClientClasspath); for(int i = 0; i < libs.length; i++) { wscJars.add(libs[i]); } } for(int i = 0; i < WSCOMPILE_JARS.length; i++) { if(!wscJars.contains(WSCOMPILE_JARS[i])) { wscJars.add(WSCOMPILE_JARS[i]); newWscJars = true; } } if(newWscJars) { StringBuffer newClasspathBuf = new StringBuffer(256); for(Iterator iter = wscJars.iterator(); iter.hasNext(); ) { newClasspathBuf.append(iter.next()); if(iter.hasNext()) { newClasspathBuf.append(':'); } } projectProperties.put(WSCOMPILE_CLASSPATH, newClasspathBuf.toString()); projectPropertiesChanged = true; } } // set tools.jar property if not set if(projectProperties.getProperty(WSCOMPILE_TOOLS_CLASSPATH) == null) { projectProperties.setProperty(WSCOMPILE_TOOLS_CLASSPATH, "${java.home}\\..\\lib\\tools.jar"); // NOI18N projectPropertiesChanged = true; } if(projectPropertiesChanged) { helper.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, projectProperties); } return globalPropertiesChanged || projectPropertiesChanged; }
Example 14
Source File: AppClientProjectWebServicesClientSupport.java From netbeans with Apache License 2.0 | 4 votes |
private boolean updateWsCompileProperties(String serviceName) { /** Ensure wscompile.classpath and wscompile.tools.classpath are * properly defined. * * wscompile.classpath goes in project properties and includes * jaxrpc and qname right now. * * wscompile.tools.classpath is for tools.jar which is needed when * running under the Sun JDK to invoke javac. It is placed in * user.properties so that if we compute it incorrectly (say on a mac) * the user can change it and we will not blow away the change. * Hopefully we can do this better for release. */ boolean globalPropertiesChanged = false; EditableProperties globalProperties = PropertyUtils.getGlobalProperties(); if(globalProperties.getProperty(WSCOMPILE_TOOLS_CLASSPATH) == null) { globalProperties.setProperty(WSCOMPILE_TOOLS_CLASSPATH, "${java.home}\\..\\lib\\tools.jar"); // NOI18N try { PropertyUtils.putGlobalProperties(globalProperties); } catch(IOException ex) { NotifyDescriptor desc = new NotifyDescriptor.Message( NbBundle.getMessage(AppClientProjectWebServicesClientSupport.class,"MSG_ErrorSavingGlobalProperties", serviceName, ex.getMessage()), // NOI18N NotifyDescriptor.ERROR_MESSAGE); DialogDisplayer.getDefault().notify(desc); } globalPropertiesChanged = true; } boolean projectPropertiesChanged = false; EditableProperties projectProperties = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH); { // Block that adjusts wscompile.client.classpath as necessary. Set<String> wscJars = new HashSet<String>(); boolean newWscJars = false; String wscClientClasspath = projectProperties.getProperty(WSCOMPILE_CLASSPATH); if(wscClientClasspath != null) { String [] libs = PropertyUtils.tokenizePath(wscClientClasspath); for(int i = 0; i < libs.length; i++) { wscJars.add(libs[i]); } } for(int i = 0; i < WSCOMPILE_JARS.length; i++) { if(!wscJars.contains(WSCOMPILE_JARS[i])) { wscJars.add(WSCOMPILE_JARS[i]); newWscJars = true; } } if(newWscJars) { StringBuffer newClasspathBuf = new StringBuffer(256); for(Iterator iter = wscJars.iterator(); iter.hasNext(); ) { newClasspathBuf.append(iter.next().toString()); if(iter.hasNext()) { newClasspathBuf.append(':'); } } projectProperties.put(WSCOMPILE_CLASSPATH, newClasspathBuf.toString()); projectPropertiesChanged = true; } } // set tools.jar property if not set if(projectProperties.getProperty(WSCOMPILE_TOOLS_CLASSPATH) == null) { projectProperties.setProperty(WSCOMPILE_TOOLS_CLASSPATH, "${java.home}\\..\\lib\\tools.jar"); // NOI18N projectPropertiesChanged = true; } if(projectPropertiesChanged) { helper.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, projectProperties); } return globalPropertiesChanged || projectPropertiesChanged; }
Example 15
Source File: PlatformPropertiesHandler.java From netbeans with Apache License 2.0 | 2 votes |
/** * 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(); }