mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-09 19:43:27 +02:00
fixed target saving in .cdtproject
This commit is contained in:
parent
e6f4fa5890
commit
8ccea9c408
1 changed files with 24 additions and 18 deletions
|
@ -238,15 +238,17 @@ public class ProjectTargets {
|
||||||
NodeList kids = rootElement.getChildNodes();
|
NodeList kids = rootElement.getChildNodes();
|
||||||
for (int i = 0; i < kids.getLength(); i++) {
|
for (int i = 0; i < kids.getLength(); i++) {
|
||||||
rootElement.removeChild(kids.item(i));
|
rootElement.removeChild(kids.item(i));
|
||||||
|
i--;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Extract the root of our temporary document
|
//Extract the root of our temporary document
|
||||||
Node node = doc.getFirstChild();
|
Node node = doc.getFirstChild();
|
||||||
//Create a copy which is a part of the new document
|
if (node.hasChildNodes()) {
|
||||||
Node appendNode = rootElement.getOwnerDocument().importNode(node, true);
|
//Create a copy which is a part of the new document
|
||||||
//Put the copy into the document in the appropriate location
|
Node appendNode = rootElement.getOwnerDocument().importNode(node, true);
|
||||||
rootElement.appendChild(appendNode);
|
//Put the copy into the document in the appropriate location
|
||||||
|
rootElement.appendChild(appendNode);
|
||||||
|
}
|
||||||
//Save the results
|
//Save the results
|
||||||
descriptor.saveProjectData();
|
descriptor.saveProjectData();
|
||||||
}
|
}
|
||||||
|
@ -259,25 +261,29 @@ public class ProjectTargets {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected Document translateCDTProjectToDocument() {
|
protected Document translateCDTProjectToDocument() {
|
||||||
|
Document document = null;
|
||||||
|
Element rootElement = null;
|
||||||
try {
|
try {
|
||||||
|
document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
|
||||||
ICDescriptor descriptor;
|
ICDescriptor descriptor;
|
||||||
descriptor = CCorePlugin.getDefault().getCProjectDescription(getProject());
|
descriptor = CCorePlugin.getDefault().getCProjectDescription(getProject());
|
||||||
|
|
||||||
Element rootElement = descriptor.getProjectData(MAKE_TARGET_KEY);
|
rootElement = descriptor.getProjectData(MAKE_TARGET_KEY);
|
||||||
Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
|
} catch ( ParserConfigurationException e) {
|
||||||
|
return document;
|
||||||
Element element = rootElement.getOwnerDocument().getDocumentElement();
|
} catch ( CoreException e) {
|
||||||
NodeList list = rootElement.getChildNodes();
|
|
||||||
for (int i = 0; i < list.getLength(); i++) {
|
|
||||||
if ( list.item(i).getNodeType() == Node.ELEMENT_NODE) {
|
|
||||||
Node appendNode = document.importNode(list.item(i), true);
|
|
||||||
document.appendChild(appendNode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return document;
|
return document;
|
||||||
} catch (Exception ex) {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
Element element = rootElement.getOwnerDocument().getDocumentElement();
|
||||||
|
NodeList list = rootElement.getChildNodes();
|
||||||
|
for (int i = 0; i < list.getLength(); i++) {
|
||||||
|
if ( list.item(i).getNodeType() == Node.ELEMENT_NODE) {
|
||||||
|
Node appendNode = document.importNode(list.item(i), true);
|
||||||
|
document.appendChild(appendNode);
|
||||||
|
break; // show never have multiple <buildtargets>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return document;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue