Java Code Examples for org.openide.xml.XMLUtil#findText()

The following examples show how to use org.openide.xml.XMLUtil#findText() . 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: NbModuleProject.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Find marked extra compilation units.
 * Gives a map from the package root to the defining XML element.
 */
public Map<FileObject,Element> getExtraCompilationUnits() {
    if (extraCompilationUnits == null) {
        extraCompilationUnits = new HashMap<FileObject,Element>();
        for (Element ecu : XMLUtil.findSubElements(getPrimaryConfigurationData())) {
            if (ecu.getLocalName().equals("extra-compilation-unit")) { // NOI18N
                Element pkgrootEl = XMLUtil.findElement(ecu, "package-root", NbModuleProject.NAMESPACE_SHARED); // NOI18N
                String pkgrootS = XMLUtil.findText(pkgrootEl);
                String pkgrootEval = evaluator().evaluate(pkgrootS);
                FileObject pkgroot = pkgrootEval != null ? getHelper().resolveFileObject(pkgrootEval) : null;
                if (pkgroot == null) {
                    Util.err.log(ErrorManager.WARNING, "Could not find package-root " + pkgrootEval + " for " + getCodeNameBase());
                    continue;
                }
                extraCompilationUnits.put(pkgroot, ecu);
            }
        }
    }
    return extraCompilationUnits;
}
 
Example 2
Source File: ProjectXMLManager.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Use this for removing more than one dependencies. It's faster then
 * iterating and using <code>removeDependency</code> for every entry.
 */
public void removeDependenciesByCNB(Collection<String> cnbsToDelete) {
    Element _confData = getConfData();
    Element moduleDependencies = findModuleDependencies(_confData);
    for (Element dep : XMLUtil.findSubElements(moduleDependencies)) {
        Element cnbEl = findElement(dep, ProjectXMLManager.CODE_NAME_BASE);
        String _cnb = XMLUtil.findText(cnbEl);
        if (cnbsToDelete.remove(_cnb)) {
            moduleDependencies.removeChild(dep);
        }
        if (cnbsToDelete.size() == 0) {
            break; // everything was deleted
        }
    }
    if (cnbsToDelete.size() != 0) {
        Util.err.log(ErrorManager.WARNING,
                "Some modules weren't deleted: " + cnbsToDelete); // NOI18N
    }
    project.putPrimaryConfigurationData(_confData);
    directDeps = null;
}
 
Example 3
Source File: Classpaths.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Create a classpath from a &lt;classpath&gt; element.
 */
private List<URL> createClasspath(
        final Element classpathEl,
        final Function<URL,Collection<URL>> translate) {
    String cp = XMLUtil.findText(classpathEl);
    if (cp == null) {
        cp = "";
    }
    String cpEval = evaluator.evaluate(cp);
    if (cpEval == null) {
        return Collections.emptyList();
    }
    final String[] path = PropertyUtils.tokenizePath(cpEval);
    final List<URL> res = new ArrayList<>();
    for (String pathElement : path) {
        res.addAll(translate.apply(createClasspathEntry(pathElement)));
    }
    return res;
}
 
Example 4
Source File: GlobalSourceForBinaryImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private String parseCNB(final ZipEntry projectXML) throws IOException {
    Document doc;
    InputStream is = nbSrcZip.getInputStream(projectXML);
    try {
        doc = XMLUtil.parse(new InputSource(is), false, true, null, null);
    } catch (SAXException e) {
        throw (IOException) new IOException(projectXML + ": " + e.toString()).initCause(e); // NOI18N
    } finally {
        is.close();
    }
    Element docel = doc.getDocumentElement();
    Element type = XMLUtil.findElement(docel, "type", "http://www.netbeans.org/ns/project/1"); // NOI18N
    String cnb = null;
    if (XMLUtil.findText(type).equals("org.netbeans.modules.apisupport.project")) { // NOI18N
        Element cfg = XMLUtil.findElement(docel, "configuration", "http://www.netbeans.org/ns/project/1"); // NOI18N
        Element data = XMLUtil.findElement(cfg, "data", null); // NOI18N
        if (data != null) {
            cnb = XMLUtil.findText(XMLUtil.findElement(data, "code-name-base", null)); // NOI18N
        }
    }
    return cnb;
}
 
