Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2014-12-17 13:04:27 -0500
committerChristian W. Damus2014-12-17 13:13:11 -0500
commit92baa208d0d23296ebf86bd0834d8f0a087ca9a4 (patch)
tree46d7a2367a540d338bc265241d78fbf3d354ffe5 /plugins/developer/org.eclipse.papyrus.releng.tools
parentc195ea81e95889bc6b5fba3a420667f9b6882422 (diff)
downloadorg.eclipse.papyrus-92baa208d0d23296ebf86bd0834d8f0a087ca9a4.tar.gz
org.eclipse.papyrus-92baa208d0d23296ebf86bd0834d8f0a087ca9a4.tar.xz
org.eclipse.papyrus-92baa208d0d23296ebf86bd0834d8f0a087ca9a4.zip
[Releng] Add support for updating dependencies of multiple streams in the setup model
Diffstat (limited to 'plugins/developer/org.eclipse.papyrus.releng.tools')
-rw-r--r--plugins/developer/org.eclipse.papyrus.releng.tools/.classpath2
-rw-r--r--plugins/developer/org.eclipse.papyrus.releng.tools/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--plugins/developer/org.eclipse.papyrus.releng.tools/META-INF/MANIFEST.MF3
-rw-r--r--plugins/developer/org.eclipse.papyrus.releng.tools/src/org/eclipse/papyrus/releng/tools/internal/handler/UpdateOomphSetupHandler.java95
-rw-r--r--plugins/developer/org.eclipse.papyrus.releng.tools/src/org/eclipse/papyrus/releng/tools/internal/popup/actions/OomphSetupUpdater.java11
5 files changed, 107 insertions, 10 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.releng.tools/.classpath b/plugins/developer/org.eclipse.papyrus.releng.tools/.classpath
index 8a8f1668cdc..b1dabee3829 100644
--- a/plugins/developer/org.eclipse.papyrus.releng.tools/.classpath
+++ b/plugins/developer/org.eclipse.papyrus.releng.tools/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/plugins/developer/org.eclipse.papyrus.releng.tools/.settings/org.eclipse.jdt.core.prefs b/plugins/developer/org.eclipse.papyrus.releng.tools/.settings/org.eclipse.jdt.core.prefs
index 410244d65a6..9ca8e68231b 100644
--- a/plugins/developer/org.eclipse.papyrus.releng.tools/.settings/org.eclipse.jdt.core.prefs
+++ b/plugins/developer/org.eclipse.papyrus.releng.tools/.settings/org.eclipse.jdt.core.prefs
@@ -1,10 +1,10 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
diff --git a/plugins/developer/org.eclipse.papyrus.releng.tools/META-INF/MANIFEST.MF b/plugins/developer/org.eclipse.papyrus.releng.tools/META-INF/MANIFEST.MF
index c8b75420b7a..85a79784b47 100644
--- a/plugins/developer/org.eclipse.papyrus.releng.tools/META-INF/MANIFEST.MF
+++ b/plugins/developer/org.eclipse.papyrus.releng.tools/META-INF/MANIFEST.MF
@@ -6,6 +6,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.b3.aggregator;bundle-version="0.2.0",
org.eclipse.b3.aggregator.legacy;bundle-version="0.2.0",
org.eclipse.oomph.setup.targlets;bundle-version="1.0.0";resolution:=optional,
+ org.eclipse.oomph.p2;bundle-version="1.0.0",
org.eclipse.emf.edit;bundle-version="2.10.0";resolution:=optional
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
@@ -14,5 +15,5 @@ Bundle-Name: %Bundle-Name
Bundle-ManifestVersion: 2
Bundle-Activator: org.eclipse.papyrus.releng.tools.internal.Activator
Bundle-SymbolicName: org.eclipse.papyrus.releng.tools;singleton:=true
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
diff --git a/plugins/developer/org.eclipse.papyrus.releng.tools/src/org/eclipse/papyrus/releng/tools/internal/handler/UpdateOomphSetupHandler.java b/plugins/developer/org.eclipse.papyrus.releng.tools/src/org/eclipse/papyrus/releng/tools/internal/handler/UpdateOomphSetupHandler.java
index 865c844c43f..96681f953ee 100644
--- a/plugins/developer/org.eclipse.papyrus.releng.tools/src/org/eclipse/papyrus/releng/tools/internal/handler/UpdateOomphSetupHandler.java
+++ b/plugins/developer/org.eclipse.papyrus.releng.tools/src/org/eclipse/papyrus/releng/tools/internal/handler/UpdateOomphSetupHandler.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
+ * Copyright (c) 2014 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,10 +9,18 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - Add support for updating Oomph setup models
+ * Christian W. Damus - Add support for updating multiple development streams in a setup model
*
*****************************************************************************/
package org.eclipse.papyrus.releng.tools.internal.handler;
+import java.io.InputStream;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
import org.eclipse.b3.aggregator.Aggregation;
import org.eclipse.b3.aggregator.AggregatorPackage;
import org.eclipse.b3.aggregator.Contribution;
@@ -28,11 +36,18 @@ 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.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.osgi.util.NLS;
import org.eclipse.papyrus.releng.tools.internal.Activator;
import org.eclipse.papyrus.releng.tools.internal.Messages;
import org.eclipse.papyrus.releng.tools.internal.popup.actions.OomphSetupUpdater;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.ListDialog;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
public class UpdateOomphSetupHandler extends AbstractDependencyHandler {
@@ -68,10 +83,86 @@ public class UpdateOomphSetupHandler extends AbstractDependencyHandler {
if (root instanceof Aggregation) {
Aggregation aggregation = (Aggregation) root;
EList<Contribution> allContributions = aggregation.getAllContributions(true);
- OomphSetupUpdater setupUpdater = new OomphSetupUpdater(setupFile, allContributions);
+
+ String streamName = promptForStreamName(activeShell, setupFile);
+ if (streamName == null) {
+ // Cancel
+ return;
+ }
+
+ OomphSetupUpdater setupUpdater = new OomphSetupUpdater(setupFile, allContributions, streamName);
setupUpdater.updateDocument();
}
MessageDialog.openInformation(activeShell, Messages.UpdateRMapAction_mapWasUpdatedTitle, NLS.bind(Messages.UpdateRMapAction_mapWasUpdated, setupFile.getFullPath().toString(), aggregationBuildFile.getFullPath().toString()));
}
+
+ protected String promptForStreamName(Shell parentShell, IFile setupFile) throws CoreException {
+ final Set<String> repositoryLists = new LinkedHashSet<String>();
+
+ try (InputStream input = setupFile.getContents()) {
+ SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
+ parser.parse(input, new DefaultHandler() {
+ int inTarglet;
+ String repositoryListName;
+ boolean foundAnnotation;
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ if ("targlet".equals(qName)) { //$NON-NLS-1$
+ if ((inTarglet > 0) || "${eclipse.target.platform}".equals(attributes.getValue("activeRepositoryList"))) { //$NON-NLS-1$ //$NON-NLS-2$
+ // This is a stream-switching targlet. Get its repository names
+ inTarglet++;
+ }
+ } else if ((inTarglet > 0) && "repositoryList".equals(qName)) {
+ String listName = attributes.getValue("name"); //$NON-NLS-1$
+ if (listName != null && !listName.isEmpty()) {
+ repositoryListName = listName;
+ foundAnnotation = false;
+ }
+ } else if ("annotation".equals(qName) && OomphSetupUpdater.ANNOTATION_SOURCE.equals(attributes.getValue("source"))) { //$NON-NLS-1$ //$NON-NLS-2$
+ foundAnnotation = true;
+ }
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ if ("targlet".equals(qName)) { //$NON-NLS-1$
+ inTarglet = Math.max(inTarglet - 1, 0);
+ } else if ("repositoryList".equals(qName) && (repositoryListName != null)) { //$NON-NLS-1$
+ if (foundAnnotation) {
+ repositoryLists.add(repositoryListName);
+ }
+ repositoryListName = null;
+ foundAnnotation = false;
+ }
+ }
+ });
+ } catch (Exception e) {
+ throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to scan setup model for available streams.", e));
+ }
+
+ if (repositoryLists.isEmpty()) {
+ throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "No streams are defined in the selected setup model."));
+ }
+
+ String first = repositoryLists.iterator().next();
+ if (repositoryLists.size() == 1) {
+ return first;
+ }
+
+ ILabelProvider labels = new LabelProvider();
+ ListDialog dlg = new ListDialog(parentShell);
+ dlg.setContentProvider(ArrayContentProvider.getInstance());
+ dlg.setLabelProvider(labels);
+ dlg.setInput(repositoryLists);
+ dlg.setInitialSelections(new Object[] { repositoryLists.iterator().next() });
+ dlg.setTitle("Select Stream");
+ dlg.setMessage("Select the development stream to update.");
+ labels.dispose();
+
+ dlg.open();
+ Object[] result = dlg.getResult();
+ return ((result == null) || (result.length == 0)) ? null : (String) result[0];
+ }
}
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 d2908a5a951..1dc75406734 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
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
+ * Copyright (c) 2014 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,6 +9,7 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - Add support for updating Oomph setup models
+ * Christian W. Damus - Add support for updating multiple development streams in a setup model
*
*****************************************************************************/
package org.eclipse.papyrus.releng.tools.internal.popup.actions;
@@ -42,8 +43,12 @@ public class OomphSetupUpdater extends DependencyUpdater {
private final Pattern indexPattern = Pattern.compile(":\\d+$"); //$NON-NLS-1$
- public OomphSetupUpdater(final IFile mapFile, final EList<Contribution> contributions) {
+ private final String streamName;
+
+ public OomphSetupUpdater(final IFile mapFile, final EList<Contribution> contributions, final String streamName) {
super(mapFile, contributions);
+
+ this.streamName = streamName;
}
@Override
@@ -109,7 +114,7 @@ public class OomphSetupUpdater extends DependencyUpdater {
@Override
protected String getXpath() {
- return "//setupTask[@type='setup.targlets:TargletTask']/targlet/repositoryList/repository";
+ return String.format("//setupTask[@type='setup.targlets:TargletTask']/targlet/repositoryList[@name='%s']/repository", streamName);
}
@Override

Back to the top