Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/uml')
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.validation/META-INF/MANIFEST.MF6
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/OCLEValidatorAdapter.java83
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/UMLDiagnostician.java3
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/META-INF/MANIFEST.MF3
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLEditorConfiguration.java4
-rw-r--r--plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/META-INF/MANIFEST.MF3
-rw-r--r--plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/DefaultXtextDirectEditorConfiguration.java4
-rw-r--r--plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.validation/META-INF/MANIFEST.MF6
-rw-r--r--plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.validation/plugin.xml19
9 files changed, 121 insertions, 10 deletions
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.validation/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.uml.service.validation/META-INF/MANIFEST.MF
index da1ee1994bd..24f961c3cd2 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.service.validation/META-INF/MANIFEST.MF
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.validation/META-INF/MANIFEST.MF
@@ -5,8 +5,10 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.emf;bundle-version="2.6.0",
org.eclipse.uml2.uml;bundle-version="4.1.0",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0",
- org.eclipse.gmf.runtime.emf.commands.core;bundle-version="1.4.0"
-Export-Package: org.eclipse.papyrus.uml.service.validation.handler
+ org.eclipse.gmf.runtime.emf.commands.core;bundle-version="1.4.0",
+ org.eclipse.ocl.examples.pivot;bundle-version="3.4.0"
+Export-Package: org.eclipse.papyrus.uml.service.validation,
+ org.eclipse.papyrus.uml.service.validation.handler
Bundle-Vendor: %pluginProvider
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.0.0.qualifier
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/OCLEValidatorAdapter.java b/plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/OCLEValidatorAdapter.java
new file mode 100644
index 00000000000..b12c5dd3b15
--- /dev/null
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/OCLEValidatorAdapter.java
@@ -0,0 +1,83 @@
+/*****************************************************************************
+ * Copyright (c) 2005, 2013 IBM Corporation, CEA, 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:
+ * IBM - Initial API and implementation
+ * Christian W. Damus (CEA) - Target EObject must be the diagnostic's first data element
+ *
+ *****************************************************************************/
+
+
+package org.eclipse.papyrus.uml.service.validation;
+
+import java.util.Map;
+
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.common.util.DiagnosticChain;
+import org.eclipse.emf.validation.model.IConstraintStatus;
+import org.eclipse.ocl.examples.pivot.uml.UMLOCLEValidator;
+import org.eclipse.papyrus.infra.services.validation.EValidatorAdapter;
+import org.eclipse.uml2.uml.InstanceSpecification;
+import org.eclipse.uml2.uml.OpaqueAction;
+import org.eclipse.uml2.uml.OpaqueBehavior;
+import org.eclipse.uml2.uml.OpaqueExpression;
+
+
+/**
+ * An adapter that plugs the EMF Model Validation Service API into the
+ * {@link org.eclipse.emf.ecore.EValidator} API.
+ * <p>
+ * <strong>NOTE</strong> that this class was copied from the EMF Validation
+ * "Validation Adapter" example project as created by the EMF Validation SDK,
+ * and modified only to ensure that the {@link Diagnostic} created from an
+ * {@link IConstraintStatus} has the original validation target element as the
+ * first element of the {@linkplain Diagnostic#getData() data list} because the
+ * {@linkplain IConstraintStatus#getResultLocus() result locus} of a constraint
+ * status is an unordered set.
+ * </p>
+ *
+ * bug 405160 - avoid "false" errors by using the UMLValidator instead of EObjectValidator as base class
+ */
+public class OCLEValidatorAdapter
+ extends EValidatorAdapter {
+
+ @Override
+ public boolean validateInstanceSpecification(InstanceSpecification instanceSpecification,
+ DiagnosticChain diagnostics, Map<Object, Object> context) {
+ if (!super.validateInstanceSpecification(instanceSpecification, diagnostics, context)) {
+ return false;
+ }
+ return UMLOCLEValidator.INSTANCE.validateInstanceSpecification(instanceSpecification, diagnostics, context);
+ }
+
+ @Override
+ public boolean validateOpaqueAction(OpaqueAction opaqueAction,
+ DiagnosticChain diagnostics, Map<Object, Object> context) {
+ if (!super.validateOpaqueAction(opaqueAction, diagnostics, context)) {
+ return false;
+ }
+ return UMLOCLEValidator.INSTANCE.validateOpaqueAction(opaqueAction, diagnostics, context);
+ }
+
+ @Override
+ public boolean validateOpaqueBehavior(OpaqueBehavior opaqueBehavior,
+ DiagnosticChain diagnostics, Map<Object, Object> context) {
+ if (!super.validateOpaqueBehavior(opaqueBehavior, diagnostics, context)) {
+ return false;
+ }
+ return UMLOCLEValidator.INSTANCE.validateOpaqueBehavior(opaqueBehavior, diagnostics, context);
+ }
+
+ @Override
+ public boolean validateOpaqueExpression(OpaqueExpression opaqueExpression,
+ DiagnosticChain diagnostics, Map<Object, Object> context) {
+ if (!super.validateOpaqueExpression(opaqueExpression, diagnostics, context)) {
+ return false;
+ }
+ return UMLOCLEValidator.INSTANCE.validateOpaqueExpression(opaqueExpression, diagnostics, context);
+ }
+}
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 3ebc492a721..407a2cdbc3d 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
@@ -33,9 +33,10 @@ import org.eclipse.uml2.uml.util.UMLUtil;
public class UMLDiagnostician extends EcoreDiagnostician {
public UMLDiagnostician() {
+ super(new OCLEValidatorAdapter());
validateStereotype = false;
}
-
+
protected boolean doValidateStereotypeApplications(EObject eObject, DiagnosticChain diagnostics, Map<Object, Object> context) {
if (validateStereotype) {
// this function is called recursively. Avoid trying to obtain stereotype applications, if we are
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 bca18dbab5b..8fab5fb51f0 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
@@ -12,7 +12,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.7.0",
org.apache.log4j;bundle-version="1.2.15",
org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.services.validation;bundle-version="1.0.0"
+ org.eclipse.papyrus.infra.services.validation;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.service.validation;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.0.0.qualifier
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 72e34337304..7793c52791f 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
@@ -34,9 +34,9 @@ import org.eclipse.ocl.examples.pivot.ParserException;
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.AbstractValidateCommand;
import org.eclipse.papyrus.infra.services.validation.commands.AsyncValidateSubtreeCommand;
+import org.eclipse.papyrus.uml.service.validation.UMLDiagnostician;
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;
@@ -183,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));
- final AbstractValidateCommand validationCommand = new AsyncValidateSubtreeCommand(semanticObject, new EcoreDiagnostician());
+ final AbstractValidateCommand validationCommand = new AsyncValidateSubtreeCommand(semanticObject, new UMLDiagnostician());
validationCommand.disableUIFeedback();
result.add(validationCommand);
}
diff --git a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/META-INF/MANIFEST.MF b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/META-INF/MANIFEST.MF
index 4cb1b462ab4..f1ac78167c2 100644
--- a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/META-INF/MANIFEST.MF
+++ b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/META-INF/MANIFEST.MF
@@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.gef;bundle-version="3.9.0",
org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0",
org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.0.0",
org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.0"
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.service.validation;bundle-version="1.0.0"
Export-Package: org.eclipse.papyrus.uml.xtext.integration
Bundle-Vendor: Eclipse Modeling Project
Bundle-Version: 1.0.0.qualifier
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 7afbf7b7436..e94d70bf73b 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
@@ -36,9 +36,9 @@ import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.papyrus.extensionpoints.editors.configuration.DefaultDirectEditorConfiguration;
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.AbstractValidateCommand;
import org.eclipse.papyrus.infra.services.validation.commands.AsyncValidateSubtreeCommand;
+import org.eclipse.papyrus.uml.service.validation.UMLDiagnostician;
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;
@@ -164,7 +164,7 @@ public abstract class DefaultXtextDirectEditorConfiguration extends DefaultDirec
} else {
result.add(createInvalidStringCommand(newString, semanticObject));
}
- AbstractValidateCommand validationCommand = new AsyncValidateSubtreeCommand(semanticObject, new EcoreDiagnostician());
+ AbstractValidateCommand validationCommand = new AsyncValidateSubtreeCommand(semanticObject, new UMLDiagnostician());
validationCommand.disableUIFeedback();
result.add(validationCommand);
return result;
diff --git a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.validation/META-INF/MANIFEST.MF b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.validation/META-INF/MANIFEST.MF
index 146e6bf4cdd..94bb0359b93 100644
--- a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.validation/META-INF/MANIFEST.MF
+++ b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.validation/META-INF/MANIFEST.MF
@@ -3,7 +3,11 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.9.0",
org.eclipse.emf.ecore;bundle-version="2.9.0",
org.eclipse.emf.validation;bundle-version="1.7.0",
org.eclipse.uml2.uml;bundle-version="4.1.0",
- org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="1.0.0"
+ org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="1.0.0",
+ com.google.inject;bundle-version="3.0.0",
+ org.eclipse.xtext;bundle-version="2.5.1",
+ org.eclipse.jface;bundle-version="3.10.0",
+ org.eclipse.ui;bundle-version="3.106.0"
Export-Package: org.eclipse.papyrus.uml.xtext.integration.validation
Bundle-Vendor: Eclipse Modeling Project
Bundle-ActivationPolicy: lazy
diff --git a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.validation/plugin.xml b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.validation/plugin.xml
index 3b7c5bf747a..fecdb0836e0 100644
--- a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.validation/plugin.xml
+++ b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.validation/plugin.xml
@@ -33,6 +33,25 @@
class="uml.Element">
</target>
</constraint>
+ <constraint
+ class="org.eclipse.papyrus.uml.xtext.integration.validation.ValidateOCLViaXtext"
+ id="org.eclipse.papyrus.uml.xtext.integration.validation.ValidateOCLViaXtext"
+ isEnabledByDefault="true"
+ lang="Java"
+ mode="Batch"
+ name="Validate OCL constraints via xtext"
+ severity="ERROR"
+ statusCode="0">
+ <message>
+ A {0} OCL validation problems found
+ </message>
+ <description>
+ If xtext finds validation errors within a UML constraint
+ </description>
+ <target
+ class="uml.Element">
+ </target>
+ </constraint>
</constraints>
</constraintProvider>
</extension>

Back to the top