Example 5
Source File: JavaActions.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Find output classes given a compilation unit from project.xml.
 */
private String findClassesOutputDir(Element compilationUnitEl) {
    // Look for an appropriate <built-to>.
    for (Element builtTo : XMLUtil.findSubElements(compilationUnitEl)) {
        if (builtTo.getLocalName().equals("built-to")) { // NOI18N
            String rawtext = XMLUtil.findText(builtTo);
            // Check that it is not an archive.
            String evaltext = evaluator.evaluate(rawtext);
            if (evaltext != null) {
                File dest = helper.resolveFile(evaltext);
                URL destU;
                try {
                    destU = Utilities.toURI(dest).toURL();
                } catch (MalformedURLException e) {
                    throw new AssertionError(e);
                }
                if (!FileUtil.isArchiveFile(destU)) {
                    // OK, dir, take it.
                    return rawtext;
                }
            }
        }
    }
    return null;
}
 
Example 6
Source File: ProjectXMLManager.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void editDependency(ModuleDependency origDep, ModuleDependency newDep) {
    Element _confData = getConfData();
    Element moduleDependencies = findModuleDependencies(_confData);
    List<Element> currentDeps = XMLUtil.findSubElements(moduleDependencies);
    for (Iterator<Element> it = currentDeps.iterator(); it.hasNext();) {
        Element dep = it.next();
        Element cnbEl = findElement(dep, ProjectXMLManager.CODE_NAME_BASE);
        String _cnb = XMLUtil.findText(cnbEl);
        if (_cnb.equals(origDep.getModuleEntry().getCodeNameBase())) {
            moduleDependencies.removeChild(dep);
            Element nextDep = it.hasNext() ? it.next() : null;
            createModuleDependencyElement(moduleDependencies, newDep, nextDep);
            break;
        }
    }
    project.putPrimaryConfigurationData(_confData);
    directDeps = null;
}
 
Example 7
Source File: Actions.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public Object getValue(String key) {
    if (key.equals(Action.NAME)) {
        Element labelEl = XMLUtil.findElement(actionEl, "label", FreeformProjectType.NS_GENERAL); // NOI18N
        return XMLUtil.findText(labelEl);
    } else {
        return super.getValue(key);
    }
}
 
Example 8
Source File: ProjectXMLManager.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Returns code-name-base. */
public String getCodeNameBase() {
    if (cnb == null) {
        Element cnbEl = findElement(getConfData(), ProjectXMLManager.CODE_NAME_BASE);
        cnb = XMLUtil.findText(cnbEl);
    }
    return cnb;
}
 
Example 9
Source File: JavaFreeformFileBuiltQuery.java    From netbeans with Apache License 2.0 5 votes vote down vote up
static List<String> findBuiltToNames(Element compilationUnitEl) {
    List<String> names = new ArrayList<String>();
    for (Element e : XMLUtil.findSubElements(compilationUnitEl)) {
        if (!e.getLocalName().equals("built-to")) { // NOI18N
            continue;
        }
        String location = XMLUtil.findText(e);
        names.add(location);
    }
    return names;
}
 
Example 10
Source File: ProjectXMLManager.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private ModuleDependency getModuleDependency(String cnb, ModuleList ml, Element depEl) {
    ModuleEntry me = ml.getEntry(cnb);
    if (me == null) {
        // XXX might be e.g. shown in nb.errorForreground and "disabled"
        Util.err.log(ErrorManager.WARNING,
                "Detected dependency on module which cannot be found in " + // NOI18N
                "the current module's universe (platform, suite): " + cnb); // NOI18N
        me = new NonexistentModuleEntry(cnb);
    }
    String relVer = null;
    String specVer = null;
    boolean implDep = false;
    Element runDepEl = findElement(depEl, ProjectXMLManager.RUN_DEPENDENCY);
    if (runDepEl != null) {
        Element relVerEl = findElement(runDepEl, ProjectXMLManager.RELEASE_VERSION);
        if (relVerEl != null) {
            relVer = XMLUtil.findText(relVerEl);
        }
        Element specVerEl = findElement(runDepEl, ProjectXMLManager.SPECIFICATION_VERSION);
        if (specVerEl != null) {
            specVer = XMLUtil.findText(specVerEl);
        }
        implDep = findElement(runDepEl, ProjectXMLManager.IMPLEMENTATION_VERSION) != null;
    }
    Element compDepEl = findElement(depEl, ProjectXMLManager.COMPILE_DEPENDENCY);
    ModuleDependency newDep = new ModuleDependency(
            me, relVer, specVer, compDepEl != null, implDep);
    newDep.buildPrerequisite = findElement(depEl, ProjectXMLManager.BUILD_PREREQUISITE) != null;
    newDep.runDependency = runDepEl != null;
    return newDep;
}
 
