Lines 53-58
Link Here
|
53 |
import org.openide.DialogDisplayer; |
53 |
import org.openide.DialogDisplayer; |
54 |
import org.openide.NotifyDescriptor; |
54 |
import org.openide.NotifyDescriptor; |
55 |
import org.openide.util.NbBundle; |
55 |
import org.openide.util.NbBundle; |
|
|
56 |
import org.openide.xml.XMLUtil; |
56 |
import org.w3c.dom.Comment; |
57 |
import org.w3c.dom.Comment; |
57 |
import org.w3c.dom.Document; |
58 |
import org.w3c.dom.Document; |
58 |
import org.w3c.dom.Element; |
59 |
import org.w3c.dom.Element; |
Lines 147-153
Link Here
|
147 |
if (oldRoot != null) { |
148 |
if (oldRoot != null) { |
148 |
Document doc = oldRoot.getOwnerDocument(); |
149 |
Document doc = oldRoot.getOwnerDocument(); |
149 |
Element newRoot = doc.createElementNS (AppClientProjectType.PROJECT_CONFIGURATION_NAMESPACE,"data"); //NOI18N |
150 |
Element newRoot = doc.createElementNS (AppClientProjectType.PROJECT_CONFIGURATION_NAMESPACE,"data"); //NOI18N |
150 |
copyDocument (doc, oldRoot, newRoot); |
151 |
XMLUtil.copyDocument (doc, oldRoot, newRoot, AppClientProjectType.PROJECT_CONFIGURATION_NAMESPACE); |
151 |
Element sourceRoots = doc.createElementNS(AppClientProjectType.PROJECT_CONFIGURATION_NAMESPACE,"source-roots"); //NOI18N |
152 |
Element sourceRoots = doc.createElementNS(AppClientProjectType.PROJECT_CONFIGURATION_NAMESPACE,"source-roots"); //NOI18N |
152 |
Element root = doc.createElementNS (AppClientProjectType.PROJECT_CONFIGURATION_NAMESPACE,"root"); //NOI18N |
153 |
Element root = doc.createElementNS (AppClientProjectType.PROJECT_CONFIGURATION_NAMESPACE,"root"); //NOI18N |
153 |
root.setAttribute ("id","src.dir"); //NOI18N |
154 |
root.setAttribute ("id","src.dir"); //NOI18N |
Lines 164-170
Link Here
|
164 |
if (oldRoot != null) { |
165 |
if (oldRoot != null) { |
165 |
Document doc = oldRoot.getOwnerDocument(); |
166 |
Document doc = oldRoot.getOwnerDocument(); |
166 |
Element newRoot = doc.createElementNS (AppClientProjectType.PROJECT_CONFIGURATION_NAMESPACE,"data"); //NOI18N |
167 |
Element newRoot = doc.createElementNS (AppClientProjectType.PROJECT_CONFIGURATION_NAMESPACE,"data"); //NOI18N |
167 |
copyDocument (doc, oldRoot, newRoot); |
168 |
XMLUtil.copyDocument (doc, oldRoot, newRoot, AppClientProjectType.PROJECT_CONFIGURATION_NAMESPACE); |
168 |
cachedElement = updateMinAntVersion (newRoot, doc); |
169 |
cachedElement = updateMinAntVersion (newRoot, doc); |
169 |
} |
170 |
} |
170 |
} |
171 |
} |
Lines 187-225
Link Here
|
187 |
return cachedProperties; |
188 |
return cachedProperties; |
188 |
} |
189 |
} |
189 |
|
190 |
|
190 |
private static void copyDocument (Document doc, Element from, Element to) { |
|
|
191 |
NodeList nl = from.getChildNodes(); |
192 |
int length = nl.getLength(); |
193 |
for (int i=0; i< length; i++) { |
194 |
Node node = nl.item (i); |
195 |
Node newNode = null; |
196 |
switch (node.getNodeType()) { |
197 |
case Node.ELEMENT_NODE: |
198 |
Element oldElement = (Element) node; |
199 |
newNode = doc.createElementNS(AppClientProjectType.PROJECT_CONFIGURATION_NAMESPACE,oldElement.getTagName()); |
200 |
NamedNodeMap m = oldElement.getAttributes(); |
201 |
Element newElement = (Element) newNode; |
202 |
for (int index = 0; index < m.getLength(); index++) { |
203 |
Node attr = m.item(index); |
204 |
newElement.setAttribute(attr.getNodeName(), attr.getNodeValue()); |
205 |
} |
206 |
copyDocument(doc,oldElement,newElement); |
207 |
break; |
208 |
case Node.TEXT_NODE: |
209 |
Text oldText = (Text) node; |
210 |
newNode = doc.createTextNode(oldText.getData()); |
211 |
break; |
212 |
case Node.COMMENT_NODE: |
213 |
Comment oldComment = (Comment) node; |
214 |
newNode = doc.createComment(oldComment.getData()); |
215 |
break; |
216 |
} |
217 |
if (newNode != null) { |
218 |
to.appendChild (newNode); |
219 |
} |
220 |
} |
221 |
} |
222 |
|
223 |
private static Element updateMinAntVersion (final Element root, final Document doc) { |
191 |
private static Element updateMinAntVersion (final Element root, final Document doc) { |
224 |
NodeList list = root.getElementsByTagNameNS (AppClientProjectType.PROJECT_CONFIGURATION_NAMESPACE,MINIMUM_ANT_VERSION_ELEMENT); |
192 |
NodeList list = root.getElementsByTagNameNS (AppClientProjectType.PROJECT_CONFIGURATION_NAMESPACE,MINIMUM_ANT_VERSION_ELEMENT); |
225 |
if (list.getLength() == 1) { |
193 |
if (list.getLength() == 1) { |