Lines 61-66
Link Here
|
61 |
import org.netbeans.spi.project.support.ant.AntProjectHelper; |
61 |
import org.netbeans.spi.project.support.ant.AntProjectHelper; |
62 |
import org.netbeans.spi.project.support.ant.EditableProperties; |
62 |
import org.netbeans.spi.project.support.ant.EditableProperties; |
63 |
import org.netbeans.spi.project.support.ant.GeneratedFilesHelper; |
63 |
import org.netbeans.spi.project.support.ant.GeneratedFilesHelper; |
|
|
64 |
import org.openide.xml.XMLUtil; |
64 |
|
65 |
|
65 |
|
66 |
|
66 |
/** |
67 |
/** |
Lines 267-273
Link Here
|
267 |
if (oldRoot != null) { |
268 |
if (oldRoot != null) { |
268 |
Document doc = oldRoot.getOwnerDocument(); |
269 |
Document doc = oldRoot.getOwnerDocument(); |
269 |
Element newRoot = doc.createElementNS (BluejProjectType.PROJECT_CONFIGURATION_NAMESPACE,"data"); // NOI18N |
270 |
Element newRoot = doc.createElementNS (BluejProjectType.PROJECT_CONFIGURATION_NAMESPACE,"data"); // NOI18N |
270 |
copyDocument (doc, oldRoot, newRoot); |
271 |
XMLUtil.copyDocument (doc, oldRoot, newRoot, BluejProjectType.PROJECT_CONFIGURATION_NAMESPACE); |
271 |
Element sourceRoots = doc.createElementNS(BluejProjectType.PROJECT_CONFIGURATION_NAMESPACE,"source-roots"); // NOI18N |
272 |
Element sourceRoots = doc.createElementNS(BluejProjectType.PROJECT_CONFIGURATION_NAMESPACE,"source-roots"); // NOI18N |
272 |
Element root = doc.createElementNS (BluejProjectType.PROJECT_CONFIGURATION_NAMESPACE,"root"); // NOI18N |
273 |
Element root = doc.createElementNS (BluejProjectType.PROJECT_CONFIGURATION_NAMESPACE,"root"); // NOI18N |
273 |
root.setAttribute ("id","src.dir"); // NOI18N |
274 |
root.setAttribute ("id","src.dir"); // NOI18N |
Lines 284-290
Link Here
|
284 |
if (oldRoot != null) { |
285 |
if (oldRoot != null) { |
285 |
Document doc = oldRoot.getOwnerDocument(); |
286 |
Document doc = oldRoot.getOwnerDocument(); |
286 |
Element newRoot = doc.createElementNS (BluejProjectType.PROJECT_CONFIGURATION_NAMESPACE,"data"); // NOI18N |
287 |
Element newRoot = doc.createElementNS (BluejProjectType.PROJECT_CONFIGURATION_NAMESPACE,"data"); // NOI18N |
287 |
copyDocument (doc, oldRoot, newRoot); |
288 |
XMLUtil.copyDocument (doc, oldRoot, newRoot, BluejProjectType.PROJECT_CONFIGURATION_NAMESPACE); |
288 |
cachedElement = updateMinAntVersion (newRoot, doc); |
289 |
cachedElement = updateMinAntVersion (newRoot, doc); |
289 |
} |
290 |
} |
290 |
} |
291 |
} |
Lines 307-345
Link Here
|
307 |
return cachedProperties; |
308 |
return cachedProperties; |
308 |
} |
309 |
} |
309 |
|
310 |
|
310 |
private static void copyDocument (Document doc, Element from, Element to) { |
|
|
311 |
NodeList nl = from.getChildNodes(); |
312 |
int length = nl.getLength(); |
313 |
for (int i=0; i< length; i++) { |
314 |
Node node = nl.item (i); |
315 |
Node newNode = null; |
316 |
switch (node.getNodeType()) { |
317 |
case Node.ELEMENT_NODE: |
318 |
Element oldElement = (Element) node; |
319 |
newNode = doc.createElementNS(BluejProjectType.PROJECT_CONFIGURATION_NAMESPACE,oldElement.getTagName()); |
320 |
NamedNodeMap m = oldElement.getAttributes(); |
321 |
Element newElement = (Element) newNode; |
322 |
for (int index = 0; index < m.getLength(); index++) { |
323 |
Node attr = m.item(index); |
324 |
newElement.setAttribute(attr.getNodeName(), attr.getNodeValue()); |
325 |
} |
326 |
copyDocument(doc,oldElement,newElement); |
327 |
break; |
328 |
case Node.TEXT_NODE: |
329 |
Text oldText = (Text) node; |
330 |
newNode = doc.createTextNode(oldText.getData()); |
331 |
break; |
332 |
case Node.COMMENT_NODE: |
333 |
Comment oldComment = (Comment) node; |
334 |
newNode = doc.createComment(oldComment.getData()); |
335 |
break; |
336 |
} |
337 |
if (newNode != null) { |
338 |
to.appendChild (newNode); |
339 |
} |
340 |
} |
341 |
} |
342 |
|
343 |
static final String MINIMUM_ANT_VERSION = "1.6.5"; // NOI18N |
311 |
static final String MINIMUM_ANT_VERSION = "1.6.5"; // NOI18N |
344 |
|
312 |
|
345 |
private static Element updateMinAntVersion (final Element root, final Document doc) { |
313 |
private static Element updateMinAntVersion (final Element root, final Document doc) { |