Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptessier2013-05-15 13:03:11 +0000
committerptessier2013-05-15 13:03:11 +0000
commit66b9f173f3f5a226cceab2d45fd502258fa10822 (patch)
tree5fb2ecc450e868fdeca82417bf020fdf91529fe2 /extraplugins
parent681513a14077c724c1de43022596ca0dab7d8c24 (diff)
downloadorg.eclipse.papyrus-66b9f173f3f5a226cceab2d45fd502258fa10822.tar.gz
org.eclipse.papyrus-66b9f173f3f5a226cceab2d45fd502258fa10822.tar.xz
org.eclipse.papyrus-66b9f173f3f5a226cceab2d45fd502258fa10822.zip
382733: [validation] Papyrus shall to compute constraints from the profile at the model level
https://bugs.eclipse.org/bugs/show_bug.cgi?id=382733
Diffstat (limited to 'extraplugins')
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generation.ui/src/org/eclipse/papyrus/dsml/validation/generation/ui/CreateJavaValidationPluginHandler.java1
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/build.acceleo2
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/src/org/eclipse/papyrus/dsml/validation/generator/main/Generate.java6
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/tasks/generate.xml56
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintCategoryImpl.java23
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintManagerImpl.java68
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintProviderImpl.java12
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ValidationRuleImpl.java6
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintProvider.java7
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintsCategory.java2
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.wizard/src/org/eclipse/papyrus/dsml/validation/generation/wizard/ValidationPluginGenerator.java43
11 files changed, 87 insertions, 139 deletions
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generation.ui/src/org/eclipse/papyrus/dsml/validation/generation/ui/CreateJavaValidationPluginHandler.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generation.ui/src/org/eclipse/papyrus/dsml/validation/generation/ui/CreateJavaValidationPluginHandler.java
index 40650491eb8..32894b8c49b 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generation.ui/src/org/eclipse/papyrus/dsml/validation/generation/ui/CreateJavaValidationPluginHandler.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generation.ui/src/org/eclipse/papyrus/dsml/validation/generation/ui/CreateJavaValidationPluginHandler.java
@@ -21,6 +21,7 @@ import org.eclipse.emf.ecore.EPackage;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.dsml.validation.generation.wizard.CreateEMFValidationProject;
import org.eclipse.papyrus.dsml.validation.model.elements.impl.ConstraintManagerImpl;
+import org.eclipse.papyrus.dsml.validation.model.elements.interfaces.Category;
import org.eclipse.papyrus.dsml.validation.model.elements.interfaces.IConstraintProvider;
import org.eclipse.papyrus.dsml.validation.model.elements.interfaces.IConstraintsCategory;
import org.eclipse.papyrus.dsml.validation.model.elements.interfaces.IConstraintsManager;
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/build.acceleo b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/build.acceleo
index 27f8f136eaa..4d2f3d219f3 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/build.acceleo
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/build.acceleo
@@ -18,7 +18,7 @@
<acceleoCompiler
sourceFolder="${target.folder}"
outputFolder="${target.folder}"
- dependencies="${target.folder}/../../org.eclipse.papyrus.dsml.validation.model;${target.folder}/../../org.eclipse.papyrus.infra.core;${target.folder}/../../org.eclipse.papyrus.infra.core.sasheditor;${target.folder}/../../org.eclipse.papyrus.infra.core.log;${target.folder}/../../org.eclipse.papyrus.infra.core.sasheditor.di;${target.folder}/../../org.eclipse.papyrus.infra.widgets;${target.folder}/../../org.eclipse.papyrus.infra.tools;${target.folder}/../../org.eclipse.papyrus.uml.diagram.wizards;${target.folder}/../../org.eclipse.papyrus.infra.widgets.toolbox;${target.folder}/../../org.eclipse.papyrus.uml.diagram.profile;${target.folder}/../../org.eclipse.papyrus.extensionpoints.editors;${target.folder}/../../org.eclipse.papyrus.infra.constraints;${target.folder}/../../org.eclipse.papyrus.infra.emf;${target.folder}/../../org.eclipse.papyrus.uml.diagram.common;${target.folder}/../../org.eclipse.papyrus.uml.tools.utils;${target.folder}/../../org.eclipse.papyrus.editor;${target.folder}/../../org.eclipse.papyrus.uml.pastemanager;${target.folder}/../../org.eclipse.papyrus.infra.gmfdiag.commands;${target.folder}/../../org.eclipse.papyrus.infra.services.edit;${target.folder}/../../org.eclipse.papyrus.infra.gmfdiag.common;${target.folder}/../../org.eclipse.papyrus.infra.emf.appearance;${target.folder}/../../org.eclipse.papyrus.infra.gmfdiag.preferences;${target.folder}/../../org.eclipse.papyrus.infra.extendedtypes;${target.folder}/../../org.eclipse.papyrus.infra.queries.core.configuration;${target.folder}/../../org.eclipse.papyrus.infra.queries.core;${target.folder}/../../org.eclipse.papyrus.uml.service.types;${target.folder}/../../org.eclipse.papyrus.uml.tools;${target.folder}/../../org.eclipse.papyrus.infra.services.validation;${target.folder}/../../org.eclipse.papyrus.infra.services.decoration;${target.folder}/../../org.eclipse.papyrus.infra.gmfdiag.navigation;${target.folder}/../../org.eclipse.papyrus.views.modelexplorer;${target.folder}/../../org.eclipse.papyrus.uml.diagram.navigation;${target.folder}/../../org.eclipse.papyrus.infra.services.resourceloading;${target.folder}/../../org.eclipse.papyrus.infra.services.controlmode.history;${target.folder}/../../org.eclipse.papyrus.infra.services.resourceloading.preferences;${target.folder}/../../org.eclipse.papyrus.uml.resourceloading.profile;${target.folder}/../../org.eclipse.papyrus.infra.hyperlink;${target.folder}/../../org.eclipse.papyrus.uml.profile;${target.folder}/../../org.eclipse.papyrus.infra.emf.readonly;${target.folder}/../../org.eclipse.papyrus.infra.onefile;${target.folder}/../../org.eclipse.papyrus.infra.ui.resources;${target.folder}/../../org.eclipse.papyrus.infra.services.controlmode;${target.folder}/../../org.eclipse.papyrus.uml.extensionpoints;${target.folder}/../../org.eclipse.papyrus.uml.appearance;${target.folder}/../../org.eclipse.papyrus.sysml.diagram.ui;${target.folder}/../../org.eclipse.papyrus.sysml.diagram.common;${target.folder}/../../org.eclipse.papyrus.sysml;${target.folder}/../../org.eclipse.papyrus.sysml.service.types;${target.folder}/../../org.eclipse.papyrus.uml.modelexplorer.widgets;${target.folder}/../../org.eclipse.papyrus.views.modelexplorer.widgets;${target.folder}/../../org.eclipse.papyrus.dsml.validation;"
+ dependencies="${target.folder}/../../org.eclipse.papyrus.dsml.validation.model;${target.folder}/../../org.eclipse.papyrus.infra.core;${target.folder}/../../org.eclipse.papyrus.infra.core.sasheditor;${target.folder}/../../org.eclipse.papyrus.infra.core.log;${target.folder}/../../org.eclipse.papyrus.infra.core.sasheditor.di;${target.folder}/../../org.eclipse.papyrus.infra.tools;${target.folder}/../../org.eclipse.papyrus.dsml.validation;"
binaryResource="false"
packagesToRegister="">
</acceleoCompiler>
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/src/org/eclipse/papyrus/dsml/validation/generator/main/Generate.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/src/org/eclipse/papyrus/dsml/validation/generator/main/Generate.java
index 7e0bbc5a318..fd1beb057ce 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/src/org/eclipse/papyrus/dsml/validation/generator/main/Generate.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/src/org/eclipse/papyrus/dsml/validation/generator/main/Generate.java
@@ -340,9 +340,15 @@ public class Generate extends AbstractAcceleoGenerator {
@Override
public void registerPackages(ResourceSet resourceSet) {
super.registerPackages(resourceSet);
+ if (!isInWorkspace(org.eclipse.uml2.uml.UMLPackage.class)) {
+ resourceSet.getPackageRegistry().put(org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getNsURI(), org.eclipse.uml2.uml.UMLPackage.eINSTANCE);
+ }
if (!isInWorkspace(org.eclipse.emf.validation.internal.modeled.model.validation.ValidationPackage.class)) {
resourceSet.getPackageRegistry().put(org.eclipse.emf.validation.internal.modeled.model.validation.ValidationPackage.eINSTANCE.getNsURI(), org.eclipse.emf.validation.internal.modeled.model.validation.ValidationPackage.eINSTANCE);
}
+ if (!isInWorkspace(org.eclipse.emf.ecore.EcorePackage.class)) {
+ resourceSet.getPackageRegistry().put(org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getNsURI(), org.eclipse.emf.ecore.EcorePackage.eINSTANCE);
+ }
/*
* If you want to change the content of this method, do NOT forget to change the "@generated"
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/tasks/generate.xml b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/tasks/generate.xml
index 566ecfee7aa..34518587f35 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/tasks/generate.xml
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/tasks/generate.xml
@@ -1,39 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<project default="generate" name="org.eclipse.papyrus.dsml.validation.generator">
- <property name="ECLIPSE_HOME" value="../../../../../../Eclipses/Eclipse Juno Modeling/eclipse"/>
+ <property name="ECLIPSE_HOME" value="../../../../ECLIPSE/eclipse-classic-kepler-M7-win32-x86_64/eclipse"/>
<property name="ECLIPSE_WORKSPACE" value="../.."/>
<!-- The classpath with only the dependencies used by the project -->
<path id="org.eclipse.papyrus.dsml.validation.generator.libraryclasspath">
<pathelement location="${ECLIPSE_WORKSPACE}/org.eclipse.papyrus.dsml.validation.generator/bin"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.runtime_3.8.0.v20120521-2346.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.osgi_3.8.0.v20120529-1548.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.equinox.common_3.6.100.v20120522-1841.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.jobs_3.5.200.v20120521-2346.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.runtime.compatibility.registry_3.5.100.v20120521-2346/runtime_registry_compatibility.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.equinox.registry_3.5.200.v20120522-1841.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.equinox.preferences_3.5.0.v20120522-1841.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.contenttype_3.4.200.v20120523-2004.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.equinox.app_1.3.100.v20120522-1841.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.uml2.uml_4.0.1.v20120913-1441.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.ecore_2.8.1.v20120911-0500.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.common_2.8.0.v20120911-0500.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.ecore.xmi_2.8.0.v20120911-0500.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.uml2.common_1.7.0.v20120913-1441.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.uml2.types_1.0.0.v20120913-1441.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.mapping.ecore2xml_2.7.0.v20120917-0436.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.validation_1.4.0.v20100428-2315.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.resources_3.8.0.v20120522-2034.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.ocl_3.2.1.v20120917-1739.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.runtime_3.9.0.v20130326-1255.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.osgi_3.9.0.v20130410-1557.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.equinox.common_3.6.200.v20130402-1505.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.jobs_3.5.300.v20130429-1813.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.runtime.compatibility.registry_3.5.200.v20130326-1255/runtime_registry_compatibility.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.equinox.registry_3.5.300.v20130327-1442.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.equinox.preferences_3.5.100.v20130422-1538.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.contenttype_3.4.200.v20130326-1255.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.equinox.app_1.3.100.v20130327-1442.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.uml2.uml_4.1.0.v20130506-1015.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.ecore_2.9.0.v20130430-1108.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.common_2.9.0.v20130430-1108.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.ecore.xmi_2.9.0.v20130430-1108.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.uml2.common_1.8.0.v20130506-1015.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.uml2.types_1.0.100.v20130506-1015.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.mapping.ecore2xml_2.7.0.v20130506-0438.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.validation_1.7.0.201305071340.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.resources_3.8.100.v20130213-1252.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.ocl_3.3.0.v20130506-1149.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/lpg.runtime.java_2.0.17.v201004271640.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.ocl.common_1.0.0.v20120516-1543.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.ocl.ecore_3.2.0.v20120522-1637.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.common_3.3.1.v20120831-0923.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.engine_3.3.1.v20120831-0923.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.model_3.3.1.v20120831-0923.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.profiler_3.3.1.v20120831-0923.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.codegen.ecore_2.8.1.v20120917-0436.jar"/>
- <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.codegen_2.8.0.v20120917-0436.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.ocl.common_1.1.0.v20130405-1338.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.ocl.ecore_3.3.0.v20130405-1935.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.common_3.4.0.201304261210.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.engine_3.4.0.201304261210.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.model_3.4.0.201304261210.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.profiler_3.4.0.201304261210.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.codegen.ecore_2.9.0.v20130506-0438.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.codegen_2.9.0.v20130506-0438.jar"/>
</path>
<path id="org.eclipse.papyrus.dsml.validation.generator.classpath">
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintCategoryImpl.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintCategoryImpl.java
index 2694960b1af..576032b56d1 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintCategoryImpl.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintCategoryImpl.java
@@ -24,9 +24,7 @@ import org.eclipse.papyrus.dsml.validation.model.elements.interfaces.IValidation
*
*
*/
-public class ConstraintCategoryImpl implements IConstraintsCategory {
-
- private List<Category> categories = new ArrayList<Category>();
+public class ConstraintCategoryImpl extends CategoryImpl implements IConstraintsCategory {
private List<IValidationRule> constraints = new ArrayList<IValidationRule>();
@@ -39,11 +37,8 @@ public class ConstraintCategoryImpl implements IConstraintsCategory {
*
* @param category
*/
- public ConstraintCategoryImpl(Category category) {
-
- this.categories.add(category);
- this.categoriesList = this.createCategoriesString(category);
-
+ public ConstraintCategoryImpl(String name, Category parentCategory) {
+ super(name, parentCategory);
}
/**
@@ -55,18 +50,6 @@ public class ConstraintCategoryImpl implements IConstraintsCategory {
return this.categoriesList;
}
-
- private String createCategoriesString(Category category) {
-
- if (category.getParentCategory() == null) {
- return category.getID();
- }
-
- return createCategoriesString(category.getParentCategory()) + ", "
- + category.getID();
-
- }
-
/**
*
* @see org.eclipse.papyrus.dsml.validation.model.elements.interfaces.IConstraintsCategory#getConstraints()
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintManagerImpl.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintManagerImpl.java
index 681894e5ded..8571633e396 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintManagerImpl.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintManagerImpl.java
@@ -35,18 +35,9 @@ import org.eclipse.uml2.uml.Stereotype;
*
*/
public class ConstraintManagerImpl implements IConstraintsManager {
-
-
- private List<Category> categories = new ArrayList<Category>();
private List<IConstraintProvider> constraintsProviders = new ArrayList<IConstraintProvider>();
- private List<IConstraintsCategory> constraintsCategories = new ArrayList<IConstraintsCategory>();
-
- private Map<Category, List<Category>> categoryToCategories = new HashMap<Category, List<Category>>();
-
- private Map<Category, List<IValidationRule>> categoryToValidationRules = new HashMap<Category, List<IValidationRule>>();
-
private Map<Stereotype, List<Constraint>> constraintsOfStereotype = new HashMap<Stereotype, List<Constraint>>();
private Category primeCategory;
@@ -84,12 +75,6 @@ public class ConstraintManagerImpl implements IConstraintsManager {
//construct all sub categories
relateCategoriesWithConstraints(root, primeCategory);
-
- //construct one constraint provider
- constraintProvider = new ConstraintProviderImpl();
- // associate validation to category to provider
- constraintProvider.addConstraintCategories(createConstraintCategories());
- constraintsProviders.add(constraintProvider);
}
/**
@@ -109,48 +94,43 @@ public class ConstraintManagerImpl implements IConstraintsManager {
if (element instanceof Profile) {
- Category subCategory;
- //creation of the list of subcategory
- List<Category> subCategories = new ArrayList<Category>();
- List<IValidationRule> subValidationRules;
+ //creation of a category
+ ConstraintCategoryImpl subCategory =new ConstraintCategoryImpl(((Profile)element).getName(), category );
+ // add the category to the list of category
+ category.getSubcategories().add(subCategory);
+ //creation of a provider
+ //construct one constraint provider
+ constraintProvider = new ConstraintProviderImpl();
+ // associate validation to category to provider
+ constraintProvider.getConstraintsCategories().add(subCategory);
+ constraintsProviders.add(constraintProvider);
+ if (((Profile)element).getDefinition()!=null){
+ constraintProvider.setEPackage(((Profile)element).getDefinition());
+ }
//iterate on all direct element of the profile
for (NamedElement subElement : ((Profile) element).getOwnedMembers()) {
//this a profile
if (subElement instanceof Profile) {
- //creation of a new sub categorie
- subCategory = createCategory(category, subElement);
- subCategories.add(subCategory);
this.relateCategoriesWithConstraints(subElement,subCategory);
}
else if (subElement instanceof Stereotype) {
- subCategory = createCategory(category, subElement);
- subCategories.add(subCategory);
- this.categories.add(subCategory);
//create validation rules
- subValidationRules = new ArrayList<IValidationRule>();
if (this.constraintsOfStereotype.get(subElement) != null) {
for (Constraint constraint : this.constraintsOfStereotype.get(subElement)) {
try {
- subValidationRules.add(new ValidationRuleImpl(constraint, subCategory));
+ subCategory.getConstraints().add(new ValidationRuleImpl(constraint, subCategory));
} catch (WrongStereotypeException e) {
e.printStackTrace();
}
}
}
- //associate rules with the sub category
- this.categoryToValidationRules.put(subCategory, subValidationRules);
}
}
- // associate the subcategories to the category
- this.categoryToCategories.put(category, subCategories);
- //add the sub category of the category owner
- category.addSubcategories(subCategories);
- // add the category to the list of category
- this.categories.add(category);
+
}
}
@@ -205,24 +185,6 @@ public class ConstraintManagerImpl implements IConstraintsManager {
}
/**
- * Definition of a list of constraint categories in regards to the profile
- * model.
- *
- * @return list of constraint categories
- */
- private List<IConstraintsCategory> createConstraintCategories() {
-
- for (Category category : this.categoryToValidationRules.keySet()) {
- IConstraintsCategory constraintCategory = new ConstraintCategoryImpl(category);
- constraintCategory.addConstraints(this.categoryToValidationRules.get(category));
- this.constraintsCategories.add(constraintCategory);
- }
-
- return this.constraintsCategories;
-
- }
-
- /**
*
* @see org.eclipse.papyrus.dsml.validation.model.elements.interfaces.IConstraintsManager#getConstraintsProviders()
*
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintProviderImpl.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintProviderImpl.java
index cb52bd1e391..d973d540545 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintProviderImpl.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintProviderImpl.java
@@ -15,6 +15,7 @@ package org.eclipse.papyrus.dsml.validation.model.elements.impl;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.emf.ecore.EPackage;
import org.eclipse.papyrus.dsml.validation.model.elements.interfaces.IConstraintProvider;
import org.eclipse.papyrus.dsml.validation.model.elements.interfaces.IConstraintsCategory;
import org.eclipse.papyrus.dsml.validation.model.elements.interfaces.Mode;
@@ -25,12 +26,10 @@ import org.eclipse.papyrus.dsml.validation.model.elements.interfaces.Mode;
*/
public class ConstraintProviderImpl implements IConstraintProvider {
-
private List<IConstraintsCategory> constraintsCategories = new ArrayList<IConstraintsCategory>();
-
private Mode mode;
-
private boolean cache;
+ private EPackage ePackage=null;
/**
@@ -69,4 +68,11 @@ public class ConstraintProviderImpl implements IConstraintProvider {
this.constraintsCategories.addAll(constraintCategories);
}
+ public EPackage getEPackage() {
+ return ePackage;
+ }
+
+ public void setEPackage(EPackage ePackage){
+ this.ePackage=ePackage;
+ }
}
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ValidationRuleImpl.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ValidationRuleImpl.java
index a54b15313e6..3b9eef0b354 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ValidationRuleImpl.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ValidationRuleImpl.java
@@ -85,11 +85,11 @@ public class ValidationRuleImpl implements IValidationRule {
* value will be assigned and saved in the model.
*/
if (constraint.getValue(stereotype, "id") == null||constraint.getValue(stereotype, "id").equals("")) {
-
- this.id = parentCategory.getID() + "." + this.getName();
+ String qname= constraint.getQualifiedName().replace("::", ".");
+ this.id = qname;
} else {
-
+
this.id = (String) constraint.getValue(stereotype, "id");
}
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintProvider.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintProvider.java
index bef320b79cd..ab8f38b654d 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintProvider.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintProvider.java
@@ -14,6 +14,8 @@ package org.eclipse.papyrus.dsml.validation.model.elements.interfaces;
import java.util.List;
+import org.eclipse.emf.ecore.EPackage;
+
/**
* Interface representing constraint provider from the EMF Validation Framework
*/
@@ -29,6 +31,11 @@ public interface IConstraintProvider {
* @return the cache of the provider
*/
public boolean getCache();
+
+
+ public EPackage getEPackage();
+
+ public void setEPackage(EPackage ePackage);
/**
*
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintsCategory.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintsCategory.java
index ad27bb92744..a3107e1ff0c 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintsCategory.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintsCategory.java
@@ -19,7 +19,7 @@ import java.util.List;
*
*
*/
-public interface IConstraintsCategory {
+public interface IConstraintsCategory extends Category{
/**
*
* @return constraints
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.wizard/src/org/eclipse/papyrus/dsml/validation/generation/wizard/ValidationPluginGenerator.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.wizard/src/org/eclipse/papyrus/dsml/validation/generation/wizard/ValidationPluginGenerator.java
index aae2f8ec23e..1dc04509015 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.wizard/src/org/eclipse/papyrus/dsml/validation/generation/wizard/ValidationPluginGenerator.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.wizard/src/org/eclipse/papyrus/dsml/validation/generation/wizard/ValidationPluginGenerator.java
@@ -62,7 +62,6 @@ public class ValidationPluginGenerator {
private static final String UML_URL = "http://www.eclipse.org/uml2/4.0.0/UML";
- // private final static String contextPrefix = "org.eclipse.papyrus.validation.generation.context";
/**
* singleton
@@ -87,13 +86,13 @@ public class ValidationPluginGenerator {
IOException, SAXException, ParserConfigurationException {
PluginEditor editor;
- String packageName= "org.eclipse.papyrus.validation";
+
this.constraintsManager = constraintsManager;
//prepare the plugin
editor = new PluginEditor(project);
editor.setBundleName(editor.getSymbolicBundleName()+SINGLETON_TRUE);
-
+ String projectName= editor.getBundleName();
Set<String> natures = new HashSet<String>();
natures.add(PLUGIN_NATURE_ID);
editor.addNatures(natures);
@@ -105,7 +104,7 @@ public class ValidationPluginGenerator {
//creation of categories extension point
//that correspond to sub-profiles and stereotypes
- this.createHierarchyOfCategories(packageName,this.constraintsManager.getPrimeCategory(), extension, editor);
+ this.createHierarchyOfCategories(projectName,this.constraintsManager.getPrimeCategory(), extension, editor);
//add the constraint provider extension point, normally it exist only one
for (IConstraintProvider constraintProvider : constraintsManager.getConstraintsProviders()) {
@@ -115,14 +114,13 @@ public class ValidationPluginGenerator {
for (IConstraintsCategory constraintCategory : constraintProvider.getConstraintsCategories()) {
//create the extension point validationRule for category
- Element extElForConstraintsCategory = createExtensionForConstraintsCategory(packageName,
- constraintCategory, extElForConstraintsProvider, editor);
+ Element extElForConstraintsCategory = createExtensionForConstraintsCategory(projectName, constraintCategory, extElForConstraintsProvider, editor, constraintsManager);
for (IValidationRule constraint : constraintCategory.getConstraints()) {
//this is a java constraint?
if (Utils.hasSpecificationForJava(constraint.getConstraint())) {
- createExtensionForConstraint(packageName,constraint,extElForConstraintsCategory, editor);
+ createExtensionForConstraint(projectName,constraint,extElForConstraintsCategory, editor);
}
//this is an OCL constraint?
@@ -136,7 +134,7 @@ public class ValidationPluginGenerator {
}
}
- generateCommonExtension2(packageName,editor);
+ generateCommonExtension2(projectName,editor);
editor.getProject().refreshLocal(0, null);
@@ -304,11 +302,11 @@ public class ValidationPluginGenerator {
Element pcg = editor.addChild(extElForConstraintsProvider, "package");
- if(definition==null){
+ if(constraintProvider.getEPackage()==null){
pcg.setAttribute("namespaceUri",UML_URL);
}
else{
- pcg.setAttribute("namespaceUri",definition.getNsURI());
+ pcg.setAttribute("namespaceUri",constraintProvider.getEPackage().getNsURI());
}
@@ -316,18 +314,10 @@ public class ValidationPluginGenerator {
}
- private Element createExtensionForConstraintsCategory(
- String projectName,IConstraintsCategory constraintsCategory, Element parentElement,
- PluginEditor editor) {
-
- Element extElForConstraintsCategory = editor.getPluginEditor()
- .addChild(parentElement, "constraints");
- String list=constraintsCategory.getCategoriesList();
- list= list.replace(", " , ", "+projectName+SEPARATOR);
- list= list.trim();
- list= projectName+SEPARATOR+list;
- extElForConstraintsCategory.setAttribute("categories",list);
+ private Element createExtensionForConstraintsCategory(String projectName,IConstraintsCategory constraintsCategory, Element parentElement,PluginEditor editor, IConstraintsManager constraintManager) {
+ Element extElForConstraintsCategory = editor.getPluginEditor().addChild(parentElement, "constraints");
+ extElForConstraintsCategory.setAttribute("categories",projectName+SEPARATOR+constraintManager.getPrimeCategory().getName());
return extElForConstraintsCategory;
}
@@ -343,7 +333,7 @@ public class ValidationPluginGenerator {
element.setAttribute(ID,ValidationPluginGenerator.getContextprefix());
element = editor.getPluginEditor().addChild(element, "selector");
- element.setAttribute("class",projectName+SEPARATOR+"ValidationDelegateClientSelector");
+ element.setAttribute("class","org.eclipse.papyrus.validation"+SEPARATOR+"ValidationDelegateClientSelector");
element = editor.getPluginEditor().addChild(extension, "binding");
element.setAttribute("context", ValidationPluginGenerator.getContextprefix());
@@ -361,11 +351,8 @@ public class ValidationPluginGenerator {
*/
private void createHierarchyOfCategories(String projectName, Category category,Element parentElement, PluginEditor editor) {
- Element subElement = this.createExtensionForCategory(projectName, category,parentElement, editor);
+ this.createExtensionForCategory(projectName, category,parentElement, editor);
- for (Category subCategory : category.getSubcategories()) {
- this.createHierarchyOfCategories(projectName,subCategory, subElement, editor);
- }
}
@@ -374,10 +361,6 @@ public class ValidationPluginGenerator {
Element subElement = editor.addChild(parentElement, "category");
subElement.setAttribute("ref",projectName+SEPARATOR+ category.getID());
- for (Category subCategory : category.getSubcategories()) {
- this.createCategoriesForBinding(projectName,subCategory, parentElement, editor);
- }
-
}
public static String getContextprefix() {

Back to the top