Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2016-07-13 19:05:54 +0000
committerChristian W. Damus2016-07-13 19:51:04 +0000
commitddfb7b0caefdd1be212db31bde24b8a9feb225de (patch)
tree5c350c81ea1a9fb2985bb62195c06ff50a7a5174 /plugins/infra/core
parentf68c766e5c5df1bb5c08fd65bc6f5464d3a58208 (diff)
downloadorg.eclipse.papyrus-ddfb7b0caefdd1be212db31bde24b8a9feb225de.tar.gz
org.eclipse.papyrus-ddfb7b0caefdd1be212db31bde24b8a9feb225de.tar.xz
org.eclipse.papyrus-ddfb7b0caefdd1be212db31bde24b8a9feb225de.zip
Bug 496299: Controlled Units as Integral Fragments
https://bugs.eclipse.org/bugs/show_bug.cgi?id=496299 Implement a new mode of controlled unit in Papyrus dubbed "shards". A shard is like any other sub-unit created up to and including the Neon release, except that it cannot be opened independently in the editor. The Papyrus editor, when asked to open a "shard", will instead open the root resource of the model. Likewise, the editor matcher normalizes editor inputs to the root resource of any shard. The graph of shard dependencies is inferred from a new workspace- wide index of cross-resource containment references, when it is available. Otherwise, the linkage of shards to their parent references is parsed on-the-fly from the shard annotation's reference (with a relatively efficient XML parsing that terminates after reading only a few lines of the XMI text). A new ResourceLocator is implemented to provide a pluggable hook for resource loading (including proxy resolution), to ensure when loading a shard resource that its parent resource chain is first loaded from the top down to ensure that all context of profile applications is available before loading the shard, itself, which may have stereotype applications that depend on those profile applications. The CoreMultiDiagramEditor installs this resource locator on the ModelSet; other applications (including in a non-Eclipse context) can make similar use of it. Some additional fixes are required in other core components to make the loading of referenced sharded models as in bug 458837 work: * the SemanticUMLContentProvider did not detect the final resolution of containment proxies that changes what looks look a model root object into just another intermediate element in the content tree. Besides that it would schedule a large number of redundant UI refreshes asynchronously (deferred) on the UI thread * the DiModel and NotationModel would load their adjuncts to the *.uml resource when that resource is created, not after it has been loaded. This is much too early and ends up causing the transactional editing domain to detect the attachment of a resource's contents at the end of loading as an attempt to edit the model during a read-only transaction, which logs an exception and bombs the UI action. Instead, these models now have snippets that load the *.di and *.notation resources after the semantic resource has been loaded. * the new model snippets required an additional fix in the loading of IModels to handle contributions of snippets and dependencies to models that are overridden by other IModels registered under the same ID, such as is the case with the NotationModel and the CSSNotationModel, which latter needs the snippet declared by the former * the IModels additionally need to ensure that they start snippets on loading of an existing model even when it is already found to be loaded in the ModelSet (as happens often in JUnit tests) * the AbstractModelFixture in the JUnit test framework is updated to ensure that the ModelSet is properly initialized, with its own snippets started and its IModels loaded and their snippets started * the basic uncontrol command now removes the shard annotation from the uncontrolled element/resource, if there was one. Because this bundle now supports a new feature (that being shards), it seems appropriate to bump its minor version number General-purpose changes in the core workspace model index framework that improve overall performance, of particular significance in large and highly fragmented models: Implement persistent storage of the workspace model index at workspace save to support quick start-up without parsing the entire workspace. Consolidation of indices: * run a single pool of indexing jobs and a single resource change listener to trigger (re)-indexing of files * all indices matching any given file process it * includes a new extension point from which all indices are loaded into the shared index manager to initialize them and do the work (cherry-picked from streams/2.0-maintenance) Change-Id: Ifd65a71c57134b69d873f17139f3cedbf11c5ba5
Diffstat (limited to 'plugins/infra/core')
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF4
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/plugin.xml4
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/pom.xml2
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/language/ILanguageModel.java32
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractBaseModel.java28
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractModelWithSharedResource.java5
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AdjunctResourceModelSnippet.java104
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelsReader.java58
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/DiModel.java48
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/JobBasedFuture.java6
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.tools/META-INF/MANIFEST.MF2
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.tools/pom.xml2
12 files changed, 228 insertions, 67 deletions
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF b/plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF
index 7d28645a912..c8635206ed3 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Export-Package: org.eclipse.papyrus.infra.core,
org.eclipse.papyrus.infra.core.editor,
org.eclipse.papyrus.infra.core.extension,
org.eclipse.papyrus.infra.core.internal.expressions;x-internal:=true,
- org.eclipse.papyrus.infra.core.internal.language;x-internal:=true,
+ org.eclipse.papyrus.infra.core.internal.language;x-friends:="org.eclipse.papyrus.infra.emf",
org.eclipse.papyrus.infra.core.internal.sashmodel;x-internal:=true,
org.eclipse.papyrus.infra.core.language,
org.eclipse.papyrus.infra.core.listenerservice,
@@ -29,7 +29,7 @@ Require-Bundle: org.eclipse.emf.workspace;bundle-version="[1.5.0,2.0.0)",
org.eclipse.core.resources;bundle-version="[3.11.0,4.0.0)";visibility:=reexport
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
-Bundle-Version: 2.0.0.qualifier
+Bundle-Version: 2.2.0.qualifier
Bundle-Name: %pluginName
Bundle-Localization: plugin
Bundle-Activator: org.eclipse.papyrus.infra.core.Activator
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/plugin.xml b/plugins/infra/core/org.eclipse.papyrus.infra.core/plugin.xml
index cb8e66e2229..5002ac0231a 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/plugin.xml
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/plugin.xml
@@ -24,6 +24,10 @@
description="Main Papyrus IModel"
fileExtension="di"
required="true">
+ <modelSnippet
+ classname="org.eclipse.papyrus.infra.core.resource.AdjunctResourceModelSnippet"
+ description="Snippet for DI resource of referenced model resources">
+ </modelSnippet>
</model>
</extension>
<extension
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/pom.xml b/plugins/infra/core/org.eclipse.papyrus.infra.core/pom.xml
index 505d993b1c3..2524dc5f316 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/pom.xml
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/pom.xml
@@ -7,6 +7,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.infra.core</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.2.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/language/ILanguageModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/language/ILanguageModel.java
new file mode 100644
index 00000000000..8e25eb2bc31
--- /dev/null
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/language/ILanguageModel.java
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.internal.language;
+
+import org.eclipse.papyrus.infra.core.language.ILanguage;
+import org.eclipse.papyrus.infra.core.resource.IModel;
+
+/**
+ * An adapter type for {@link IModel}s that provide language-specific details
+ * about themselves.
+ */
+public interface ILanguageModel {
+ /**
+ * Obtains a model's file extension. This identifies resources that
+ * are expected to contain "semantic model" content for some {@link ILanguage}.
+ * Language models are expected to have file extensions associated with them.
+ *
+ * @return the model's file extension
+ */
+ String getModelFileExtension();
+}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractBaseModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractBaseModel.java
index 6aa34544b9d..40c057e37ba 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractBaseModel.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractBaseModel.java
@@ -10,7 +10,7 @@
* CEA LIST - Initial API and implementation
* Christian W. Damus (CEA) - manage models by URI, not IFile (CDO)
* Christian W. Damus (CEA) - bug 437052
- * Christian W. Damus - bugs 399859, 481149, 485220
+ * Christian W. Damus - bugs 399859, 481149, 485220, 496299
*
*****************************************************************************/
package org.eclipse.papyrus.infra.core.resource;
@@ -32,6 +32,7 @@ import org.eclipse.emf.ecore.xmi.XMIResource;
import org.eclipse.emf.ecore.xmi.XMLResource;
import org.eclipse.emf.ecore.xmi.impl.URIHandlerImpl.PlatformSchemeAware;
import org.eclipse.papyrus.infra.core.Activator;
+import org.eclipse.papyrus.infra.core.internal.language.ILanguageModel;
/**
* An abstract implementation of model. This class should be subclassed to fit
@@ -276,7 +277,7 @@ public abstract class AbstractBaseModel extends AbstractModel implements IVersio
}
public static Map<Object, Object> getDefaultSaveOptions() {
- Map<Object, Object> saveOptions = new HashMap<Object, Object>();
+ Map<Object, Object> saveOptions = new HashMap<>();
// default save options.
saveOptions.put(XMLResource.OPTION_DECLARE_XML, Boolean.TRUE);
@@ -298,7 +299,7 @@ public abstract class AbstractBaseModel extends AbstractModel implements IVersio
@Override
public void saveCopy(IPath targetPathWithoutExtension, Map<Object, Object> targetMap) {
// OutputStream targetStream = getOutputStream(targetPath);
- Map<Object, Object> saveOptions = new HashMap<Object, Object>();
+ Map<Object, Object> saveOptions = new HashMap<>();
URI targetURI = getTargetURI(targetPathWithoutExtension);
@@ -461,4 +462,25 @@ public abstract class AbstractBaseModel extends AbstractModel implements IVersio
return object.eContainer() == null;
}
+ /**
+ * @since 2.1
+ */
+ @Override
+ public <T> T getAdapter(Class<T> adapter) {
+ T result = null;
+
+ if (adapter == ILanguageModel.class) {
+ result = adapter.cast(new ILanguageModel() {
+
+ @Override
+ public String getModelFileExtension() {
+ return AbstractBaseModel.this.getModelFileExtension();
+ }
+ });
+ } else {
+ result = super.getAdapter(adapter);
+ }
+
+ return result;
+ }
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractModelWithSharedResource.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractModelWithSharedResource.java
index 748ab35ed26..884a997c7e4 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractModelWithSharedResource.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AbstractModelWithSharedResource.java
@@ -8,7 +8,7 @@
*
* Contributors:
* LIFL - Initial API and implementation
- * Christian W. Damus - bug 485220
+ * Christian W. Damus - bugs 485220, 496299
*
*****************************************************************************/
package org.eclipse.papyrus.infra.core.resource;
@@ -80,6 +80,7 @@ public abstract class AbstractModelWithSharedResource<T extends EObject> extends
// Check if model is loaded.
if (resourceIsSet()) {
configureResource(resource);
+ startSnippets();
return;
}
// model is not loaded, do it.
@@ -192,7 +193,7 @@ public abstract class AbstractModelWithSharedResource<T extends EObject> extends
@SuppressWarnings("unchecked")
public List<T> getModelRoots() {
- List<T> roots = new ArrayList<T>();
+ List<T> roots = new ArrayList<>();
for (EObject object : getResource().getContents()) {
if (isModelRoot(object)) {
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AdjunctResourceModelSnippet.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AdjunctResourceModelSnippet.java
new file mode 100644
index 00000000000..46a6003edc5
--- /dev/null
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/AdjunctResourceModelSnippet.java
@@ -0,0 +1,104 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.resource;
+
+import java.util.Collections;
+
+import org.eclipse.emf.common.notify.Adapter;
+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.URIConverter;
+import org.eclipse.papyrus.infra.core.Activator;
+
+/**
+ * An {@link IModel} snippet that loads the model's corresponding resource
+ * whenever a "primary" semantic resource is loaded that has a resource
+ * corresponding to it that is managed by the {@code IModel}.
+ *
+ * @since 2.1
+ */
+public class AdjunctResourceModelSnippet implements IModelSnippet {
+ private EMFLogicalModel model;
+ private Adapter adapter;
+
+ /**
+ * Initializes me.
+ */
+ public AdjunctResourceModelSnippet() {
+ super();
+ }
+
+
+ @Override
+ public void start(IModel startingModel) {
+ if (startingModel instanceof EMFLogicalModel) {
+ model = (EMFLogicalModel) startingModel;
+
+ adapter = new ResourceAdapter() {
+ @Override
+ protected void handleResourceLoaded(Resource resource) {
+ maybeLoadAdjunctResource(resource);
+ }
+ };
+
+ model.getModelManager().eAdapters().add(adapter);
+ }
+ }
+
+ @Override
+ public void dispose(IModel stoppingModel) {
+ if ((stoppingModel == model) && (adapter != null)) {
+ model.getModelManager().eAdapters().remove(adapter);
+ adapter = null;
+ model = null;
+ }
+ }
+
+ void maybeLoadAdjunctResource(Resource resource) {
+ // If the parameter resource is the model's own kind of resource,
+ // then there is nothing to do
+ if ((model != null) && !model.isRelatedResource(resource)) {
+ URI adjunctURI = resource.getURI().trimFileExtension().appendFileExtension(model.getModelFileExtension());
+ ResourceSet resourceSet = resource.getResourceSet();
+
+ boolean adjunctAlreadyLoaded = false;
+ for (Resource loadedResource : resourceSet.getResources()) {
+ if (loadedResource.getURI().equals(adjunctURI)) {
+ adjunctAlreadyLoaded = true;
+ break;
+ }
+ }
+
+ if (!adjunctAlreadyLoaded && (resourceSet.getURIConverter() != null)) {
+ URIConverter converter = resourceSet.getURIConverter();
+
+ // If the di resource associated to the parameter resource exists,
+ // then load it
+ if (converter.exists(adjunctURI, Collections.emptyMap())) {
+ // Best effort load. This must not interfere with other
+ // resource set operations
+ try {
+ resourceSet.getResource(adjunctURI, true);
+ } catch (Exception e) {
+ Activator.log.error(
+ String.format("Failed to load %s resource", model.getModelFileExtension()), //$NON-NLS-1$
+ e);
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelsReader.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelsReader.java
index d64dc7bffb0..249ce9a72ee 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelsReader.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelsReader.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011, 2014 CEA LIST and others.
+ * Copyright (c) 2011, 2016 CEA LIST, Christian W. Damus, and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -10,6 +10,7 @@
* Contributors:
* CEA LIST - Initial API and implementation
* Christian W. Damus (CEA) - bug 429242
+ * Christian W. Damus - bug 496299
*
*****************************************************************************/
package org.eclipse.papyrus.infra.core.resource;
@@ -18,6 +19,7 @@ import static org.eclipse.papyrus.infra.core.Activator.log;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
@@ -31,6 +33,7 @@ import org.eclipse.emf.common.util.URI;
import org.eclipse.papyrus.infra.core.Activator;
import org.eclipse.papyrus.infra.core.extension.ExtensionException;
import org.eclipse.papyrus.infra.core.extension.ExtensionUtils;
+import org.eclipse.papyrus.infra.tools.util.TypeUtils;
import com.google.common.collect.Sets;
@@ -191,7 +194,18 @@ public class ModelsReader extends ExtensionUtils {
try {
if (MODEL_ELEMENT_NAME.equals(ele.getName())) {
IModel model = instanciateModel(ele);
+
+ // Register the model
+ AbstractModel previous = TypeUtils.as(modelSet.getModel(model.getIdentifier()), AbstractModel.class);
modelSet.registerModel(model);
+
+ // We may be contributing to another model already registered
+ // under the same ID
+ model = modelSet.getModel(model.getIdentifier());
+ if ((previous != null) && (previous != model)) {
+ inherit(model, previous);
+ }
+
addDeclaredModelSnippet(ele, model);
addDeclaredDependencies(ele, model);
log.debug("model loaded: '" + model.getClass().getName() + "'");
@@ -203,6 +217,21 @@ public class ModelsReader extends ExtensionUtils {
}
/**
+ * Let a {@code special} model inherit the snippets and dependencies from a
+ * more {@code general} model that it replaces in the model-set.
+ *
+ * @param special
+ * a specializing model
+ * @param general
+ * a more generalized model that it replaces
+ */
+ private void inherit(IModel special, AbstractModel general) {
+ general.snippets.forEach(special::addModelSnippet);
+ special.setAfterLoadModelDependencies(general.getAfterLoadModelIdentifiers());
+ special.setBeforeUnloadDependencies(general.getUnloadBeforeModelIdentifiers());
+ }
+
+ /**
* Add ModelSet snippet
*
* @param modelSet
@@ -316,11 +345,12 @@ public class ModelsReader extends ExtensionUtils {
protected void addDeclaredDependencies(IConfigurationElement modelConfigurationElement, IModel model) {
// Get children
IConfigurationElement[] dependencyElements = modelConfigurationElement.getChildren(DEPENDENCY_ELEMENT_NAME);
- List<String> afterLoadModelIdentifiers = null;
- List<String> unloadBeforeModelIdentifiers = null;
- for (IConfigurationElement dependencyElement : dependencyElements) {
+ // Ordering is important, obviously, but we mustn't have duplicates
+ LinkedHashSet<String> afterLoadModelIdentifiers = null;
+ LinkedHashSet<String> unloadBeforeModelIdentifiers = null;
+ for (IConfigurationElement dependencyElement : dependencyElements) {
// init load after and unloadBefore
IConfigurationElement[] loadAfterElements = dependencyElement.getChildren(LOAD_AFTER_ELEMENT_NAME);
IConfigurationElement[] unloadBeforeElements = dependencyElement.getChildren(UNLOAD_BEFORE_ELEMENT_NAME);
@@ -329,7 +359,11 @@ public class ModelsReader extends ExtensionUtils {
String identifier = loadAfterElement.getAttribute(IDENTIFIER_ATTRIBUTE_NAME);
if (identifier != null && identifier.length() > 0) {
if (afterLoadModelIdentifiers == null) {
- afterLoadModelIdentifiers = new ArrayList<String>();
+ afterLoadModelIdentifiers = new LinkedHashSet<>();
+ List<String> existing = model.getAfterLoadModelIdentifiers();
+ if (existing != null) {
+ afterLoadModelIdentifiers.addAll(existing);
+ }
}
afterLoadModelIdentifiers.add(identifier);
}
@@ -339,7 +373,11 @@ public class ModelsReader extends ExtensionUtils {
String identifier = unloadBeforeElement.getAttribute(IDENTIFIER_ATTRIBUTE_NAME);
if (identifier != null && identifier.length() > 0) {
if (unloadBeforeModelIdentifiers == null) {
- unloadBeforeModelIdentifiers = new ArrayList<String>();
+ unloadBeforeModelIdentifiers = new LinkedHashSet<>();
+ List<String> existing = model.getUnloadBeforeModelIdentifiers();
+ if (existing != null) {
+ unloadBeforeModelIdentifiers.addAll(existing);
+ }
}
unloadBeforeModelIdentifiers.add(identifier);
}
@@ -347,8 +385,12 @@ public class ModelsReader extends ExtensionUtils {
}
// all config elements have been parsed. sets the dependencies in the model
- model.setAfterLoadModelDependencies(afterLoadModelIdentifiers);
- model.setBeforeUnloadDependencies(unloadBeforeModelIdentifiers);
+ if (afterLoadModelIdentifiers != null) {
+ model.setAfterLoadModelDependencies(new ArrayList<>(afterLoadModelIdentifiers));
+ }
+ if (unloadBeforeModelIdentifiers != null) {
+ model.setBeforeUnloadDependencies(new ArrayList<>(unloadBeforeModelIdentifiers));
+ }
}
/**
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/DiModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/DiModel.java
index de2bb7ae32e..2f6a1cd2758 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/DiModel.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/DiModel.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011, 2014 LIFL, CEA LIST, and others.
+ * Copyright (c) 2011, 2016 LIFL, CEA LIST, Christian W. Damus, and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -10,21 +10,18 @@
* Contributors:
* LIFL - Initial API and implementation
* Christian W. Damus (CEA) - bug 429242
+ * Christian W. Damus - bug 496299
*
*****************************************************************************/
package org.eclipse.papyrus.infra.core.resource.sasheditor;
-import java.util.Collections;
import java.util.Map;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.URIConverter;
import org.eclipse.emf.ecore.xmi.XMIResource;
import org.eclipse.emf.ecore.xmi.XMLResource;
-import org.eclipse.papyrus.infra.core.Activator;
import org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource;
import org.eclipse.papyrus.infra.core.resource.IEMFModel;
import org.eclipse.papyrus.infra.core.resource.IModel;
@@ -131,47 +128,6 @@ public class DiModel extends AbstractModelWithSharedResource<EObject> implements
}
- @Override
- public void handle(Resource resource) {
- super.handle(resource);
- if (resource == null) {
- return;
- }
-
- // If the parameter resource is already a di resource, nothing to do
- if (!isRelatedResource(resource)) {
- URI diUri = resource.getURI().trimFileExtension().appendFileExtension(DI_FILE_EXTENSION);
- ResourceSet resourceSet = getResourceSet();
-
- boolean diAlreadyLoaded = false;
- for (Resource loadedResource : resourceSet.getResources()) {
- if (loadedResource.getURI().equals(diUri)) {
- diAlreadyLoaded = true;
- break;
- }
- }
-
- if (!diAlreadyLoaded && resourceSet.getURIConverter() != null) {
- URIConverter converter = resourceSet.getURIConverter();
-
- // If the di resource associated to the parameter resource exists, load it
- if (converter.exists(diUri, Collections.emptyMap())) {
-
- // loadModel writes this.resource and this.resourceUri. In this case, when only want to load
- // the resource, but it should not become the main resource
-
- // Load with try/catch to remain consistent with loadModel()
- try {
- resourceSet.getResource(diUri, true);
- } catch (Exception ex) {
- Activator.log.error(ex);
- }
- }
-
- }
- }
- }
-
// Prevent infinite loop from 2 models delegating to each other.
private boolean checkingControlState = false;
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/JobBasedFuture.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/JobBasedFuture.java
index f5fb41b133b..a7af91a37f2 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/JobBasedFuture.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/JobBasedFuture.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2014 Christian W. Damus and others.
+ * Copyright (c) 2014, 2016 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
@@ -179,8 +179,8 @@ public abstract class JobBasedFuture<V> extends Job implements ListenableFuture<
boolean result = isDone();
if (!result) {
- Job current = Job.getJobManager().currentJob();
- if ((current == null) || (current.getRule() == null)) {
+ ISchedulingRule current = Job.getJobManager().currentRule();
+ if (current == null) {
result = uiSafeAwaitDone(timeoutMillis);
} else {
result = lockBasedAwaitDone(timeoutMillis);
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.tools/META-INF/MANIFEST.MF b/plugins/infra/core/org.eclipse.papyrus.infra.tools/META-INF/MANIFEST.MF
index 6db575046db..8fca886535b 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.tools/META-INF/MANIFEST.MF
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.tools/META-INF/MANIFEST.MF
@@ -13,7 +13,7 @@ Require-Bundle: org.eclipse.papyrus.infra.core.log;bundle-version="[1.2.0,2.0.0)
org.eclipse.core.resources;bundle-version="3.11.0"
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
-Bundle-Version: 2.0.0.qualifier
+Bundle-Version: 2.0.100.qualifier
Eclipse-BuddyPolicy: dependent
Bundle-Name: %Bundle-Name
Bundle-Activator: org.eclipse.papyrus.infra.tools.Activator
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.tools/pom.xml b/plugins/infra/core/org.eclipse.papyrus.infra.tools/pom.xml
index 28f1cab8cac..252c49ec53f 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.tools/pom.xml
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.tools/pom.xml
@@ -7,6 +7,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.infra.tools</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.0.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file

Back to the top