Lines 53-65
Link Here
|
53 |
import org.openide.NotifyDescriptor; |
53 |
import org.openide.NotifyDescriptor; |
54 |
import org.openide.util.Mutex; |
54 |
import org.openide.util.Mutex; |
55 |
import org.openide.util.NbBundle; |
55 |
import org.openide.util.NbBundle; |
56 |
import org.w3c.dom.Comment; |
56 |
import org.openide.xml.XMLUtil; |
57 |
import org.w3c.dom.Document; |
57 |
import org.w3c.dom.Document; |
58 |
import org.w3c.dom.Element; |
58 |
import org.w3c.dom.Element; |
59 |
import org.w3c.dom.NamedNodeMap; |
|
|
60 |
import org.w3c.dom.Node; |
59 |
import org.w3c.dom.Node; |
61 |
import org.w3c.dom.NodeList; |
60 |
import org.w3c.dom.NodeList; |
62 |
import org.w3c.dom.Text; |
|
|
63 |
|
61 |
|
64 |
/** |
62 |
/** |
65 |
* |
63 |
* |
Lines 153-159
Link Here
|
153 |
if (oldRoot != null) { |
151 |
if (oldRoot != null) { |
154 |
Document doc = oldRoot.getOwnerDocument(); |
152 |
Document doc = oldRoot.getOwnerDocument(); |
155 |
Element newRoot = doc.createElementNS (J2SEProjectType.PROJECT_CONFIGURATION_NAMESPACE,"data"); //NOI18N |
153 |
Element newRoot = doc.createElementNS (J2SEProjectType.PROJECT_CONFIGURATION_NAMESPACE,"data"); //NOI18N |
156 |
copyDocument (doc, oldRoot, newRoot); |
154 |
XMLUtil.copyDocument (doc, oldRoot, newRoot, J2SEProjectType.PROJECT_CONFIGURATION_NAMESPACE); |
157 |
Element sourceRoots = doc.createElementNS(J2SEProjectType.PROJECT_CONFIGURATION_NAMESPACE,"source-roots"); //NOI18N |
155 |
Element sourceRoots = doc.createElementNS(J2SEProjectType.PROJECT_CONFIGURATION_NAMESPACE,"source-roots"); //NOI18N |
158 |
Element root = doc.createElementNS (J2SEProjectType.PROJECT_CONFIGURATION_NAMESPACE,"root"); //NOI18N |
156 |
Element root = doc.createElementNS (J2SEProjectType.PROJECT_CONFIGURATION_NAMESPACE,"root"); //NOI18N |
159 |
root.setAttribute ("id","src.dir"); //NOI18N |
157 |
root.setAttribute ("id","src.dir"); //NOI18N |
Lines 170-176
Link Here
|
170 |
if (oldRoot != null) { |
168 |
if (oldRoot != null) { |
171 |
Document doc = oldRoot.getOwnerDocument(); |
169 |
Document doc = oldRoot.getOwnerDocument(); |
172 |
Element newRoot = doc.createElementNS (J2SEProjectType.PROJECT_CONFIGURATION_NAMESPACE,"data"); //NOI18N |
170 |
Element newRoot = doc.createElementNS (J2SEProjectType.PROJECT_CONFIGURATION_NAMESPACE,"data"); //NOI18N |
173 |
copyDocument (doc, oldRoot, newRoot); |
171 |
XMLUtil.copyDocument (doc, oldRoot, newRoot, J2SEProjectType.PROJECT_CONFIGURATION_NAMESPACE); |
174 |
cachedElement = newRoot; |
172 |
cachedElement = newRoot; |
175 |
} |
173 |
} |
176 |
} |
174 |
} |
Lines 203-241
Link Here
|
203 |
} |
201 |
} |
204 |
} |
202 |
} |
205 |
|
203 |
|
206 |
private static void copyDocument (Document doc, Element from, Element to) { |
|
|
207 |
NodeList nl = from.getChildNodes(); |
208 |
int length = nl.getLength(); |
209 |
for (int i=0; i< length; i++) { |
210 |
Node node = nl.item (i); |
211 |
Node newNode = null; |
212 |
switch (node.getNodeType()) { |
213 |
case Node.ELEMENT_NODE: |
214 |
Element oldElement = (Element) node; |
215 |
newNode = doc.createElementNS(J2SEProjectType.PROJECT_CONFIGURATION_NAMESPACE,oldElement.getTagName()); |
216 |
NamedNodeMap m = oldElement.getAttributes(); |
217 |
Element newElement = (Element) newNode; |
218 |
for (int index = 0; index < m.getLength(); index++) { |
219 |
Node attr = m.item(index); |
220 |
newElement.setAttribute(attr.getNodeName(), attr.getNodeValue()); |
221 |
} |
222 |
copyDocument(doc,oldElement,newElement); |
223 |
break; |
224 |
case Node.TEXT_NODE: |
225 |
Text oldText = (Text) node; |
226 |
newNode = doc.createTextNode(oldText.getData()); |
227 |
break; |
228 |
case Node.COMMENT_NODE: |
229 |
Comment oldComment = (Comment) node; |
230 |
newNode = doc.createComment(oldComment.getData()); |
231 |
break; |
232 |
} |
233 |
if (newNode != null) { |
234 |
to.appendChild (newNode); |
235 |
} |
236 |
} |
237 |
} |
238 |
|
239 |
private static void deleteMinAntVersion(final Element root) { |
204 |
private static void deleteMinAntVersion(final Element root) { |
240 |
NodeList list = root.getElementsByTagNameNS (J2SEProjectType.PROJECT_CONFIGURATION_NAMESPACE,MINIMUM_ANT_VERSION_ELEMENT); |
205 |
NodeList list = root.getElementsByTagNameNS (J2SEProjectType.PROJECT_CONFIGURATION_NAMESPACE,MINIMUM_ANT_VERSION_ELEMENT); |
241 |
if (list.getLength() == 1) { |
206 |
if (list.getLength() == 1) { |