Lines 218-226
Link Here
|
218 |
} else { |
218 |
} else { |
219 |
ml = ModuleList.getModuleList(prjDirF); |
219 |
ml = ModuleList.getModuleList(prjDirF); |
220 |
} |
220 |
} |
221 |
for (Element depEl : Util.findSubElements(moduleDependencies)) { |
221 |
for (Element depEl : XMLUtil.findSubElements(moduleDependencies)) { |
222 |
Element cnbEl = findElement(depEl, ProjectXMLManager.CODE_NAME_BASE); |
222 |
Element cnbEl = findElement(depEl, ProjectXMLManager.CODE_NAME_BASE); |
223 |
String _cnb = Util.findText(cnbEl); |
223 |
String _cnb = XMLUtil.findText(cnbEl); |
224 |
ModuleDependency depToAdd = getModuleDependency(_cnb, ml, depEl); |
224 |
ModuleDependency depToAdd = getModuleDependency(_cnb, ml, depEl); |
225 |
if (depToAdd == null) { |
225 |
if (depToAdd == null) { |
226 |
continue; |
226 |
continue; |
Lines 255-267
Link Here
|
255 |
Element relVerEl = findElement(runDepEl, ProjectXMLManager.RELEASE_VERSION); |
255 |
Element relVerEl = findElement(runDepEl, ProjectXMLManager.RELEASE_VERSION); |
256 |
String relVer = null; |
256 |
String relVer = null; |
257 |
if (relVerEl != null) { |
257 |
if (relVerEl != null) { |
258 |
relVer = Util.findText(relVerEl); |
258 |
relVer = XMLUtil.findText(relVerEl); |
259 |
} |
259 |
} |
260 |
|
260 |
|
261 |
Element specVerEl = findElement(runDepEl, ProjectXMLManager.SPECIFICATION_VERSION); |
261 |
Element specVerEl = findElement(runDepEl, ProjectXMLManager.SPECIFICATION_VERSION); |
262 |
String specVer = null; |
262 |
String specVer = null; |
263 |
if (specVerEl != null) { |
263 |
if (specVerEl != null) { |
264 |
specVer = Util.findText(specVerEl); |
264 |
specVer = XMLUtil.findText(specVerEl); |
265 |
} |
265 |
} |
266 |
|
266 |
|
267 |
Element compDepEl = findElement(depEl, ProjectXMLManager.COMPILE_DEPENDENCY); |
267 |
Element compDepEl = findElement(depEl, ProjectXMLManager.COMPILE_DEPENDENCY); |
Lines 287-295
Link Here
|
287 |
} else { |
287 |
} else { |
288 |
ml = ModuleList.getModuleList(prjDirF); |
288 |
ml = ModuleList.getModuleList(prjDirF); |
289 |
} |
289 |
} |
290 |
for (Element dep : Util.findSubElements(moduleDependencies)) { |
290 |
for (Element dep : XMLUtil.findSubElements(moduleDependencies)) { |
291 |
Element cnbEl = findElement(dep, ProjectXMLManager.CODE_NAME_BASE); |
291 |
Element cnbEl = findElement(dep, ProjectXMLManager.CODE_NAME_BASE); |
292 |
String depCnb = Util.findText(cnbEl); |
292 |
String depCnb = XMLUtil.findText(cnbEl); |
293 |
if (depCnb.equals(cnb)) { |
293 |
if (depCnb.equals(cnb)) { |
294 |
return getModuleDependency(cnb, ml, dep); |
294 |
return getModuleDependency(cnb, ml, dep); |
295 |
} |
295 |
} |
Lines 301-309
Link Here
|
301 |
public void removeDependency(String cnbToRemove) { |
301 |
public void removeDependency(String cnbToRemove) { |
302 |
Element _confData = getConfData(); |
302 |
Element _confData = getConfData(); |
303 |
Element moduleDependencies = findModuleDependencies(_confData); |
303 |
Element moduleDependencies = findModuleDependencies(_confData); |
304 |
for (Element dep : Util.findSubElements(moduleDependencies)) { |
304 |
for (Element dep : XMLUtil.findSubElements(moduleDependencies)) { |
305 |
Element cnbEl = findElement(dep, ProjectXMLManager.CODE_NAME_BASE); |
305 |
Element cnbEl = findElement(dep, ProjectXMLManager.CODE_NAME_BASE); |
306 |
String _cnb = Util.findText(cnbEl); |
306 |
String _cnb = XMLUtil.findText(cnbEl); |
307 |
if (cnbToRemove.equals(_cnb)) { |
307 |
if (cnbToRemove.equals(_cnb)) { |
308 |
moduleDependencies.removeChild(dep); |
308 |
moduleDependencies.removeChild(dep); |
309 |
} |
309 |
} |
Lines 330-338
Link Here
|
330 |
public void removeDependenciesByCNB(Collection<String> cnbsToDelete) { |
330 |
public void removeDependenciesByCNB(Collection<String> cnbsToDelete) { |
331 |
Element _confData = getConfData(); |
331 |
Element _confData = getConfData(); |
332 |
Element moduleDependencies = findModuleDependencies(_confData); |
332 |
Element moduleDependencies = findModuleDependencies(_confData); |
333 |
for (Element dep : Util.findSubElements(moduleDependencies)) { |
333 |
for (Element dep : XMLUtil.findSubElements(moduleDependencies)) { |
334 |
Element cnbEl = findElement(dep, ProjectXMLManager.CODE_NAME_BASE); |
334 |
Element cnbEl = findElement(dep, ProjectXMLManager.CODE_NAME_BASE); |
335 |
String _cnb = Util.findText(cnbEl); |
335 |
String _cnb = XMLUtil.findText(cnbEl); |
336 |
if (cnbsToDelete.remove(_cnb)) { |
336 |
if (cnbsToDelete.remove(_cnb)) { |
337 |
moduleDependencies.removeChild(dep); |
337 |
moduleDependencies.removeChild(dep); |
338 |
} |
338 |
} |
Lines 350-360
Link Here
|
350 |
public void editDependency(ModuleDependency origDep, ModuleDependency newDep) { |
350 |
public void editDependency(ModuleDependency origDep, ModuleDependency newDep) { |
351 |
Element _confData = getConfData(); |
351 |
Element _confData = getConfData(); |
352 |
Element moduleDependencies = findModuleDependencies(_confData); |
352 |
Element moduleDependencies = findModuleDependencies(_confData); |
353 |
List<Element> currentDeps = Util.findSubElements(moduleDependencies); |
353 |
List<Element> currentDeps = XMLUtil.findSubElements(moduleDependencies); |
354 |
for (Iterator<Element> it = currentDeps.iterator(); it.hasNext();) { |
354 |
for (Iterator<Element> it = currentDeps.iterator(); it.hasNext();) { |
355 |
Element dep = it.next(); |
355 |
Element dep = it.next(); |
356 |
Element cnbEl = findElement(dep, ProjectXMLManager.CODE_NAME_BASE); |
356 |
Element cnbEl = findElement(dep, ProjectXMLManager.CODE_NAME_BASE); |
357 |
String _cnb = Util.findText(cnbEl); |
357 |
String _cnb = XMLUtil.findText(cnbEl); |
358 |
if (_cnb.equals(origDep.getModuleEntry().getCodeNameBase())) { |
358 |
if (_cnb.equals(origDep.getModuleEntry().getCodeNameBase())) { |
359 |
moduleDependencies.removeChild(dep); |
359 |
moduleDependencies.removeChild(dep); |
360 |
Element nextDep = it.hasNext() ? it.next() : null; |
360 |
Element nextDep = it.hasNext() ? it.next() : null; |
Lines 474-494
Link Here
|
474 |
Element _confData = getConfData(); |
474 |
Element _confData = getConfData(); |
475 |
Element testModuleDependenciesEl = findTestDependenciesElement(_confData); |
475 |
Element testModuleDependenciesEl = findTestDependenciesElement(_confData); |
476 |
Element testTypeRemoveEl = null; |
476 |
Element testTypeRemoveEl = null; |
477 |
for (Element type : Util.findSubElements(testModuleDependenciesEl)) { |
477 |
for (Element type : XMLUtil.findSubElements(testModuleDependenciesEl)) { |
478 |
Element nameEl = findElement(type, TEST_TYPE_NAME); |
478 |
Element nameEl = findElement(type, TEST_TYPE_NAME); |
479 |
String nameOfType = Util.findText(nameEl); |
479 |
String nameOfType = XMLUtil.findText(nameEl); |
480 |
if (testType.equals(nameOfType)) { |
480 |
if (testType.equals(nameOfType)) { |
481 |
testTypeRemoveEl = type; |
481 |
testTypeRemoveEl = type; |
482 |
} |
482 |
} |
483 |
} |
483 |
} |
484 |
//found such a test type |
484 |
//found such a test type |
485 |
if (testTypeRemoveEl != null) { |
485 |
if (testTypeRemoveEl != null) { |
486 |
for (Element el : Util.findSubElements(testTypeRemoveEl)) { |
486 |
for (Element el : XMLUtil.findSubElements(testTypeRemoveEl)) { |
487 |
Element cnbEl = findElement(el, TEST_DEPENDENCY_CNB); |
487 |
Element cnbEl = findElement(el, TEST_DEPENDENCY_CNB); |
488 |
if (cnbEl == null) { |
488 |
if (cnbEl == null) { |
489 |
continue; //name node, continue |
489 |
continue; //name node, continue |
490 |
} |
490 |
} |
491 |
String _cnb = Util.findText(cnbEl); |
491 |
String _cnb = XMLUtil.findText(cnbEl); |
492 |
if (cnbToRemove.equals(_cnb)) { |
492 |
if (cnbToRemove.equals(_cnb)) { |
493 |
// found test dependency with desired CNB |
493 |
// found test dependency with desired CNB |
494 |
testTypeRemoveEl.removeChild(el); |
494 |
testTypeRemoveEl.removeChild(el); |
Lines 542-548
Link Here
|
542 |
} |
542 |
} |
543 |
Element testTypeEl = null; |
543 |
Element testTypeEl = null; |
544 |
//iterate through test types to determine if testType exist |
544 |
//iterate through test types to determine if testType exist |
545 |
for (Element tt : Util.findSubElements(testModuleDependenciesEl)) { |
545 |
for (Element tt : XMLUtil.findSubElements(testModuleDependenciesEl)) { |
546 |
Node nameNode = findElement(tt, "name"); // NOI18N |
546 |
Node nameNode = findElement(tt, "name"); // NOI18N |
547 |
assert nameNode != null : "should be some child with name"; |
547 |
assert nameNode != null : "should be some child with name"; |
548 |
//Node nameNode = tt.getFirstChild(); |
548 |
//Node nameNode = tt.getFirstChild(); |
Lines 638-661
Link Here
|
638 |
Map<String, Set<TestModuleDependency>> testDeps = new HashMap<String, Set<TestModuleDependency>>(); |
638 |
Map<String, Set<TestModuleDependency>> testDeps = new HashMap<String, Set<TestModuleDependency>>(); |
639 |
|
639 |
|
640 |
if (testDepsEl != null) { |
640 |
if (testDepsEl != null) { |
641 |
for (Element typeEl : Util.findSubElements(testDepsEl)) { |
641 |
for (Element typeEl : XMLUtil.findSubElements(testDepsEl)) { |
642 |
Element testTypeEl = findElement(typeEl, TEST_TYPE_NAME); |
642 |
Element testTypeEl = findElement(typeEl, TEST_TYPE_NAME); |
643 |
String testType = null; |
643 |
String testType = null; |
644 |
if (testTypeEl != null) { |
644 |
if (testTypeEl != null) { |
645 |
testType = Util.findText(testTypeEl); |
645 |
testType = XMLUtil.findText(testTypeEl); |
646 |
} |
646 |
} |
647 |
if (testType == null) { |
647 |
if (testType == null) { |
648 |
testType = TestModuleDependency.UNIT; // default variant |
648 |
testType = TestModuleDependency.UNIT; // default variant |
649 |
} |
649 |
} |
650 |
Set<TestModuleDependency> directTestDeps = new TreeSet<TestModuleDependency>(); |
650 |
Set<TestModuleDependency> directTestDeps = new TreeSet<TestModuleDependency>(); |
651 |
for (Element depEl : Util.findSubElements(typeEl)) { |
651 |
for (Element depEl : XMLUtil.findSubElements(typeEl)) { |
652 |
if (depEl.getTagName().equals(TEST_DEPENDENCY)) { |
652 |
if (depEl.getTagName().equals(TEST_DEPENDENCY)) { |
653 |
// parse test dep |
653 |
// parse test dep |
654 |
Element cnbEl = findElement(depEl, TEST_DEPENDENCY_CNB); |
654 |
Element cnbEl = findElement(depEl, TEST_DEPENDENCY_CNB); |
655 |
boolean test = findElement(depEl, TEST_DEPENDENCY_TEST) != null; |
655 |
boolean test = findElement(depEl, TEST_DEPENDENCY_TEST) != null; |
656 |
String _cnb = null; |
656 |
String _cnb = null; |
657 |
if (cnbEl != null) { |
657 |
if (cnbEl != null) { |
658 |
_cnb = Util.findText(cnbEl); |
658 |
_cnb = XMLUtil.findText(cnbEl); |
659 |
} |
659 |
} |
660 |
boolean recursive = findElement(depEl, TEST_DEPENDENCY_RECURSIVE) != null; |
660 |
boolean recursive = findElement(depEl, TEST_DEPENDENCY_RECURSIVE) != null; |
661 |
boolean compile = findElement(depEl, TEST_DEPENDENCY_COMPILE) != null; |
661 |
boolean compile = findElement(depEl, TEST_DEPENDENCY_COMPILE) != null; |
Lines 806-817
Link Here
|
806 |
return Collections.unmodifiableMap(cpExtensions); |
806 |
return Collections.unmodifiableMap(cpExtensions); |
807 |
} |
807 |
} |
808 |
Map<String, String> cps = new HashMap<String, String>(); |
808 |
Map<String, String> cps = new HashMap<String, String>(); |
809 |
for (Element cpExtEl : Util.findSubElements(getConfData())) { |
809 |
for (Element cpExtEl : XMLUtil.findSubElements(getConfData())) { |
810 |
if (CLASS_PATH_EXTENSION.equals(cpExtEl.getTagName())) { |
810 |
if (CLASS_PATH_EXTENSION.equals(cpExtEl.getTagName())) { |
811 |
Element binOrigEl = findElement(cpExtEl, BINARY_ORIGIN); |
811 |
Element binOrigEl = findElement(cpExtEl, BINARY_ORIGIN); |
812 |
Element runtimePathEl = findElement(cpExtEl, CLASS_PATH_RUNTIME_PATH); |
812 |
Element runtimePathEl = findElement(cpExtEl, CLASS_PATH_RUNTIME_PATH); |
813 |
if (binOrigEl != null && runtimePathEl != null) { |
813 |
if (binOrigEl != null && runtimePathEl != null) { |
814 |
cps.put(Util.findText(runtimePathEl), Util.findText(binOrigEl)); |
814 |
cps.put(XMLUtil.findText(runtimePathEl), XMLUtil.findText(binOrigEl)); |
815 |
} |
815 |
} |
816 |
} |
816 |
} |
817 |
} |
817 |
} |
Lines 822-828
Link Here
|
822 |
public String getCodeNameBase() { |
822 |
public String getCodeNameBase() { |
823 |
if (cnb == null) { |
823 |
if (cnb == null) { |
824 |
Element cnbEl = findElement(getConfData(), ProjectXMLManager.CODE_NAME_BASE); |
824 |
Element cnbEl = findElement(getConfData(), ProjectXMLManager.CODE_NAME_BASE); |
825 |
cnb = Util.findText(cnbEl); |
825 |
cnb = XMLUtil.findText(cnbEl); |
826 |
} |
826 |
} |
827 |
return cnb; |
827 |
return cnb; |
828 |
} |
828 |
} |
Lines 875-881
Link Here
|
875 |
} |
875 |
} |
876 |
|
876 |
|
877 |
private static Element findElement(Element parentEl, String elementName) { |
877 |
private static Element findElement(Element parentEl, String elementName) { |
878 |
return Util.findElement(parentEl, elementName, NbModuleProject.NAMESPACE_SHARED); |
878 |
return XMLUtil.findElement(parentEl, elementName, NbModuleProject.NAMESPACE_SHARED); |
879 |
} |
879 |
} |
880 |
|
880 |
|
881 |
/** Package-private for unit tests only. */ |
881 |
/** Package-private for unit tests only. */ |
Lines 922-932
Link Here
|
922 |
*/ |
922 |
*/ |
923 |
private static Set<ManifestManager.PackageExport> findAllPackages(Element parent) { |
923 |
private static Set<ManifestManager.PackageExport> findAllPackages(Element parent) { |
924 |
Set<ManifestManager.PackageExport> packages = new HashSet<ManifestManager.PackageExport>(); |
924 |
Set<ManifestManager.PackageExport> packages = new HashSet<ManifestManager.PackageExport>(); |
925 |
for (Element pkgEl : Util.findSubElements(parent)) { |
925 |
for (Element pkgEl : XMLUtil.findSubElements(parent)) { |
926 |
if (PACKAGE.equals(pkgEl.getTagName())) { |
926 |
if (PACKAGE.equals(pkgEl.getTagName())) { |
927 |
packages.add(new ManifestManager.PackageExport(Util.findText(pkgEl), false)); |
927 |
packages.add(new ManifestManager.PackageExport(XMLUtil.findText(pkgEl), false)); |
928 |
} else if (SUBPACKAGES.equals(pkgEl.getTagName())) { |
928 |
} else if (SUBPACKAGES.equals(pkgEl.getTagName())) { |
929 |
packages.add(new ManifestManager.PackageExport(Util.findText(pkgEl), true)); |
929 |
packages.add(new ManifestManager.PackageExport(XMLUtil.findText(pkgEl), true)); |
930 |
} |
930 |
} |
931 |
} |
931 |
} |
932 |
return packages; |
932 |
return packages; |
Lines 958-966
Link Here
|
958 |
Element friendsEl = findFriendsElement(confData); |
958 |
Element friendsEl = findFriendsElement(confData); |
959 |
if (friendsEl != null) { |
959 |
if (friendsEl != null) { |
960 |
Set<String> friends = new TreeSet<String>(); |
960 |
Set<String> friends = new TreeSet<String>(); |
961 |
for (Element friendEl : Util.findSubElements(friendsEl)) { |
961 |
for (Element friendEl : XMLUtil.findSubElements(friendsEl)) { |
962 |
if (FRIEND.equals(friendEl.getTagName())) { |
962 |
if (FRIEND.equals(friendEl.getTagName())) { |
963 |
friends.add(Util.findText(friendEl)); |
963 |
friends.add(XMLUtil.findText(friendEl)); |
964 |
} |
964 |
} |
965 |
} |
965 |
} |
966 |
return friends.toArray(new String[friends.size()]); |
966 |
return friends.toArray(new String[friends.size()]); |