Example 11
Source File: Classpaths.java    From netbeans with Apache License 2.0 5 votes vote down vote up
static List<String> findPackageRootNames(Element compilationUnitEl) {
    List<String> names = new ArrayList<String>();
    for (Element e : XMLUtil.findSubElements(compilationUnitEl)) {
        if (!e.getLocalName().equals("package-root")) { // NOI18N
            continue;
        }
        String location = XMLUtil.findText(e);
        names.add(location);
    }
    return names;
}
 
Example 12
Source File: ProjectXMLManager.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Remove given dependency from the configuration data. */
public void removeDependency(String cnbToRemove) {
    Element _confData = getConfData();
    Element moduleDependencies = findModuleDependencies(_confData);
    for (Element dep : XMLUtil.findSubElements(moduleDependencies)) {
        Element cnbEl = findElement(dep, ProjectXMLManager.CODE_NAME_BASE);
        String _cnb = XMLUtil.findText(cnbEl);
        if (cnbToRemove.equals(_cnb)) {
            moduleDependencies.removeChild(dep);
        }
    }
    project.putPrimaryConfigurationData(_confData);
    directDeps = null;
}
 
Example 13
Source File: JavaActions.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Try to find the compile-time classpath corresponding to a source root.
 * @param sources a source root in the project (as a virtual Ant name)
 * @return the classpath (in Ant form), or null if none was specified or there was no such source root
 */
String findCUClasspath(String sources, String moud) {
    Element compilationUnitEl = findCompilationUnit(sources);
    if (compilationUnitEl != null) {
        for (Element classpath : XMLUtil.findSubElements(compilationUnitEl)) {
            if (classpath.getLocalName().equals("classpath")) { // NOI18N
                String mode = classpath.getAttribute("mode"); // NOI18N
                if (mode.equals(moud)) {
                    return XMLUtil.findText(classpath);
                }
            }
        }
    }
    return null;
}
 
Example 14
Source File: Classpaths.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private boolean computeMatcher() {
    String incl = null;
    String excl = null;
    URI rootURI = URI.create(root.toExternalForm());
    // Annoying to duplicate logic from FreeformSources.
    // But using SourceGroup.contains is not an option since that requires FileObject creation.
    File rootFolder;
    try {
        rootFolder = Utilities.toFile(rootURI);
    } catch (IllegalArgumentException x) {
        Logger.getLogger(Classpaths.class.getName()).warning("Illegal source root: " + rootURI);
        rootFolder = null;
    }
    Element genldata = Util.getPrimaryConfigurationData(helper);
    Element foldersE = XMLUtil.findElement(genldata, "folders", Util.NAMESPACE); // NOI18N
    if (foldersE != null) {
        for (Element folderE : XMLUtil.findSubElements(foldersE)) {
            if (folderE.getLocalName().equals("source-folder")) {
                Element typeE = XMLUtil.findElement(folderE, "type", Util.NAMESPACE); // NOI18N
                if (typeE != null) {
                    String type = XMLUtil.findText(typeE);
                    if (type.equals(JavaProjectConstants.SOURCES_TYPE_JAVA)) {
                        Element locationE = XMLUtil.findElement(folderE, "location", Util.NAMESPACE); // NOI18N
                        String location = evaluator.evaluate(XMLUtil.findText(locationE));
                        if (location != null && helper.resolveFile(location).equals(rootFolder)) {
                            Element includesE = XMLUtil.findElement(folderE, "includes", Util.NAMESPACE); // NOI18N
                            if (includesE != null) {
                                incl = evaluator.evaluate(XMLUtil.findText(includesE));
                                if (incl != null && incl.matches("\\$\\{[^}]+\\}")) { // NOI18N
                                    // Clearly intended to mean "include everything".
                                    incl = null;
                                }
                            }
                            Element excludesE = XMLUtil.findElement(folderE, "excludes", Util.NAMESPACE); // NOI18N
                            if (excludesE != null) {
                                excl = evaluator.evaluate(XMLUtil.findText(excludesE));
                            }
                        }
                    }
                }
            }
        }
    }
    if (!Utilities.compareObjects(incl, includes) || !Utilities.compareObjects(excl, excludes)) {
        includes = incl;
        excludes = excl;
        matcher = new PathMatcher(incl, excl, rootFolder);
        return true;
    } else {
        if (matcher == null) {
            matcher = new PathMatcher(incl, excl, rootFolder);
        }
        return false;
    }
}
 
