Lines 278-284
Link Here
|
278 |
// if (oldRoot != null) { |
278 |
// if (oldRoot != null) { |
279 |
// Document doc = oldRoot.getOwnerDocument(); |
279 |
// Document doc = oldRoot.getOwnerDocument(); |
280 |
// Element newRoot = doc.createElementNS (RubyProjectType.PROJECT_CONFIGURATION_NAMESPACE,"data"); //NOI18N |
280 |
// Element newRoot = doc.createElementNS (RubyProjectType.PROJECT_CONFIGURATION_NAMESPACE,"data"); //NOI18N |
281 |
// copyDocument (doc, oldRoot, newRoot); |
281 |
// XMLUtil.copyDocument (doc, oldRoot, newRoot); |
282 |
// Element sourceRoots = doc.createElementNS(RubyProjectType.PROJECT_CONFIGURATION_NAMESPACE,"source-roots"); //NOI18N |
282 |
// Element sourceRoots = doc.createElementNS(RubyProjectType.PROJECT_CONFIGURATION_NAMESPACE,"source-roots"); //NOI18N |
283 |
// Element root = doc.createElementNS (RubyProjectType.PROJECT_CONFIGURATION_NAMESPACE,"root"); //NOI18N |
283 |
// Element root = doc.createElementNS (RubyProjectType.PROJECT_CONFIGURATION_NAMESPACE,"root"); //NOI18N |
284 |
// root.setAttribute ("id","src.dir"); //NOI18N |
284 |
// root.setAttribute ("id","src.dir"); //NOI18N |
Lines 295-301
Link Here
|
295 |
// if (oldRoot != null) { |
295 |
// if (oldRoot != null) { |
296 |
// Document doc = oldRoot.getOwnerDocument(); |
296 |
// Document doc = oldRoot.getOwnerDocument(); |
297 |
// Element newRoot = doc.createElementNS (RubyProjectType.PROJECT_CONFIGURATION_NAMESPACE,"data"); //NOI18N |
297 |
// Element newRoot = doc.createElementNS (RubyProjectType.PROJECT_CONFIGURATION_NAMESPACE,"data"); //NOI18N |
298 |
// copyDocument (doc, oldRoot, newRoot); |
298 |
// XMLUtil.copyDocument (doc, oldRoot, newRoot); |
299 |
// cachedElement = updateMinAntVersion (newRoot, doc); |
299 |
// cachedElement = updateMinAntVersion (newRoot, doc); |
300 |
// } |
300 |
// } |
301 |
// } |
301 |
// } |
Lines 308-346
Link Here
|
308 |
return cachedProperties; |
308 |
return cachedProperties; |
309 |
} |
309 |
} |
310 |
|
310 |
|
311 |
private static void copyDocument(Document doc, Element from, Element to, String projectConfigurationNamespace) { |
|
|
312 |
NodeList nl = from.getChildNodes(); |
313 |
int length = nl.getLength(); |
314 |
for (int i=0; i< length; i++) { |
315 |
Node node = nl.item (i); |
316 |
Node newNode = null; |
317 |
switch (node.getNodeType()) { |
318 |
case Node.ELEMENT_NODE: |
319 |
Element oldElement = (Element) node; |
320 |
newNode = doc.createElementNS(projectConfigurationNamespace, oldElement.getTagName()); |
321 |
NamedNodeMap m = oldElement.getAttributes(); |
322 |
Element newElement = (Element) newNode; |
323 |
for (int index = 0; index < m.getLength(); index++) { |
324 |
Node attr = m.item(index); |
325 |
newElement.setAttribute(attr.getNodeName(), attr.getNodeValue()); |
326 |
} |
327 |
copyDocument(doc, oldElement, newElement, projectConfigurationNamespace); |
328 |
break; |
329 |
case Node.TEXT_NODE: |
330 |
Text oldText = (Text) node; |
331 |
newNode = doc.createTextNode(oldText.getData()); |
332 |
break; |
333 |
case Node.COMMENT_NODE: |
334 |
Comment oldComment = (Comment) node; |
335 |
newNode = doc.createComment(oldComment.getData()); |
336 |
break; |
337 |
} |
338 |
if (newNode != null) { |
339 |
to.appendChild (newNode); |
340 |
} |
341 |
} |
342 |
} |
343 |
|
344 |
// private static Element updateMinAntVersion (final Element root, final Document doc) { |
311 |
// private static Element updateMinAntVersion (final Element root, final Document doc) { |
345 |
// NodeList list = root.getElementsByTagNameNS (RubyProjectType.PROJECT_CONFIGURATION_NAMESPACE,MINIMUM_ANT_VERSION_ELEMENT); |
312 |
// NodeList list = root.getElementsByTagNameNS (RubyProjectType.PROJECT_CONFIGURATION_NAMESPACE,MINIMUM_ANT_VERSION_ELEMENT); |
346 |
// if (list.getLength() == 1) { |
313 |
// if (list.getLength() == 1) { |