Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptessier2014-03-10 14:16:20 +0000
committerptessier2014-03-10 14:16:20 +0000
commit1118d9b70850d945c3b0d89919c4100db64b9424 (patch)
tree34384ea38c796278ad49226b576db6d7fc8f2c41 /plugins
parentaadd70e59010f365353242f60f7f153d8c19f76d (diff)
parente9eb2ae9d1d16b7119826e6bbce5da2955533d99 (diff)
downloadorg.eclipse.papyrus-1118d9b70850d945c3b0d89919c4100db64b9424.tar.gz
org.eclipse.papyrus-1118d9b70850d945c3b0d89919c4100db64b9424.tar.xz
org.eclipse.papyrus-1118d9b70850d945c3b0d89919c4100db64b9424.zip
Merge branch 'master' into bugs/386118-emf-facet
Conflicts: plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/EMFLogicalModel.java
Diffstat (limited to 'plugins')
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/.classpath3
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF2
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/EMFLogicalModel.java4
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelSet.java116
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelUtils.java56
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModelUtils.java32
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomain.java13
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/query/PapyrusOCLQuery.java4
9 files changed, 130 insertions, 107 deletions
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/.classpath b/plugins/infra/core/org.eclipse.papyrus.infra.core/.classpath
index 024fd574b42..8a8f1668cdc 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/.classpath
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/.classpath
@@ -1,8 +1,7 @@
<?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/J2SE-1.5"/>
+ <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.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
- <!-- <classpathentry kind="src" path="test"/>-->
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/core/org.eclipse.papyrus.infra.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..f287d53cf45
--- /dev/null
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+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.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
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 9fea77c193b..3d4475746e8 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
@@ -40,5 +40,5 @@ Bundle-Name: %pluginName
Bundle-ManifestVersion: 2
Bundle-Activator: org.eclipse.papyrus.infra.core.Activator
Bundle-SymbolicName: org.eclipse.papyrus.infra.core;singleton:=true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/EMFLogicalModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/EMFLogicalModel.java
index cb3098852ec..9c96ac90e00 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/EMFLogicalModel.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/EMFLogicalModel.java
@@ -56,7 +56,9 @@ public abstract class EMFLogicalModel extends AbstractBaseModel implements IEMFM
if(!getModelManager().getTransactionalEditingDomain().isReadOnly(resource) && !ModelUtils.resourceFailedOnLoad(resource)) {
try {
resource.save(null);
- } catch (Exception ex) {
+ } catch (IOException ex) {
+ //If an exception occurs, we should not prevent other resources from being saved.
+ //This would probably make things even worse. Catch and log.
Activator.log.error(ex);
}
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelSet.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelSet.java
index 48475d9458e..96f02ae8f5d 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelSet.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelSet.java
@@ -62,7 +62,7 @@ import com.google.common.base.Optional;
/**
* This class is used to manage a set of {@link IModel}.
- *
+ *
* <h2>>Usage</h2>
* <ul>
* <li>First, register associated model. A loader can be used.</li>
@@ -70,16 +70,16 @@ import com.google.common.base.Optional;
* <li>Then, it is possible to get associated models</li>
* <li>Finally, call save()</li>
* </ul>
- *
+ *
* Please note that indirectly referenced models are loaded on demand. If a
* model contains a cross reference towards another model (e.g. an import in
* case of UML) the referenced resource does not appear initially in the set.
* However, it is added once the referenced model is resolved.
- *
+ *
* TODO Modify ModelSetSnippet in order to inform them of model addition.
- *
+ *
* @author cedric dumoulin
- *
+ *
*/
public class ModelSet extends ResourceSetImpl {
@@ -125,9 +125,9 @@ public class ModelSet extends ResourceSetImpl {
/**
- *
+ *
* Constructor.
- *
+ *
*/
public ModelSet() {
registerModel(additional);
@@ -146,7 +146,7 @@ public class ModelSet extends ResourceSetImpl {
* Register the specified model under its associated key. The key is defined
* in the model itself. It is usually the model type from
* (ModelPackage.eCONTENT_TYPE).
- *
+ *
* @param model
* the model
*/
@@ -166,7 +166,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Get a model by its key. TODO throw an exception if not found.
- *
+ *
* @param key
* the key
* @return the model
@@ -177,7 +177,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Get a model by its key. TODO throw an exception if not found.
- *
+ *
* @param key
* the key
* @return the model
@@ -249,7 +249,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* @deprecated please use {@link #getAssociatedResource(EObject, String, boolean)} instead
- *
+ *
* @param modelElement
* @param associatedResourceExtension
* @return
@@ -261,7 +261,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* @deprecated please use {@link #getAssociatedResource(Resource, String, boolean)} instead
- *
+ *
* @param modelResource
* @param associatedResourceExtension
* @return
@@ -273,7 +273,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Retrieve and load the associated resource which have the given extension.
- *
+ *
* @param modelElement
* @param associatedResourceExtension
* @param loadOnDemand
@@ -289,7 +289,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Retrieve and load the associated resource which have the given extension.
- *
+ *
* @param modelResource
* @param associatedResourceExtension
* @param loadOnDemand
@@ -308,7 +308,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* This method is called by getResource, createResource and demandLoad before returning
* the resource to the caller so we can set options on the resource.
- *
+ *
* @param r
* , can be null
* @return the same resource for convenience
@@ -336,7 +336,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Create the transactional editing domain.
- *
+ *
* @return the transactional editing domain
*/
public synchronized TransactionalEditingDomain getTransactionalEditingDomain() {
@@ -352,7 +352,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* @return the filenameWithoutExtension
- *
+ *
* @deprecated Use the {@link #getURIWithoutExtension()} API, instead.
*/
@Deprecated
@@ -397,11 +397,11 @@ public class ModelSet extends ResourceSetImpl {
/**
* Create all the associated models. This creates the models, regardless if
* they already exist.
- *
+ *
* @param newFile
* The file from which path is extracted to create the new
* resources
- *
+ *
* @deprecated Use the {@link #createModels(URI)} API, instead.
*/
@Deprecated
@@ -412,7 +412,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Create all the associated models. This creates the models, regardless if
* they already exist.
- *
+ *
* @param newFile
* The file from which path is extracted to create the new
* resources
@@ -434,9 +434,9 @@ public class ModelSet extends ResourceSetImpl {
/**
* Create the model specified by the identifiers. Other models are
* untouched, unless they are sharing something with specified models.
- *
+ *
* This creates the models, regardless if they already exist.
- *
+ *
* @param newFile
* The file from which path is extracted to create the new
* resources
@@ -458,7 +458,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Load only the specified model. ModelSetSnippets are not called. Model is
* loaded using the ModelSet Path.
- *
+ *
* @param modelIdentifier
* the model identifier
* @param file
@@ -478,7 +478,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Import only the specified model. ModelSetSnippets are not called.
- *
+ *
* @param modelIdentifier
* the model identifier
* @param file
@@ -499,7 +499,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Load all the associated models from a handle on one of the associated
* file.
- *
+ *
* @param file
* The file to load (no matter the extension)
* @deprecated Use the {@link #loadModels(URI)} API, instead.
@@ -516,7 +516,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Load all the associated models from a URI identifying one of the associated
* files.
- *
+ *
* @param uri
* The URI to load (no matter the extension)
*/
@@ -566,14 +566,14 @@ public class ModelSet extends ResourceSetImpl {
* Import specified models into the ModelSet. The models are imported using
* the specified IFile. After import, the models are associated with the
* ModelSet Path.
- *
+ *
* @param modelIdentifiers
* The model to import from the specified IFile.
* @param file
* The IFile used to import the model.
* @throws ModelException
* If an error occur during import.
- *
+ *
* @deprecated Use the {@link #importModels(ModelIdentifiers, URI)} API, instead
*/
@Deprecated
@@ -586,7 +586,7 @@ public class ModelSet extends ResourceSetImpl {
* Import specified models into the ModelSet. The models are imported using
* the specified IFile. After import, the models are associated with the
* ModelSet Path.
- *
+ *
* @param modelIdentifiers
* The model to import from the specified IFile.
* @param file
@@ -613,14 +613,14 @@ public class ModelSet extends ResourceSetImpl {
* Import only the specified model. ModelSetSnippets are not called. An
* import can be performed after model are loaded. Normally, it should not
* be done before a model is loaded.
- *
+ *
* @param modelIdentifier
* the model identifier
* @param file
* the file
* @throws ModelException
* @returns The loaded model.
- *
+ *
* @deprecated Use the {@link #importModel(String, URI)} API, instead.
*/
@Deprecated
@@ -633,7 +633,7 @@ public class ModelSet extends ResourceSetImpl {
* Import only the specified model. ModelSetSnippets are not called. An
* import can be performed after model are loaded. Normally, it should not
* be done before a model is loaded.
- *
+ *
* @param modelIdentifier
* the model identifier
* @param file
@@ -666,7 +666,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Save the resources.
- *
+ *
* @param monitor
* The monitor.
* @throws IOException
@@ -712,12 +712,22 @@ public class ModelSet extends ResourceSetImpl {
try {
// Walk all registered models
for(IModel model : modelList) {
- if(!(model instanceof AdditionalResourcesModel)) {
- model.saveModel();
- monitor.worked(1);
+ try {
+ if(!(model instanceof AdditionalResourcesModel)) {
+ model.saveModel();
+ monitor.worked(1);
+ }
+ } catch (Exception ex) {
+ //If an exception occurs, we should not prevent other models from being saved.
+ //This would probably make things even worse. Catch and log.
+ Activator.log.error(ex);
}
}
- additional.saveModel();
+ try {
+ additional.saveModel();
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
//Delete resource back end to delete on save
handleResourcesToDelete();
@@ -790,12 +800,12 @@ public class ModelSet extends ResourceSetImpl {
/**
* Finds the file corresponding to the specified URI, using a URI converter
* if necessary (and provided) to normalize it.
- *
+ *
* @param uri
* a URI
* @param converter
* an optional URI converter (may be <code>null</code>)
- *
+ *
* @return the file, if available in the workspace
*/
protected IFile getFile(URI uri) {
@@ -849,12 +859,12 @@ public class ModelSet extends ResourceSetImpl {
/**
* The resources are already loaded, but we want to save them under another
* name.
- *
+ *
* @param path
* the path
* @throws IOException
* Signals that an I/O exception has occurred.
- *
+ *
* @deprecated Use the {@link #saveAs(URI)} API, instead.
*/
@Deprecated
@@ -865,7 +875,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* The resources are already loaded, but we want to save them under another
* name.
- *
+ *
* @param path
* the path
* @throws IOException
@@ -941,7 +951,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Obtains my internal API adapter.
- *
+ *
* @return my internal API adapter
*/
public Internal getInternal() {
@@ -966,7 +976,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Add a {@link IModelSetSnippet}. A snippet allows to add code that will
* perform additional operations on the ModelSet.
- *
+ *
* @param snippet
* The snippet to add.
*/
@@ -976,11 +986,11 @@ public class ModelSet extends ResourceSetImpl {
/**
* A list of {@link IModelSetSnippet}.
- *
+ *
* Used by Models to maintain their list of Snippets.
- *
+ *
* @author cedric dumoulin
- *
+ *
*/
public class ModelSetSnippetList extends ArrayList<IModelSetSnippet> {
@@ -989,7 +999,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Call the start method on all registered snippets.
- *
+ *
* @param modelsManager
* The model that is starting
*/
@@ -1001,7 +1011,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Call the start method on all registered snippets.
- *
+ *
* @param modelsManager
* The model that is stopping
*/
@@ -1020,10 +1030,10 @@ public class ModelSet extends ResourceSetImpl {
/**
* Sets the {@link ModelSet}'s primary resource URI.
- *
+ *
* @param uri
* the URI
- *
+ *
* @see ModelSet#createModels(URI)
* @see ModelSet#saveAs(URI)
*/
@@ -1032,7 +1042,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Register a model with the option to force it (in case a more specific
* implementation of the model is already registered).
- *
+ *
* @param model
* a model to register
* @param force
@@ -1042,7 +1052,7 @@ public class ModelSet extends ResourceSetImpl {
}
/**
- *
+ *
* @param target
*/
public void saveCopy(IPath targetPathWithoutExtension) {
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelUtils.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelUtils.java
index 76db49aa909..e745574077c 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelUtils.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelUtils.java
@@ -1,5 +1,5 @@
/**
- *
+ *
*/
package org.eclipse.papyrus.infra.core.resource;
@@ -9,11 +9,8 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
-import org.eclipse.core.internal.resources.ResourceException;
import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.common.util.WrappedException;
import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.Resource.Diagnostic;
import org.eclipse.emf.ecore.xmi.IllegalValueException;
import org.eclipse.papyrus.infra.core.Activator;
import org.eclipse.papyrus.infra.core.services.ServiceException;
@@ -107,17 +104,9 @@ public class ModelUtils {
}
public static boolean resourceFailedOnLoad(Resource r) {
- if(r.getErrors() != null) {
- for(Diagnostic d : r.getErrors()) {
- if(d instanceof WrappedException) {
- WrappedException wrapped = (WrappedException)d;
- if(wrapped.getCause() instanceof ResourceException && r.getContents().isEmpty()) {
- return true;
- }
- }
- }
- }
- return false;
+ //If the resource failed on load, but the contents is not empty, then we may try to save it
+ //(e.g. the resource didn't exist, but we'll create it during save, if possible)
+ return !r.getErrors().isEmpty() && r.getContents().isEmpty();
}
/**
@@ -129,7 +118,7 @@ public class ModelUtils {
// L <= Empty list that will contain the sorted nodes
// while there are unmarked nodes do
// select an unmarked node n
- // visit(n)
+ // visit(n)
// function visit(node n)
// if n has a temporary mark then stop (not a DAG)
// if n is not marked (i.e. has not been visited yet) then
@@ -143,7 +132,7 @@ public class ModelUtils {
do {
List<IModel> skippedModels = new ArrayList<IModel>();
for(IModel model : modelsToLoad) {
-
+
List<String> dependencies = model.getAfterLoadModelIdentifiers();
// no dependency => start
if(dependencies == null) {
@@ -152,6 +141,7 @@ public class ModelUtils {
// model has dependencies. Check if the dependencies are already inserted in the ordered list
Collection<IModel> startedModels = Collections2.transform(dependencies, new Function<String, IModel>() {
+ @Override
public IModel apply(String arg0) {
return models.get(arg0);
}
@@ -163,25 +153,31 @@ public class ModelUtils {
}
}
}
-
+
// implement here a safeguard in case no models has been added to orderedModels
if(!skippedModels.isEmpty() && skippedModels.size() == modelsToLoad.size()) {
- Activator.log.error("Impossible to load models. Cycles in dependency graph for the following set of models: "+modelsToLoad, null);
+ Activator.log.error("Impossible to load models. Cycles in dependency graph for the following set of models: " + modelsToLoad, null);
break;
} else {
modelsToLoad = skippedModels;
}
- } while(!modelsToLoad.isEmpty());
-
+ } while(!modelsToLoad.isEmpty());
+
return orderedModels;
}
-
+
/**
- * Returns the resource from the model set. If the resource is not yet in the resource set, it will create it. Once it is created, if asked, it will load it. If it is already present, it will not load it.
- * @param modelSet model set in which the resource should be
- * @param loadAfterCreation <code>true</code> if the resource should be load if it has been created
- * @param resourceURI the uri of the resource
- * @param contentType the content type identifier of the resource if it has to be created.
+ * Returns the resource from the model set. If the resource is not yet in the resource set, it will create it. Once it is created, if asked, it
+ * will load it. If it is already present, it will not load it.
+ *
+ * @param modelSet
+ * model set in which the resource should be
+ * @param loadAfterCreation
+ * <code>true</code> if the resource should be load if it has been created
+ * @param resourceURI
+ * the uri of the resource
+ * @param contentType
+ * the content type identifier of the resource if it has to be created.
* @return the resource found or created
*/
public static Resource getOrCreateResource(ModelSet modelSet, boolean loadAfterCreation, URI resourceURI, String contentType) {
@@ -191,10 +187,10 @@ public class ModelUtils {
if(loadAfterCreation) {
try {
resource.load(modelSet.getLoadOptions());
- } catch(IOException e) {
- // physical resource does not exists, but EMF resource itself is build.
+ } catch (IOException e) {
+ // physical resource does not exists, but EMF resource itself is build.
Activator.log.debug(e.getMessage());
- }
+ }
}
}
return resource;
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModelUtils.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModelUtils.java
index b35cb8e02c5..23bb97b79d0 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModelUtils.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModelUtils.java
@@ -1,5 +1,5 @@
/**
- *
+ *
*/
package org.eclipse.papyrus.infra.core.resource.sasheditor;
@@ -12,9 +12,9 @@ import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers;
/**
* Set of utility methods linked to Trace for ControlMode
- *
+ *
* @author cedric dumoulin
- *
+ *
*/
public class SashModelUtils {
@@ -23,12 +23,14 @@ public class SashModelUtils {
* Warning: This method is designed to be call from ui.handlers. It is not
* designed to be call from Editors. This method can return null if called
* during the MultiEditor initialization.
- *
+ *
* @see ServiceUtilsForActionHandlers.getInstance().getModelSet()
- *
+ *
* @return The {@link SashModel} of the current editor, or null if not
* found.
+ * @deprecated Use {@link #getSashModel(ModelSet)} or {@link #getSashModel(ServicesRegistry)} instead
*/
+ @Deprecated
public static SashModel getSashModel() {
try {
@@ -43,14 +45,16 @@ public class SashModelUtils {
* Warning: This method is designed to be call from ui.handlers. It is not
* designed to be call from Editors. This method can return null if called
* during the MultiEditor initialization.
- *
+ *
* @see ServiceUtilsForActionHandlers.getInstance().getModelSet()
- *
+ *
* @return The {@link SashModel} of the current editor, or null if not
* found.
* @throws ServiceException
* If an error occurs while getting or starting the service.
+ * @deprecated Use {@link #getSashModelChecked(ServicesRegistry)} instead
*/
+ @Deprecated
public static SashModel getSashModelChecked() throws ServiceException {
return (SashModel)ServiceUtilsForActionHandlers.getInstance().getModelSet().getModel(SashModel.MODEL_ID);
@@ -58,10 +62,10 @@ public class SashModelUtils {
/**
* Gets the SashModel from the {@link ModelSet}. <br>
- *
+ *
* @param modelsManager
* The modelManager containing the requested model.
- *
+ *
* @return The {@link SashModel} registered in modelManager, or null if not
* found.
*/
@@ -72,10 +76,10 @@ public class SashModelUtils {
/**
* Gets the SashModel from the {@link ModelSet}. <br>
- *
+ *
* @param ServicesRegistry
* The servie registry under which the ModelSet is registered.
- *
+ *
* @return The {@link SashModel} registered in modelManager, or null if not
* found.
*/
@@ -90,10 +94,10 @@ public class SashModelUtils {
/**
* Gets the SashModel from the {@link ModelSet}. <br>
- *
+ *
* @param ServicesRegistry
* The servie registry under which the ModelSet is registered.
- *
+ *
* @return The {@link SashModel} registered in modelManager, or null if not
* found.
* @throws ServiceException
@@ -106,7 +110,7 @@ public class SashModelUtils {
/**
* Retrieve the uri of the initial di opened
- *
+ *
* @param modelSet
* @return
*/
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomain.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomain.java
index de7b67ec2eb..0d178b8c6be 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomain.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomain.java
@@ -22,6 +22,7 @@ import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
@@ -92,8 +93,11 @@ public class PapyrusROTransactionalEditingDomain extends TransactionalEditingDom
InternalTransaction tx = getActiveTransaction();
// If there's no transaction, then there will be nothing to roll back. And if it's unprotected, let the client do whatever.
- // And, of course, don't interfere with rollback!
- if((tx != null) && !tx.isRollingBack() && !Boolean.TRUE.equals(tx.getOptions().get(Transaction.OPTION_UNPROTECTED))) {
+ // And, of course, don't interfere with rollback! Finally, if we're already going to roll back, don't bother
+ if((tx != null) && !tx.isRollingBack() //
+ && !Boolean.TRUE.equals(tx.getOptions().get(Transaction.OPTION_UNPROTECTED)) //
+ && !willRollBack(tx)) {
+
boolean readOnly;
// Check for Resource first because CDO resources *are* EObjects
@@ -119,6 +123,11 @@ public class PapyrusROTransactionalEditingDomain extends TransactionalEditingDom
}
}
}
+
+ private boolean willRollBack(Transaction tx) {
+ IStatus status = tx.getStatus();
+ return (status != null) && (status.getSeverity() >= IStatus.ERROR);
+ }
protected boolean makeWritable(Resource resource) {
URI[] uris = getCompositeModelURIs(resource.getURI());
diff --git a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/query/PapyrusOCLQuery.java b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/query/PapyrusOCLQuery.java
index 6e9a377efed..7ffdcef936f 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/query/PapyrusOCLQuery.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/query/PapyrusOCLQuery.java
@@ -31,7 +31,6 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.text.IDocument;
import org.eclipse.ocl.examples.domain.evaluation.DomainModelManager;
-import org.eclipse.ocl.examples.domain.evaluation.EvaluationHaltedException;
import org.eclipse.ocl.examples.domain.utilities.DomainUtil;
import org.eclipse.ocl.examples.domain.values.CollectionValue;
import org.eclipse.ocl.examples.domain.values.impl.InvalidValueException;
@@ -44,7 +43,6 @@ import org.eclipse.ocl.examples.pivot.context.ParserContext;
import org.eclipse.ocl.examples.pivot.evaluation.EvaluationEnvironment;
import org.eclipse.ocl.examples.pivot.evaluation.EvaluationVisitor;
import org.eclipse.ocl.examples.pivot.evaluation.EvaluationVisitorImpl;
-import org.eclipse.ocl.examples.pivot.evaluation.PivotEvaluationEnvironment;
import org.eclipse.ocl.examples.pivot.manager.MetaModelManager;
import org.eclipse.ocl.examples.pivot.utilities.BaseResource;
import org.eclipse.ocl.examples.pivot.utilities.PivotEnvironment;
@@ -243,8 +241,6 @@ public class PapyrusOCLQuery extends AbstractPapyrusQuery {
value = evaluationVisitor.visitExpressionInOCL(expressionInOCL);
} catch (InvalidValueException e) {
value = e;
- } catch (EvaluationHaltedException e) {
- value = new InvalidValueException(ConsoleMessages.Result_EvaluationTerminated);
} catch (Exception e) {
value = new InvalidValueException(e, ConsoleMessages.Result_EvaluationFailure);
} finally {

Back to the top