Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2014-03-07 09:40:42 +0000
committerAnsgar Radermacher2014-03-07 09:41:40 +0000
commit96c969a23f37f99de331462eccd99151b8152292 (patch)
tree6e8dbabe88f02bb445dbe7f10d099e73c291e2fd /plugins/uml
parent6f332093a09441066c01c24f8f6389dfcf514384 (diff)
downloadorg.eclipse.papyrus-96c969a23f37f99de331462eccd99151b8152292.tar.gz
org.eclipse.papyrus-96c969a23f37f99de331462eccd99151b8152292.tar.xz
org.eclipse.papyrus-96c969a23f37f99de331462eccd99151b8152292.zip
Bug 427863 - Constraint does not show ValueSpecification error marker + NLS corrections in validation service
Diffstat (limited to 'plugins/uml')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/ValidationDecoratorProvider.java46
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/UMLDiagnostician.java2
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.services.decoration/src/org/eclipse/papyrus/uml/services/decoration/UMLDecorationService.java12
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/META-INF/MANIFEST.MF1
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLEditorConfiguration.java5
-rw-r--r--plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/DefaultXtextDirectEditorConfiguration.java5
6 files changed, 56 insertions, 15 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/ValidationDecoratorProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/ValidationDecoratorProvider.java
index a12ed42a3c2..c3d6e9943e4 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/ValidationDecoratorProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/ValidationDecoratorProvider.java
@@ -24,6 +24,8 @@ import java.util.Map;
import java.util.Observable;
import java.util.Observer;
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.gef.EditPart;
@@ -41,9 +43,12 @@ import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.services.decoration.DecorationChange;
import org.eclipse.papyrus.infra.services.decoration.DecorationChange.DecorationChangeKind;
import org.eclipse.papyrus.infra.services.decoration.DecorationService;
+import org.eclipse.papyrus.infra.services.decoration.util.Decoration;
import org.eclipse.papyrus.infra.services.decoration.util.IPapyrusDecoration;
import org.eclipse.papyrus.uml.diagram.common.util.ServiceUtilsForGMF;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.ValueSpecification;
/**
* Generic validation decorator provider (for the case application == null)
@@ -176,7 +181,10 @@ public abstract class ValidationDecoratorProvider extends AbstractProvider imple
}
if(view.getElement() != null) {
diagramDecorationAdapter.removeDecorations();
- List<IPapyrusDecoration> semanticDecorations = decorationService.getDecorations(view.getElement(), false);
+ List<IPapyrusDecoration> semanticDecorations = new BasicEList<IPapyrusDecoration>();
+ for (Object decoratedElement : getDecoratedElements(element)) {
+ semanticDecorations.addAll(decorationService.getDecorations(decoratedElement, false));
+ }
List<IPapyrusDecoration> graphicalDecorations = decorationService.getDecorations(view, false);
List<IPapyrusDecoration> decorations = new LinkedList<IPapyrusDecoration>(semanticDecorations);
@@ -266,11 +274,43 @@ public abstract class ValidationDecoratorProvider extends AbstractProvider imple
// check whether update is for this view
if(arg instanceof DecorationChange) {
DecorationChange change = (DecorationChange)arg;
- if((change.getChangeKind() == DecorationChangeKind.RefreshAll) || (change.getDecoration().getElement() == element)) {
+ if((change.getChangeKind() == DecorationChangeKind.RefreshAll) || decorationMatches(element, change.getDecoration())) {
refresh(change);
}
}
}
+
+ /**
+ * Return the list of elements that correspond to a viewElement. In most cases, this list
+ * contains just the view element. But some decorations need to apply to multiple elements.
+ * In particular, decorations for a value specification of a constraint need to apply for the
+ * constraint as well - see bug 427863 - Constraint does not show ValueSpecification error marker
+ * @param viewElement
+ * @return the list of observed decorations
+ */
+ public EList<Object> getDecoratedElements(Object viewElement) {
+ EList<Object> decoratedElements = new BasicEList<Object>();
+ decoratedElements.add(viewElement);
+ /**
+ * Add decorations of specification to constraint.
+ */
+ if (element instanceof Constraint) {
+ ValueSpecification vs = ((Constraint) element).getSpecification();
+ if (vs != null) {
+ decoratedElements.add(vs);
+ }
+ }
+ return decoratedElements;
+ }
+
+ /**
+ * Does the viewElement match a decoration?
+ * @param viewElement the element behind a view
+ * @param decoration a decoration
+ * @return true, if matches
+ */
+ public boolean decorationMatches(Object viewElement, Decoration decoration) {
+ return getDecoratedElements(viewElement).contains(decoration.getElement());
+ }
}
-
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/UMLDiagnostician.java b/plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/UMLDiagnostician.java
index dcf0dd35d6e..3ebc492a721 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/UMLDiagnostician.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/UMLDiagnostician.java
@@ -28,7 +28,7 @@ import org.eclipse.uml2.uml.util.UMLUtil;
/**
* This is a specific diagnostician used to validate stereotype applications
- *k
+ *
*/
public class UMLDiagnostician extends EcoreDiagnostician {
diff --git a/plugins/uml/org.eclipse.papyrus.uml.services.decoration/src/org/eclipse/papyrus/uml/services/decoration/UMLDecorationService.java b/plugins/uml/org.eclipse.papyrus.uml.services.decoration/src/org/eclipse/papyrus/uml/services/decoration/UMLDecorationService.java
index da1fa33719a..d9b427a33a1 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.services.decoration/src/org/eclipse/papyrus/uml/services/decoration/UMLDecorationService.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.services.decoration/src/org/eclipse/papyrus/uml/services/decoration/UMLDecorationService.java
@@ -8,7 +8,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Patrick Tessier (CEA LIST)- initial implementation
+ * Patrick Tessier (CEA LIST) - initial implementation
+ * Ansgar Radermacher (CEA List) - refactored stereotype handling, support for qualified name
*****************************************************************************/
package org.eclipse.papyrus.uml.services.decoration;
@@ -17,14 +18,13 @@ import org.eclipse.uml2.uml.NamedElement;
/**
- * overload the Generic decoration service to take in account validation on stereotyped element
+ * Providing qualified name in the tool-tip message shown in the model explorer
*
- * CAVEAT: this class is currently unused, since the validation mechanism already replaces a stereotype application
- * by its base element (see org.eclipse.papyurs.uml.service.validation.StereotypeValidatorAdaptor)
+ * Originally, this class was intended for stereotypes, now the handling of stereotypes is done in
+ * @see org.eclipse.papyrus.uml.service.validation.UMLDiagnostician.
*/
-
public class UMLDecorationService extends DecorationService {
-
+
/**
* Initial message for UML elements
* @return the qualified name of the element, if it is a named element
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/META-INF/MANIFEST.MF
index 2a80241edd6..bca18dbab5b 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/META-INF/MANIFEST.MF
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/META-INF/MANIFEST.MF
@@ -2,7 +2,6 @@ Manifest-Version: 1.0
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.gmfdiag.xtext.glue;bundle-version="1.0.0",
org.eclipse.uml2.uml;bundle-version="3.2.0",
org.eclipse.ocl.examples.xtext.essentialocl.ui;bundle-version="3.1.0",
org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLEditorConfiguration.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLEditorConfiguration.java
index b82cc201fd6..72e34337304 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLEditorConfiguration.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLEditorConfiguration.java
@@ -35,7 +35,8 @@ import org.eclipse.ocl.examples.pivot.utilities.BaseResource;
import org.eclipse.ocl.examples.pivot.utilities.PivotUtil;
import org.eclipse.ocl.examples.xtext.essentialocl.EssentialOCLRuntimeModule;
import org.eclipse.papyrus.infra.services.validation.EcoreDiagnostician;
-import org.eclipse.papyrus.infra.services.validation.commands.ValidateSubtreeCommand;
+import org.eclipse.papyrus.infra.services.validation.commands.AbstractValidateCommand;
+import org.eclipse.papyrus.infra.services.validation.commands.AsyncValidateSubtreeCommand;
import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration;
import org.eclipse.papyrus.uml.xtext.integration.core.ContextElementAdapter.IContextElementProvider;
import org.eclipse.papyrus.uml.xtext.integration.core.ContextElementAdapter.IContextElementProviderWithInit;
@@ -182,7 +183,7 @@ public class EssentialOCLEditorConfiguration extends DefaultXtextDirectEditorCon
TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(semanticObject);
if (semanticObject instanceof Constraint) {
result.add(new UpdateConstraintCommand(editingDomain, (Constraint) semanticObject, newString));
- ValidateSubtreeCommand validationCommand = new ValidateSubtreeCommand(semanticObject, new EcoreDiagnostician());
+ final AbstractValidateCommand validationCommand = new AsyncValidateSubtreeCommand(semanticObject, new EcoreDiagnostician());
validationCommand.disableUIFeedback();
result.add(validationCommand);
}
diff --git a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/DefaultXtextDirectEditorConfiguration.java b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/DefaultXtextDirectEditorConfiguration.java
index fd4850eecc2..7afbf7b7436 100644
--- a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/DefaultXtextDirectEditorConfiguration.java
+++ b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/DefaultXtextDirectEditorConfiguration.java
@@ -37,7 +37,8 @@ import org.eclipse.papyrus.extensionpoints.editors.configuration.DefaultDirectEd
import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
import org.eclipse.papyrus.infra.services.validation.EcoreDiagnostician;
-import org.eclipse.papyrus.infra.services.validation.commands.ValidateSubtreeCommand;
+import org.eclipse.papyrus.infra.services.validation.commands.AbstractValidateCommand;
+import org.eclipse.papyrus.infra.services.validation.commands.AsyncValidateSubtreeCommand;
import org.eclipse.papyrus.uml.xtext.integration.core.ContextElementAdapter;
import org.eclipse.papyrus.uml.xtext.integration.core.ContextElementAdapter.IContextElementProvider;
import org.eclipse.papyrus.uml.xtext.integration.core.ContextElementAdapter.IContextElementProviderWithInit;
@@ -163,7 +164,7 @@ public abstract class DefaultXtextDirectEditorConfiguration extends DefaultDirec
} else {
result.add(createInvalidStringCommand(newString, semanticObject));
}
- ValidateSubtreeCommand validationCommand = new ValidateSubtreeCommand(semanticObject, new EcoreDiagnostician());
+ AbstractValidateCommand validationCommand = new AsyncValidateSubtreeCommand(semanticObject, new EcoreDiagnostician());
validationCommand.disableUIFeedback();
result.add(validationCommand);
return result;

Back to the top