Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2014-10-01 15:07:12 -0400
committerChristian W. Damus2014-10-01 15:07:12 -0400
commit81ec03347d997396ff003c40661e8a3bdcc4dc27 (patch)
tree8e72d98c5efcdfcc9fde7321bdf8bf2c0d774bf3 /plugins/developer/org.eclipse.papyrus.releng.tools
parent6ac1caa12205fa76910153cc2811caa62624950d (diff)
downloadorg.eclipse.papyrus-81ec03347d997396ff003c40661e8a3bdcc4dc27.tar.gz
org.eclipse.papyrus-81ec03347d997396ff003c40661e8a3bdcc4dc27.tar.xz
org.eclipse.papyrus-81ec03347d997396ff003c40661e8a3bdcc4dc27.zip
[Releng] Update Oomph setup for Mars M2 and new nightly build repositories
Also fix the releng updater tool to ensure formatting consistent with the EMF-based Setup editor.
Diffstat (limited to 'plugins/developer/org.eclipse.papyrus.releng.tools')
-rw-r--r--plugins/developer/org.eclipse.papyrus.releng.tools/src/org/eclipse/papyrus/releng/tools/internal/popup/actions/DependencyUpdater.java16
-rw-r--r--plugins/developer/org.eclipse.papyrus.releng.tools/src/org/eclipse/papyrus/releng/tools/internal/popup/actions/OomphSetupUpdater.java24
2 files changed, 34 insertions, 6 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.releng.tools/src/org/eclipse/papyrus/releng/tools/internal/popup/actions/DependencyUpdater.java b/plugins/developer/org.eclipse.papyrus.releng.tools/src/org/eclipse/papyrus/releng/tools/internal/popup/actions/DependencyUpdater.java
index 9020eb3c20e..9b094c0f37d 100644
--- a/plugins/developer/org.eclipse.papyrus.releng.tools/src/org/eclipse/papyrus/releng/tools/internal/popup/actions/DependencyUpdater.java
+++ b/plugins/developer/org.eclipse.papyrus.releng.tools/src/org/eclipse/papyrus/releng/tools/internal/popup/actions/DependencyUpdater.java
@@ -89,12 +89,7 @@ public abstract class DependencyUpdater {
}
}
- Transformer transformer = TransformerFactory.newInstance().newTransformer();
- transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
-
- StreamResult result = new StreamResult(mapFile);
- DOMSource source = new DOMSource(doc);
- transformer.transform(source, result);
+ save(doc, mapFile);
this.fMapFile.refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor());
@@ -103,6 +98,15 @@ public abstract class DependencyUpdater {
}
}
+ protected void save(Document document, File destination) throws Exception {
+ Transformer transformer = TransformerFactory.newInstance().newTransformer();
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
+
+ StreamResult result = new StreamResult(destination);
+ DOMSource source = new DOMSource(document);
+ transformer.transform(source, result);
+ }
+
protected void updateWithContribution(final Node uri, final String contributionName, final int repositoryIndex) {
Contribution contribution = findContribution(contributionName);
if (contribution == null) {
diff --git a/plugins/developer/org.eclipse.papyrus.releng.tools/src/org/eclipse/papyrus/releng/tools/internal/popup/actions/OomphSetupUpdater.java b/plugins/developer/org.eclipse.papyrus.releng.tools/src/org/eclipse/papyrus/releng/tools/internal/popup/actions/OomphSetupUpdater.java
index 4b4e90f9089..d2908a5a951 100644
--- a/plugins/developer/org.eclipse.papyrus.releng.tools/src/org/eclipse/papyrus/releng/tools/internal/popup/actions/OomphSetupUpdater.java
+++ b/plugins/developer/org.eclipse.papyrus.releng.tools/src/org/eclipse/papyrus/releng/tools/internal/popup/actions/OomphSetupUpdater.java
@@ -13,11 +13,20 @@
*****************************************************************************/
package org.eclipse.papyrus.releng.tools.internal.popup.actions;
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
import java.util.regex.Pattern;
import org.eclipse.b3.aggregator.Contribution;
import org.eclipse.core.resources.IFile;
import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.xmi.XMLResource;
+import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -108,4 +117,19 @@ public class OomphSetupUpdater extends DependencyUpdater {
uri.getAttributes().getNamedItem("url").setTextContent(location); //$NON-NLS-1$
}
+ @Override
+ protected void save(Document document, File destination) throws Exception {
+ // Use EMF resource serialization to format the file in the EMF style
+ ResourceSet rset = new ResourceSetImpl();
+ Resource resource = rset.createResource(URI.createFileURI(destination.getAbsolutePath()));
+ Map<Object, Object> options = new HashMap<Object, Object>();
+ options.put(XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, true);
+ options.put(XMLResource.OPTION_DEFER_IDREF_RESOLUTION, true);
+ ((XMLResource) resource).load(document, options);
+
+ options.clear();
+ options.put(XMLResource.OPTION_FORMATTED, true);
+ options.put(XMLResource.OPTION_PROCESS_DANGLING_HREF, XMLResource.OPTION_PROCESS_DANGLING_HREF_RECORD);
+ resource.save(options);
+ }
}

Back to the top