Lines 44-56
Link Here
|
44 |
import java.io.IOException; |
44 |
import java.io.IOException; |
45 |
import javax.swing.JButton; |
45 |
import javax.swing.JButton; |
46 |
import org.netbeans.spi.project.support.ant.GeneratedFilesHelper; |
46 |
import org.netbeans.spi.project.support.ant.GeneratedFilesHelper; |
47 |
import org.w3c.dom.Comment; |
|
|
48 |
import org.w3c.dom.Document; |
47 |
import org.w3c.dom.Document; |
49 |
import org.w3c.dom.Element; |
48 |
import org.w3c.dom.Element; |
50 |
import org.w3c.dom.NamedNodeMap; |
|
|
51 |
import org.w3c.dom.Node; |
52 |
import org.w3c.dom.NodeList; |
49 |
import org.w3c.dom.NodeList; |
53 |
import org.w3c.dom.Text; |
|
|
54 |
import org.openide.DialogDisplayer; |
50 |
import org.openide.DialogDisplayer; |
55 |
import org.openide.ErrorManager; |
51 |
import org.openide.ErrorManager; |
56 |
import org.openide.NotifyDescriptor; |
52 |
import org.openide.NotifyDescriptor; |
Lines 61-66
Link Here
|
61 |
import org.netbeans.spi.project.AuxiliaryConfiguration; |
57 |
import org.netbeans.spi.project.AuxiliaryConfiguration; |
62 |
import org.netbeans.spi.project.support.ant.AntProjectHelper; |
58 |
import org.netbeans.spi.project.support.ant.AntProjectHelper; |
63 |
import org.netbeans.spi.project.support.ant.EditableProperties; |
59 |
import org.netbeans.spi.project.support.ant.EditableProperties; |
|
|
60 |
import org.openide.xml.XMLUtil; |
64 |
|
61 |
|
65 |
|
62 |
|
66 |
/** |
63 |
/** |
Lines 277-283
Link Here
|
277 |
if (oldRoot != null) { |
274 |
if (oldRoot != null) { |
278 |
Document doc = oldRoot.getOwnerDocument(); |
275 |
Document doc = oldRoot.getOwnerDocument(); |
279 |
Element newRoot = doc.createElementNS (ArchiveProjectType.PROJECT_CONFIGURATION_NS,DATA); //NOI18N |
276 |
Element newRoot = doc.createElementNS (ArchiveProjectType.PROJECT_CONFIGURATION_NS,DATA); //NOI18N |
280 |
copyDocument (doc, oldRoot, newRoot); |
277 |
XMLUtil.copyDocument (doc, oldRoot, newRoot, ArchiveProjectType.PROJECT_CONFIGURATION_NS); |
281 |
Element sourceRoots = doc.createElementNS(ArchiveProjectType.PROJECT_CONFIGURATION_NS,"source-roots"); //NOI18N |
278 |
Element sourceRoots = doc.createElementNS(ArchiveProjectType.PROJECT_CONFIGURATION_NS,"source-roots"); //NOI18N |
282 |
Element root = doc.createElementNS (ArchiveProjectType.PROJECT_CONFIGURATION_NS,"root"); //NOI18N |
279 |
Element root = doc.createElementNS (ArchiveProjectType.PROJECT_CONFIGURATION_NS,"root"); //NOI18N |
283 |
root.setAttribute ("id","src.dir"); //NOI18N |
280 |
root.setAttribute ("id","src.dir"); //NOI18N |
Lines 294-300
Link Here
|
294 |
if (oldRoot != null) { |
291 |
if (oldRoot != null) { |
295 |
Document doc = oldRoot.getOwnerDocument(); |
292 |
Document doc = oldRoot.getOwnerDocument(); |
296 |
Element newRoot = doc.createElementNS (ArchiveProjectType.PROJECT_CONFIGURATION_NS,DATA); //NOI18N |
293 |
Element newRoot = doc.createElementNS (ArchiveProjectType.PROJECT_CONFIGURATION_NS,DATA); //NOI18N |
297 |
copyDocument (doc, oldRoot, newRoot); |
294 |
XMLUtil.copyDocument (doc, oldRoot, newRoot, ArchiveProjectType.PROJECT_CONFIGURATION_NS); |
298 |
cachedElement = updateMinAntVersion (newRoot, doc); |
295 |
cachedElement = updateMinAntVersion (newRoot, doc); |
299 |
} |
296 |
} |
300 |
} |
297 |
} |
Lines 317-354
Link Here
|
317 |
return cachedProperties; |
314 |
return cachedProperties; |
318 |
} |
315 |
} |
319 |
|
316 |
|
320 |
private static void copyDocument (Document doc, Element from, Element to) { |
|
|
321 |
NodeList nl = from.getChildNodes(); |
322 |
int length = nl.getLength(); |
323 |
for (int i=0; i< length; i++) { |
324 |
Node node = nl.item (i); |
325 |
Node newNode = null; |
326 |
switch (node.getNodeType()) { |
327 |
case Node.ELEMENT_NODE: |
328 |
Element oldElement = (Element) node; |
329 |
newNode = doc.createElementNS(ArchiveProjectType.PROJECT_CONFIGURATION_NS,oldElement.getTagName()); |
330 |
NamedNodeMap m = oldElement.getAttributes(); |
331 |
Element newElement = (Element) newNode; |
332 |
for (int index = 0; index < m.getLength(); index++) { |
333 |
Node attr = m.item(index); |
334 |
newElement.setAttribute(attr.getNodeName(), attr.getNodeValue()); |
335 |
} |
336 |
copyDocument(doc,oldElement,newElement); |
337 |
break; |
338 |
case Node.TEXT_NODE: |
339 |
Text oldText = (Text) node; |
340 |
newNode = doc.createTextNode(oldText.getData()); |
341 |
break; |
342 |
case Node.COMMENT_NODE: |
343 |
Comment oldComment = (Comment) node; |
344 |
newNode = doc.createComment(oldComment.getData()); |
345 |
break; |
346 |
} |
347 |
if (newNode != null) { |
348 |
to.appendChild (newNode); |
349 |
} |
350 |
} |
351 |
} |
352 |
public static final String MINIMUM_ANT_VERSION = "1.6.5"; // NOI18N |
317 |
public static final String MINIMUM_ANT_VERSION = "1.6.5"; // NOI18N |
353 |
|
318 |
|
354 |
private static Element updateMinAntVersion (final Element root, final Document doc) { |
319 |
private static Element updateMinAntVersion (final Element root, final Document doc) { |