Example 15
Source File: FreeformProjectGenerator.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * Read custom context menu actions from project.
 * @param helper AntProjectHelper instance
 * @return list of CustomTarget instances
 */
public static List<CustomTarget> getCustomContextMenuActions(AntProjectHelper helper) {
    //assert ProjectManager.mutex().isReadAccess() || ProjectManager.mutex().isWriteAccess();
    List<CustomTarget> list = new ArrayList<CustomTarget>();
    Element genldata = Util.getPrimaryConfigurationData(helper);
    Element viewEl = XMLUtil.findElement(genldata, "view", FreeformProjectType.NS_GENERAL); // NOI18N
    if (viewEl == null) {
        return list;
    }
    Element contextMenuEl = XMLUtil.findElement(viewEl, "context-menu", FreeformProjectType.NS_GENERAL); // NOI18N
    if (contextMenuEl == null) {
        return list;
    }
    for (Element actionEl : XMLUtil.findSubElements(contextMenuEl)) {
        if (!actionEl.getLocalName().equals("action")) { // NOI18N
            continue;
        }
        CustomTarget ct = new CustomTarget();
        List<String> targetNames = new ArrayList<String>();
        EditableProperties props = new EditableProperties(false);
        for (Element subEl : XMLUtil.findSubElements(actionEl)) {
            if (subEl.getLocalName().equals("target")) { // NOI18N
                targetNames.add(XMLUtil.findText(subEl));
                continue;
            }
            if (subEl.getLocalName().equals("script")) { // NOI18N
                ct.script = XMLUtil.findText(subEl);
                continue;
            }
            if (subEl.getLocalName().equals("label")) { // NOI18N
                ct.label = XMLUtil.findText(subEl);
                continue;
            }
            if (subEl.getLocalName().equals("property")) { // NOI18N
                readProperty(subEl, props);
                continue;
            }
        }
        ct.targets = targetNames;
        if (props.keySet().size() > 0) {
            ct.properties = props;
        }
        list.add(ct);
    }
    return list;
}
 
Example 16
Source File: FreeformProjectGenerator.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private static void readProperty(Element propertyElement, EditableProperties props) {
    String key = propertyElement.getAttribute("name"); // NOI18N
    String value = XMLUtil.findText(propertyElement);
    props.setProperty(key, value);
}
 
Example 17
Source File: ProjectXMLManager.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * Gives a map from test type (e.g. <em>unit</em> or <em>qa-functional</em>)
 * to the set of {@link TestModuleDependency dependencies} belonging to it.
 */
