This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 136595
Collapse All | Expand All

(-)a/profiler.nbmodule/src/org/netbeans/modules/profiler/nbmodule/NbModuleProjectTypeProfiler.java (-30 / +3 lines)
Lines 60-65 Link Here
60
import org.netbeans.lib.profiler.common.Profiler;
60
import org.netbeans.lib.profiler.common.Profiler;
61
import org.netbeans.lib.profiler.common.integration.IntegrationUtils;
61
import org.netbeans.lib.profiler.common.integration.IntegrationUtils;
62
import org.netbeans.modules.profiler.projectsupport.utilities.SourceUtils;
62
import org.netbeans.modules.profiler.projectsupport.utilities.SourceUtils;
63
import org.openide.xml.XMLUtil;
63
import org.w3c.dom.Node;
64
import org.w3c.dom.Node;
64
import org.w3c.dom.NodeList;
65
import org.w3c.dom.NodeList;
65
66
Lines 258-298 Link Here
258
        }
259
        }
259
        
260
        
260
        // Module is a NB module suite component, not a NB source module
261
        // Module is a NB module suite component, not a NB source module
261
        if (findElement(e, "suite-component", namespace) != null) return false; // NOI18N
262
        if (XMLUtil.findElement(e, "suite-component", namespace) != null) return false; // NOI18N
262
        
263
        
263
        // Module is a NB module suite component, not a NB source module
264
        // Module is a NB module suite component, not a NB source module
264
        if (findElement(e, "standalone", namespace) != null) return false; // NOI18N
265
        if (XMLUtil.findElement(e, "standalone", namespace) != null) return false; // NOI18N
265
        
266
        
266
        // Module is a NB source module (neither suite component nor standalone)
267
        // Module is a NB source module (neither suite component nor standalone)
267
        return true;
268
        return true;
268
    }
269
    }
269
    
270
    
270
    // COPIED FROM org.netbeans.modules.project.ant:
271
    // (except for namespace == null support in findElement)
272
    // (and support for comments in findSubElements)
273
    
274
    /**
275
     * Search for an XML element in the direct children of a parent.
276
     * DOM provides a similar method but it does a recursive search
277
     * which we do not want. It also gives a node list and we want
278
     * only one result.
279
     * @param parent a parent element
280
     * @param name the intended local name
281
     * @param namespace the intended namespace (or null)
282
     * @return the first child element with that name, or null if none
283
     */
284
    private static Element findElement(Element parent, String name, String namespace) {
285
        NodeList l = parent.getChildNodes();
286
        for (int i = 0; i < l.getLength(); i++) {
287
            if (l.item(i).getNodeType() == Node.ELEMENT_NODE) {
288
                Element el = (Element)l.item(i);
289
                if ((namespace == null && name.equals(el.getTagName())) ||
290
                        (namespace != null && name.equals(el.getLocalName()) &&
291
                        namespace.equals(el.getNamespaceURI()))) {
292
                    return el;
293
                }
294
            }
295
        }
296
        return null;
297
    }
298
}
271
}

Return to bug 136595