org.netbeans.spi.project.support.ant.PropertyUtils Java Examples
The following examples show how to use
org.netbeans.spi.project.support.ant.PropertyUtils.
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: LibrariesNode.java From netbeans with Apache License 2.0 | 6 votes |
@Override public void accept(@NonNull final Pair<String, String> t) { final String ref = eval.evaluate(t.second()); if (ref != null) { for (FileObject[] srcRoots : findSourceRoots()) { final FileObject moduleInfo = findModuleInfo(srcRoots); if (moduleInfo != null) { final Set<String> modules = Arrays.stream(PropertyUtils.tokenizePath(ref)) .flatMap((pe) -> ModulesFinder.INSTANCE.apply( helper.getAntProjectHelper().resolveFile(pe)).stream()) .map(FileUtil::urlForArchiveOrDir) .filter((url) -> url != null) .map((url) -> SourceUtils.getModuleName(url, true)) .filter((name) -> name != null) .collect(Collectors.toSet()); DefaultProjectModulesModifier.removeRequiredModules(moduleInfo, modules); } } } }
Example #2
Source File: EjbJarProjectOperations.java From netbeans with Apache License 2.0 | 6 votes |
private void rememberLibraryLocation() { libraryWithinProject = false; absolutesRelPath = null; libraryPath = project.getAntProjectHelper().getLibrariesLocation(); if (libraryPath != null) { File prjRoot = FileUtil.toFile(project.getProjectDirectory()); libraryFile = PropertyUtils.resolveFile(prjRoot, libraryPath); if (FileOwnerQuery.getOwner(libraryFile.toURI()) == 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); } } } }
Example #3
Source File: CustomizerSources.java From netbeans with Apache License 2.0 | 6 votes |
private void jButtonBrowseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBrowseActionPerformed JFileChooser chooser = new JFileChooser(); FileUtil.preventFileChooserSymlinkTraversal(chooser, null); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); File fileName = new File(jTextFieldConfigFilesFolder.getText()); File configFiles = fileName.isAbsolute() ? fileName : new File(projectFld, fileName.getPath()); if (configFiles.isAbsolute()) { chooser.setSelectedFile(configFiles); } else { chooser.setSelectedFile(projectFld); } if ( JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) { File selected = FileUtil.normalizeFile(chooser.getSelectedFile()); String newConfigFiles; if (CollocationQuery.areCollocated(projectFld, selected)) { newConfigFiles = PropertyUtils.relativizeFile(projectFld, selected); } else { newConfigFiles = selected.getPath(); } jTextFieldConfigFilesFolder.setText(newConfigFiles); } }
Example #4
Source File: Util.java From netbeans with Apache License 2.0 | 6 votes |
public static String removeNBArtifacts( @NonNull final String key, @NullAllowed String value) { if (value != null && "java.class.path".equals(key)) { //NOI18N String nbHome = System.getProperty("netbeans.home"); //NOI18N if (nbHome != null) { if (!nbHome.endsWith(File.separator)) { nbHome = nbHome + File.separatorChar; } final String[] elements = PropertyUtils.tokenizePath(value); final List<String> newElements = new ArrayList<>(elements.length); for (String element : elements) { if (!element.startsWith(nbHome)) { newElements.add(element); } } if (elements.length != newElements.size()) { value = newElements.stream() .collect(Collectors.joining(File.pathSeparator)); } } } return value; }
Example #5
Source File: NbModuleProject.java From netbeans with Apache License 2.0 | 6 votes |
private void addFileRef(Map<String, String> props, String path) { // #66275: // XXX parts of code copied from o.n.spi.project.ant.ReferenceHelper; // will do proper API change later with issue #70894, will also simplify impl of isssue #66188 final File normalizedFile = FileUtil.normalizeFile(PropertyUtils.resolveFile(getProjectDirectoryFile(), path)); String fileID = normalizedFile.getName(); // if the file is folder then add to ID string also parent folder name, // i.e. if external source folder name is "src" the ID will // be a bit more selfdescribing, e.g. project-src in case // of ID for ant/project/src directory. if (normalizedFile.isDirectory() && normalizedFile.getParentFile() != null) { fileID = normalizedFile.getParentFile().getName()+"-"+normalizedFile.getName(); } fileID = PropertyUtils.getUsablePropertyName(fileID); // we don't need to resolve duplicate file names here, all <c-p-e>-s reside in release/modules/ext props.put(REF_START + fileID, path); }
Example #6
Source File: SuiteProject.java From netbeans with Apache License 2.0 | 6 votes |
private PropertyEvaluator createEvaluator() { PropertyProvider predefs = helper.getStockPropertyPreprovider(); File dir = getProjectDirectoryFile(); List<PropertyProvider> providers = new ArrayList<PropertyProvider>(); providers.add(helper.getPropertyProvider("nbproject/private/platform-private.properties")); // NOI18N providers.add(helper.getPropertyProvider("nbproject/platform.properties")); // NOI18N PropertyEvaluator baseEval = PropertyUtils.sequentialPropertyEvaluator(predefs, providers.toArray(new PropertyProvider[providers.size()])); providers.add(new ApisupportAntUtils.UserPropertiesFileProvider(baseEval, dir)); baseEval = PropertyUtils.sequentialPropertyEvaluator(predefs, providers.toArray(new PropertyProvider[providers.size()])); providers.add(new DestDirProvider(baseEval)); providers.add(helper.getPropertyProvider(AntProjectHelper.PRIVATE_PROPERTIES_PATH)); providers.add(helper.getPropertyProvider(AntProjectHelper.PROJECT_PROPERTIES_PATH)); Map<String,String> fixedProps = new HashMap<String,String>(); // synchronize with suite.xml fixedProps.put(SuiteProperties.ENABLED_CLUSTERS_PROPERTY, ""); fixedProps.put(SuiteProperties.DISABLED_CLUSTERS_PROPERTY, ""); fixedProps.put(SuiteProperties.DISABLED_MODULES_PROPERTY, ""); fixedProps.put(SuiteBrandingModel.BRANDING_DIR_PROPERTY, "branding"); // NOI18N fixedProps.put("suite.build.dir", "build"); // NOI18N fixedProps.put("cluster", "${suite.build.dir}/cluster"); // NOI18N fixedProps.put("dist.dir", "dist"); // NOI18N fixedProps.put("test.user.dir", "${suite.build.dir}/testuserdir"); // NOI18N providers.add(PropertyUtils.fixedPropertyProvider(fixedProps)); return PropertyUtils.sequentialPropertyEvaluator(predefs, providers.toArray(new PropertyProvider[providers.size()])); }
Example #7
Source File: PlatformConvertor.java From netbeans with Apache License 2.0 | 6 votes |
@NonNull public static String getFreeAntName (@NonNull final String name) { if (name == null || name.length() == 0) { throw new IllegalArgumentException (); } final FileObject platformsFolder = FileUtil.getConfigFile(PLATFORM_STOREGE); String antName = PropertyUtils.getUsablePropertyName(name); if (platformsFolder.getFileObject(antName,"xml") != null) { //NOI18N String baseName = antName; int index = 1; antName = baseName + Integer.toString (index); while (platformsFolder.getFileObject(antName,"xml") != null) { //NOI18N index ++; antName = baseName + Integer.toString (index); } } return antName; }
Example #8
Source File: EclipseProjectReference.java From netbeans with Apache License 2.0 | 6 votes |
public static void write(Project project, EclipseProjectReference ref) { Preferences prefs = ProjectUtils.getPreferences(project, EclipseProjectReference.class, true); File baseDir = FileUtil.toFile(project.getProjectDirectory()); if (CollocationQuery.areCollocated(baseDir, ref.eclipseProjectLocation)) { prefs.put("project", PropertyUtils.relativizeFile(baseDir, ref.eclipseProjectLocation)); //NOI18N } else { prefs.put("project", ref.eclipseProjectLocation.getPath()); //NOI18N } if (ref.eclipseWorkspaceLocation != null) { if (CollocationQuery.areCollocated(baseDir, ref.eclipseWorkspaceLocation)) { prefs.put("workspace", PropertyUtils.relativizeFile(baseDir, ref.eclipseWorkspaceLocation)); //NOI18N } else { prefs.put("workspace", ref.eclipseWorkspaceLocation.getPath()); //NOI18N } } prefs.put("timestamp", Long.toString(ref.getCurrentTimestamp())); //NOI18N prefs.put("key", ref.key); //NOI18N }
Example #9
Source File: UpdateTask.java From netbeans with Apache License 2.0 | 6 votes |
private static void updateBuildProperties() { ProjectManager.mutex().postWriteRequest( new Runnable () { public void run () { try { final EditableProperties ep = PropertyUtils.getGlobalProperties(); boolean save = updateSourceLevel(ep); save |= updateBuildProperties (ep); if (save) { PropertyUtils.putGlobalProperties (ep); } } catch (IOException ioe) { Exceptions.printStackTrace(ioe); } } }); }
Example #10
Source File: PhpProject.java From netbeans with Apache License 2.0 | 6 votes |
private PropertyEvaluator createEvaluator() { // It is currently safe to not use the UpdateHelper for PropertyEvaluator; UH.getProperties() delegates to APH // Adapted from APH.getStandardPropertyEvaluator (delegates to ProjectProperties): PropertyEvaluator baseEval1 = PropertyUtils.sequentialPropertyEvaluator( helper.getStockPropertyPreprovider(), helper.getPropertyProvider(PhpConfigurationProvider.CONFIG_PROPS_PATH)); PropertyEvaluator baseEval2 = PropertyUtils.sequentialPropertyEvaluator( helper.getStockPropertyPreprovider(), helper.getPropertyProvider(AntProjectHelper.PRIVATE_PROPERTIES_PATH)); return PropertyUtils.sequentialPropertyEvaluator( helper.getStockPropertyPreprovider(), helper.getPropertyProvider(PhpConfigurationProvider.CONFIG_PROPS_PATH), new ConfigPropertyProvider(baseEval1, "nbproject/private/configs", helper), // NOI18N helper.getPropertyProvider(AntProjectHelper.PRIVATE_PROPERTIES_PATH), helper.getProjectLibrariesPropertyProvider(), PropertyUtils.userPropertiesProvider(baseEval2, "user.properties.file", FileUtil.toFile(getProjectDirectory())), // NOI18N new ConfigPropertyProvider(baseEval1, "nbproject/configs", helper), // NOI18N helper.getPropertyProvider(AntProjectHelper.PROJECT_PROPERTIES_PATH)); }
Example #11
Source File: ModulePathsProblemsProvider.java From netbeans with Apache License 2.0 | 6 votes |
private static boolean removeRef( @NonNull final EditableProperties ep, @NonNull final String pathId, @NonNull final String elementToRemove) { final String elementToRemoveRef = ref(elementToRemove, true); final boolean[] changed = new boolean[1]; Optional.ofNullable(ep.getProperty(pathId)) .map((val)->{ return Arrays.stream(PropertyUtils.tokenizePath(val)) .filter((element) -> { final boolean remove = elementToRemoveRef.equals(element); changed[0] |= remove; return !remove; }) .toArray((len) -> new String[len]); }) .ifPresent((val) -> { ep.setProperty(pathId, addPathSeparators(val)); }); return changed[0]; }
Example #12
Source File: ProjectUtilities.java From netbeans with Apache License 2.0 | 6 votes |
public static FileObject getOrCreateBuildFolder(Project project, String buildDirProp) { FileObject buildDir = FileUtil.toFileObject(PropertyUtils.resolveFile(FileUtil.toFile(project.getProjectDirectory()), buildDirProp)); if (buildDir == null) { try { // TODO: if buildDirProp is absolute, relativize via PropertyUtils buildDir = FileUtil.createFolder(project.getProjectDirectory(), buildDirProp); } catch (IOException e) { ErrorManager.getDefault() .annotate(e, Bundle.ProjectUtilities_FailedCreateOutputFolderMsg(e.getMessage())); ErrorManager.getDefault().notify(ErrorManager.ERROR, e); return null; } } return buildDir; }
Example #13
Source File: ProjectFactorySupport.java From netbeans with Apache License 2.0 | 6 votes |
/** * Remove given value to given classpath-like Ant property. */ private static boolean removeFromBuildProperties(AntProjectHelper helper, String property, String referenceToRemove) { boolean result = true; EditableProperties ep = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH); String cp = ep.getProperty(property); String oldCp = cp; if (cp != null && referenceToRemove != null) { cp = cp.replace(referenceToRemove, ""); //NOI18N } if (cp.equals(oldCp)) { result = false; } String[] arr = PropertyUtils.tokenizePath(cp); for (int i = 0; i < arr.length - 1; i++) { arr[i] += ":"; // NOI18N } ep.setProperty(property, arr); if (referenceToRemove.startsWith("${file.reference.") && isLastReference(ep, CommonProjectUtils.getAntPropertyName(referenceToRemove))) { //NOI18N ep.remove(CommonProjectUtils.getAntPropertyName(referenceToRemove)); } helper.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, ep); return result; }
Example #14
Source File: EarProjectOperations.java From netbeans with Apache License 2.0 | 6 votes |
private void rememberLibraryLocation() { libraryWithinProject = false; absolutesRelPath = null; libraryPath = project.getAntProjectHelper().getLibrariesLocation(); if (libraryPath != null) { File prjRoot = FileUtil.toFile(project.getProjectDirectory()); libraryFile = PropertyUtils.resolveFile(prjRoot, libraryPath); if (FileOwnerQuery.getOwner(libraryFile.toURI()) == 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); } } } }
Example #15
Source File: ProjectFactorySupport.java From netbeans with Apache License 2.0 | 6 votes |
private static String getValueTag(DotClassPathEntry entry) { switch (entry.getKind()) { case PROJECT: return entry.getRawPath().substring(1); // project name case VARIABLE: String v[] = EclipseUtils.splitVariable(entry.getRawPath()); return PropertyUtils.getUsablePropertyName(v[0]) + v[1]; // variable name case CONTAINER: return entry.getContainerMapping(); // mapping as produced by container resolver case LIBRARY: case OUTPUT: case SOURCE: default: return entry.getRawPath(); // file path } }
Example #16
Source File: PhpUnit.java From netbeans with Apache License 2.0 | 6 votes |
static String processIncludePath(File bootstrap, String line, List<String> includePath, File projectDir) { String resolvedIncludePath = ""; // NOI18N if (!includePath.isEmpty()) { StringBuilder buffer = new StringBuilder(200); for (String path : includePath) { // XXX perhaps already resolved paths should be here? File reference = PropertyUtils.resolveFile(projectDir, path); buffer.append(".PATH_SEPARATOR"); // NOI18N buffer.append(getDirnameFile(bootstrap, reference)); } resolvedIncludePath = buffer.toString(); } else { // comment out the line line = "//" + line; // NOI18N } line = line.replace("%INCLUDE_PATH%", resolvedIncludePath); // NOI18N return line; }
Example #17
Source File: CustomizerSources.java From netbeans with Apache License 2.0 | 6 votes |
private void configFilesFolderBrowseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_configFilesFolderBrowseActionPerformed JFileChooser chooser = new JFileChooser(); FileUtil.preventFileChooserSymlinkTraversal(chooser, null); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); File fileName = new File(jTextFieldConfigFilesFolder.getText()); File configFiles = fileName.isAbsolute() ? fileName : new File(projectFld, fileName.getPath()); if (configFiles.isAbsolute()) { chooser.setSelectedFile(configFiles); } else { chooser.setSelectedFile(projectFld); } if ( JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) { File selected = FileUtil.normalizeFile(chooser.getSelectedFile()); String newConfigFiles; if (CollocationQuery.areCollocated(projectFld, selected)) { newConfigFiles = PropertyUtils.relativizeFile(projectFld, selected); } else { newConfigFiles = selected.getPath(); } jTextFieldConfigFilesFolder.setText(newConfigFiles); } }
Example #18
Source File: CustomizerSources.java From netbeans with Apache License 2.0 | 6 votes |
private void updateFolder(JTextField textField) { JFileChooser chooser = new JFileChooser(); FileUtil.preventFileChooserSymlinkTraversal(chooser, null); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); File fileName = new File(textField.getText()); File folder = fileName.isAbsolute() ? fileName : new File(projectFld, fileName.getPath()); if (folder.exists()) { chooser.setSelectedFile(folder); } else { chooser.setSelectedFile(projectFld); } if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) { File selected = FileUtil.normalizeFile(chooser.getSelectedFile()); String newFolder; if (CollocationQuery.areCollocated(projectFld, selected)) { newFolder = PropertyUtils.relativizeFile(projectFld, selected); } else { newFolder = selected.getPath(); } textField.setText(newFolder); } }
Example #19
Source File: ModuleList.java From netbeans with Apache License 2.0 | 6 votes |
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; }
Example #20
Source File: WebProjectOperations.java From netbeans with Apache License 2.0 | 6 votes |
private void rememberLibraryLocation() { libraryWithinProject = false; absolutesRelPath = null; libraryPath = project.getAntProjectHelper().getLibrariesLocation(); if (libraryPath != null) { File prjRoot = FileUtil.toFile(project.getProjectDirectory()); libraryFile = PropertyUtils.resolveFile(prjRoot, libraryPath); if (FileOwnerQuery.getOwner(libraryFile.toURI()) == 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); } } } }
Example #21
Source File: AbstractEntry.java From netbeans with Apache License 2.0 | 6 votes |
public synchronized Set<String> getPublicClassNames() { if (publicClassNames == null) { try { publicClassNames = computePublicClassNamesInMainModule(); String[] cpext = PropertyUtils.tokenizePath(getClassPathExtensions()); for (int i = 0; i < cpext.length; i++) { File ext = new File(cpext[i]); if (!ext.isFile()) { Logger.getLogger(AbstractEntry.class.getName()).log(Level.FINE, "Could not find Class-Path extension {0} of {1}", new Object[] {ext, this}); continue; } scanJarForPublicClassNames(publicClassNames, ext); } } catch (IOException e) { publicClassNames = Collections.emptySet(); Util.err.annotate(e, ErrorManager.UNKNOWN, "While scanning for public classes in " + this, null, null, null); // NOI18N Util.err.notify(ErrorManager.INFORMATIONAL, e); } } return publicClassNames; }
Example #22
Source File: ModuleList.java From netbeans with Apache License 2.0 | 6 votes |
public static Map<String,String> getClusterProperties(File nbroot) throws IOException { Map<String, String> clusterDefs = null; synchronized (clusterPropertiesFiles) { clusterDefs = clusterPropertiesFiles.get(nbroot); if (clusterDefs == null) { PropertyProvider pp = loadPropertiesFile(getClusterPropertiesFile(nbroot)); // NOI18N PropertyEvaluator clusterEval = PropertyUtils.sequentialPropertyEvaluator( PropertyUtils.fixedPropertyProvider(Collections.<String, String>emptyMap()), pp); clusterDefs = clusterEval.getProperties(); if (clusterDefs == null) { // Definition failure of some sort. clusterDefs = Collections.emptyMap(); } clusterPropertiesFiles.put(nbroot, clusterDefs); } } return clusterDefs; }
Example #23
Source File: ProjectServerPanel.java From netbeans with Apache License 2.0 | 5 votes |
private String getServerLibraryName() { if (!serverLibraryCheckbox.isSelected() || !serverLibraryCheckbox.isEnabled()) { return null; } Deployment deployment = Deployment.getDefault(); String name = deployment.getServerDisplayName(deployment.getServerID(getSelectedServer())); // null can occur only if the server was removed somehow return (name == null) ? "" : PropertyUtils.getUsablePropertyName(name); // NOI18N }
Example #24
Source File: SymfonyUtils.java From netbeans with Apache License 2.0 | 5 votes |
public static FileObject getAction(FileObject fo) { File parent = FileUtil.toFile(fo).getParentFile(); File action = PropertyUtils.resolveFile(parent, FILE_ACTION_RELATIVE); if (action.isFile()) { return FileUtil.toFileObject(action); } return null; }
Example #25
Source File: PhpOptions.java From netbeans with Apache License 2.0 | 5 votes |
/** * Ensure that the php.global.include.path is written in build.properties so Ant can see it. */ public void ensurePhpGlobalIncludePath() { if (phpGlobalIncludePathEnsured) { return; } phpGlobalIncludePathEnsured = true; String phpGlobalIncludePath = getPhpGlobalIncludePath(); if (!phpGlobalIncludePath.equals(PropertyUtils.getGlobalProperties().getProperty(PhpProjectProperties.GLOBAL_INCLUDE_PATH))) { setPhpGlobalIncludePath(phpGlobalIncludePath); } }
Example #26
Source File: ClassPathProviderImpl.java From netbeans with Apache License 2.0 | 5 votes |
private void addPathFromProjectEvaluated(List<PathResourceImplementation> entries, String path) { if (path != null) { for (String piece : PropertyUtils.tokenizePath(path)) { URL url = FileUtil.urlForArchiveOrDir(project.getHelper().resolveFile(piece)); if (url != null) { // #135292 entries.add(ClassPathSupport.createResource(url)); } } } }
Example #27
Source File: CustomizerLibraries.java From netbeans with Apache License 2.0 | 5 votes |
private void switchLibrary() { String loc = librariesLocation.getText(); LibraryManager man; if (loc.trim().length() > -1) { try { File base = FileUtil.toFile(uiProperties.getProject().getProjectDirectory()); File location = FileUtil.normalizeFile(PropertyUtils.resolveFile(base, loc)); URL url = location.toURI().toURL(); man = LibraryManager.forLocation(url); } catch (MalformedURLException ex) { Exceptions.printStackTrace(ex); //TODO show as error in UI man = LibraryManager.getDefault(); } } else { man = LibraryManager.getDefault(); } DefaultListModel[] models = new DefaultListModel[]{ uiProperties.JAVAC_CLASSPATH_MODEL.getDefaultListModel(), uiProperties.JAVAC_PROCESSORPATH_MODEL, uiProperties.JAVAC_TEST_CLASSPATH_MODEL, uiProperties.ENDORSED_CLASSPATH_MODEL, uiProperties.RUN_TEST_CLASSPATH_MODEL }; for (int i = 0; i < models.length; i++) { for (Iterator it = ClassPathUiSupport.getIterator(models[i]); it.hasNext();) { ClassPathSupport.Item itm = (ClassPathSupport.Item) it.next(); if (itm.getType() == ClassPathSupport.Item.TYPE_LIBRARY) { itm.reassignLibraryManager(man); } } } jTabbedPane1.repaint(); testBroken(); }
Example #28
Source File: VariablePanel.java From netbeans with Apache License 2.0 | 5 votes |
private void checkValidity() { String error = null; if (nameTextField.getText().length() == 0) { error =NbBundle.getBundle(VariablePanel.class).getString("MSG_Invalid_Name"); } else if (variableBeingEditted == null && model.find(nameTextField.getText()) != null) { error = NbBundle.getBundle(VariablePanel.class).getString("MSG_Variable_Already_Exists"); } else if (locationTextField.getText().length() == 0 || !getVariableLocation().exists()) { error = NbBundle.getBundle(VariablePanel.class).getString("MSG_Invalid_Location"); } else if (variableBeingEditted == null && !PropertyUtils.isUsablePropertyName(nameTextField.getText())) { error = NbBundle.getBundle(VariablePanel.class).getString("MSG_Invalid_Name"); } dd.setValid(error == null); errorLabel.setText(error == null ? " " : error); // NOI18N }
Example #29
Source File: J2SEFileWizardIterator.java From netbeans with Apache License 2.0 | 5 votes |
private static boolean addRefIfAbsent( @NonNull final EditableProperties ep, @NonNull final String pathId, @NonNull final String elementToAdd, @NullAllowed final String insertAfter) { final boolean[] changed = new boolean[1]; Optional.ofNullable(ep.getProperty(pathId)) .map((val)-> { String[] path = PropertyUtils.tokenizePath(val); if(!Arrays.stream(path).anyMatch((element) -> elementToAdd.equals(element))) { final List<String> newPath = new ArrayList<>(path.length + 1); boolean added = false; for (int i=0; i< path.length; i++) { newPath.add(path[i]); if (insertAfter != null && insertAfter.equals(path[i])) { added = true; newPath.add(elementToAdd); } } if (!added) { newPath.add(elementToAdd); } path = newPath.toArray(new String[newPath.size()]); changed[0] = true; } return path; }) .ifPresent((val) -> ep.setProperty(pathId, addPathSeparators(val))); return changed[0]; }
Example #30
Source File: PhpUnit.java From netbeans with Apache License 2.0 | 5 votes |
static String getRelPath(File testFile, File sourceFile, String absolutePrefix, String relativePrefix, String suffix, boolean forceAbsolute) { File parentFile = testFile.getParentFile(); String relPath = PropertyUtils.relativizeFile(parentFile, sourceFile); if (relPath == null || forceAbsolute) { // cannot be versioned... relPath = absolutePrefix + sourceFile.getAbsolutePath() + suffix; } else { relPath = relativePrefix + relPath + suffix; } return relPath.replace(File.separatorChar, DIRECTORY_SEPARATOR); }