public @NonNull Map<String, Set<TestModuleDependency>> getTestDependencies(final ModuleList ml) {
    Element testDepsEl = findTestDependenciesElement(getConfData());

    Map<String, Set<TestModuleDependency>> testDeps = new HashMap<String, Set<TestModuleDependency>>();

    if (testDepsEl != null) {
        for (Element typeEl : XMLUtil.findSubElements(testDepsEl)) {
            Element testTypeEl = findElement(typeEl, TEST_TYPE_NAME);
            String testType = null;
            if (testTypeEl != null) {
                testType = XMLUtil.findText(testTypeEl);
            }
            if (testType == null) {
                testType = TestModuleDependency.UNIT; // default variant
            }
            Set<TestModuleDependency> directTestDeps = new TreeSet<TestModuleDependency>();
            for (Element depEl : XMLUtil.findSubElements(typeEl)) {
                if (depEl.getTagName().equals(TEST_DEPENDENCY)) {
                    // parse test dep
                    Element cnbEl = findElement(depEl, TEST_DEPENDENCY_CNB);
                    boolean test = findElement(depEl, TEST_DEPENDENCY_TEST) != null;
                    String _cnb = null;
                    if (cnbEl != null) {
                        _cnb = XMLUtil.findText(cnbEl);
                    }
                    boolean recursive = findElement(depEl, TEST_DEPENDENCY_RECURSIVE) != null;
                    boolean compile = findElement(depEl, TEST_DEPENDENCY_COMPILE) != null;
                    if (_cnb != null) {
                        ModuleEntry me = ml.getEntry(_cnb);
                        if (me == null) {
                            me = new NonexistentModuleEntry(_cnb);
                        }
                            TestModuleDependency tmd = new TestModuleDependency(me, test, recursive, compile);
                            if (!directTestDeps.add(tmd)) {
                                // testdependency already exists
                                String path = project.getPathWithinNetBeansOrg();
                                if (path == null) {
                                    path = project.getProjectDirectoryFile().getAbsolutePath();
                                }
                                String msg = "Invalid project.xml (" + path + "); testdependency " // NOI18N
                                        + tmd.getModule().getCodeNameBase() + " is duplicated!"; // NOI18N
                                Util.err.log(ErrorManager.WARNING, msg);
                            }
                    }
                }
            }
            testDeps.put(testType, directTestDeps);
        }
    }
    return testDeps;
}
 
Example 18
Source File: SuiteBrandingModel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override protected String getSimpleName() {
    Element nameEl = XMLUtil.findElement(suiteProps.getProject().getHelper().getPrimaryConfigurationData(true), "name", SuiteProjectType.NAMESPACE_SHARED); // NOI18N
    String text = (nameEl != null) ? XMLUtil.findText(nameEl) : null;
    return (text != null) ? text : "???"; // NOI18N
}
 
Example 19
Source File: JavaProjectGenerator.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * Read source folders from the project.
 * @param helper AntProjectHelper instance
 * @param type type of source folders to be read. Can be null in which case
 *    all types will be read. Useful for reading one type of source folders.
 *    Source folders without type are read only when type == null.
 * @return list of SourceFolder instances; style value will be always null
 */
public static List<SourceFolder> getSourceFolders(AntProjectHelper helper, String type) {
    //assert ProjectManager.mutex().isReadAccess() || ProjectManager.mutex().isWriteAccess();
    List<SourceFolder> list = new ArrayList<SourceFolder>();
    Element data = Util.getPrimaryConfigurationData(helper);
    Element foldersEl = XMLUtil.findElement(data, "folders", Util.NAMESPACE); // NOI18N
    if (foldersEl == null) {
        return list;
    }
    for (Element sourceFolderEl : XMLUtil.findSubElements(foldersEl)) {
        if (!sourceFolderEl.getLocalName().equals("source-folder")) { // NOI18N
            continue;
        }
        SourceFolder sf = new SourceFolder();
        Element el = XMLUtil.findElement(sourceFolderEl, "label", Util.NAMESPACE); // NOI18N
        if (el != null) {
            sf.label = XMLUtil.findText(el);
        }
        el = XMLUtil.findElement(sourceFolderEl, "type", Util.NAMESPACE); // NOI18N
        if (el != null) {
            sf.type = XMLUtil.findText(el);
        }
        el = XMLUtil.findElement(sourceFolderEl, "location", Util.NAMESPACE); // NOI18N
        if (el != null) {
            sf.location = XMLUtil.findText(el);
        }
        el = XMLUtil.findElement(sourceFolderEl, "includes", Util.NAMESPACE); // NOI18N
        if (el != null) {
            sf.includes = XMLUtil.findText(el);
        }
        el = XMLUtil.findElement(sourceFolderEl, "excludes", Util.NAMESPACE); // NOI18N
        if (el != null) {
            sf.excludes = XMLUtil.findText(el);
        }
        el = XMLUtil.findElement(sourceFolderEl, "encoding", Util.NAMESPACE); // NOI18N
        if (el != null) {
            sf.encoding = XMLUtil.findText(el);
        }
        if (type == null || type.equals(sf.type)) {
            if (sf.label == null || sf.label.length() == 0) {
                throw new IllegalArgumentException("label element is empty or not specified. "+helper.getProjectDirectory()); // NOI18N
            }
            if (sf.location == null || sf.location.length() == 0) {
                throw new IllegalArgumentException("location element is empty or not specified. "+helper.getProjectDirectory()); // NOI18N
            }
            list.add(sf);
        }
    }
    return list;
}
 
Example 20
Source File: UsageLogger.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private static Object[] data(Project p) throws Exception {
    ProjectAccessor accessor = p.getLookup().lookup(ProjectAccessor.class);
    if (accessor == null) {
        throw new IllegalArgumentException("no ProjectAccessor");
    }
    AntProjectHelper helper = accessor.getHelper();
    PropertyEvaluator eval = accessor.getEvaluator();
    AuxiliaryConfiguration aux = ProjectUtils.getAuxiliaryConfiguration(p);
    int compilationUnits = 0;
    int compilationUnitsMissingBuiltTo = 0;
    int compilationUnitsMultipleRoots = 0;
    Set<String> classpathEntries = new HashSet<String>();
    Element java = JavaProjectGenerator.getJavaCompilationUnits(aux);
    if (java != null) {
        for (Element compilationUnitEl : XMLUtil.findSubElements(java)) {
            compilationUnits++;
            int builtTos = 0;
            int roots = 0;
            for (Element other : XMLUtil.findSubElements(compilationUnitEl)) {
                String name = other.getLocalName();
                if (name.equals("package-root")) { // NOI18N
                    roots++;
                } else if (name.equals("built-to")) { // NOI18N
                    builtTos++;
                } else if (name.equals("classpath")) { // NOI18N
                    String text = XMLUtil.findText(other);
                    if (text != null) {
                        String textEval = eval.evaluate(text);
                        if (textEval != null) {
                            for (String entry : textEval.split("[:;]")) {
                                if (entry.length() > 0) {
                                    classpathEntries.add(entry);
                                }
                            }
                        }
                    }
                }
            }
            if (builtTos == 0) {
                compilationUnitsMissingBuiltTo++;
            }
            if (roots > 1) {
                compilationUnitsMultipleRoots++;
            }
        }
    }
    int targets = 0;
    {
        String antScriptS = eval.getProperty(ProjectConstants.PROP_ANT_SCRIPT);
        if (antScriptS == null) {
            antScriptS = "build.xml"; // NOI18N
        }
        FileObject antScript = FileUtil.toFileObject(helper.resolveFile(antScriptS));
        if (antScript != null) {
            AntProjectCookie apc = DataObject.find(antScript).getLookup().lookup(AntProjectCookie.class);
            if (apc != null) {
                try {
                    targets = TargetLister.getTargets(apc).size();
                } catch (IOException ioe) {
                    //pass - Broken build.xml which may happen for freeform, targets = 0 and log usage
                }
            }
        }
    }
    boolean webData = aux.getConfigurationFragment("web-data", "http://www.netbeans.org/ns/freeform-project-web/2", true) != null || // NOI18N
            aux.getConfigurationFragment("web-data", "http://www.netbeans.org/ns/freeform-project-web/1", true) != null; // NOI18N
    /* XXX takes about 1msec per source file to count them, even with a warm disk cache:
    int sourceFiles = 0;
    for (SourceGroup g : ProjectUtils.getSources(p).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA)) {
        for (FileObject kid : NbCollections.iterable(g.getRootFolder().getChildren(true))) {
            if (kid.hasExt("java")) { // NOI18N
                sourceFiles++;
            }
        }
    }
     */
    // XXX other things which could be reported:
    // number of <properties>s (other than the original project location sometimes inserted by the New Project wizard) or <property-file>s defined
    // number of <view-item>s (other than those inserted by the GUI) defined
    // whether a custom Java platform is configured for the project
    // number of subprojects (i.e. classpath entries corresponding to project-owned sources)
    // number of context-sensitive actions defined
    // number of targets bound to non-context-sensitive actions
    return new Object[] { // Bundle.properties#USG_FREEFORM_PROJECT must match these fields
        someOrMany(compilationUnits),
        someOrMany(compilationUnitsMissingBuiltTo),
        someOrMany(compilationUnitsMultipleRoots),
        someOrMany(classpathEntries.size()),
        someOrMany(targets),
        webData,
    };
}