diff options
author | Ansgar Radermacher | 2018-10-31 09:32:41 +0000 |
---|---|---|
committer | Ansgar Radermacher | 2018-10-31 15:20:02 +0000 |
commit | aa49d90ee09a5682235a38f8609246a586b03b59 (patch) | |
tree | 405843728e4328c0be80e121345c10c917a0b6a7 | |
parent | c4b75a4cf914a49d664f82368e22f11435b5dd3c (diff) | |
download | org.eclipse.papyrus-designer-aa49d90ee09a5682235a38f8609246a586b03b59.tar.gz org.eclipse.papyrus-designer-aa49d90ee09a5682235a38f8609246a586b03b59.tar.xz org.eclipse.papyrus-designer-aa49d90ee09a5682235a38f8609246a586b03b59.zip |
Bug 540594 - [Designer][validation] Split validation plugin
- Create two new plugins related to
(1) validation of language issues
(2) validation of transformation and deployment issues
- Use a hierarchic naming category scheme, replace ID copies in name by a suitable name
- Add these two plugins to their respective pom.xml
- Add these two plugins to their respective feature
Signed-off-by: Ansgar Radermacher <ansgar.radermacher@cea.fr>
Change-Id: Ic7bb19314b49971a486d061078fe69971bdd5777
42 files changed, 636 insertions, 232 deletions
diff --git a/features/org.eclipse.papyrus.designer.languages.common.feature/feature.xml b/features/org.eclipse.papyrus.designer.languages.common.feature/feature.xml index aadb083b9..82a957254 100644 --- a/features/org.eclipse.papyrus.designer.languages.common.feature/feature.xml +++ b/features/org.eclipse.papyrus.designer.languages.common.feature/feature.xml @@ -12,7 +12,7 @@ - Support for text editors in model explorer </description> - <copyright url="https://www.eclipse.org/legal/epl-2.0/"> + <copyright url="https://www.eclipse.org/legal/epl-2.0/"> Copyright (c) CEA LIST All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License @@ -90,4 +90,11 @@ https://www.eclipse.org/legal/epl-2.0/ install-size="0" version="0.0.0"/> + <plugin + id="org.eclipse.papyrus.designer.languages.common.validation" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + </feature> diff --git a/features/org.eclipse.papyrus.designer.transformation.main.feature/feature.xml b/features/org.eclipse.papyrus.designer.transformation.main.feature/feature.xml index adeb3c135..9505cdf5d 100644 --- a/features/org.eclipse.papyrus.designer.transformation.main.feature/feature.xml +++ b/features/org.eclipse.papyrus.designer.transformation.main.feature/feature.xml @@ -14,7 +14,7 @@ - A library of pre-defined M2M transformations (e.g. adding an additional class aka boot-loader that instantiates the system) </description> - <copyright url="https://www.eclipse.org/legal/epl-2.0/"> + <copyright url="https://www.eclipse.org/legal/epl-2.0/"> Copyright (c) CEA LIST All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License @@ -117,4 +117,11 @@ https://www.eclipse.org/legal/epl-2.0/ version="0.0.0" unpack="false"/> + <plugin + id="org.eclipse.papyrus.designer.deployment.validation" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + </feature> diff --git a/plugins/components/org.eclipse.papyrus.designer.components.validation/META-INF/MANIFEST.MF b/plugins/components/org.eclipse.papyrus.designer.components.validation/META-INF/MANIFEST.MF index 7db796ecd..042cf4e1b 100644 --- a/plugins/components/org.eclipse.papyrus.designer.components.validation/META-INF/MANIFEST.MF +++ b/plugins/components/org.eclipse.papyrus.designer.components.validation/META-INF/MANIFEST.MF @@ -10,7 +10,8 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.papyrus.designer.components.fcm.profile;bundle-version="0.8.0", org.eclipse.papyrus.designer.transformation.library;bundle-version="0.8.0", org.eclipse.papyrus.designer.deployment.profile;bundle-version="0.8.0", - org.eclipse.papyrus.designer.deployment.tools;bundle-version="0.8.0" + org.eclipse.papyrus.designer.deployment.tools;bundle-version="0.8.0", + org.eclipse.papyrus.designer.languages.common.validation;bundle-version="1.1.0" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-Version: 0.8.1.qualifier diff --git a/plugins/components/org.eclipse.papyrus.designer.components.validation/plugin.xml b/plugins/components/org.eclipse.papyrus.designer.components.validation/plugin.xml index ccb8f8480..bfcfe3092 100644 --- a/plugins/components/org.eclipse.papyrus.designer.components.validation/plugin.xml +++ b/plugins/components/org.eclipse.papyrus.designer.components.validation/plugin.xml @@ -3,45 +3,28 @@ <plugin> <extension point="org.eclipse.emf.validation.constraintProviders"> <category - id="org.eclipse.papyrus.designer.components.validation.constraints" - name="Papyrus designer rules"> + id="org.eclipse.papyrus.designer.validation.constraints/org.eclipse.papyrus.designer.components.validation.constraints" + name="Component-based modeling validation rules"> + <![CDATA[Component-based modeling validation rules]]> </category> <constraintProvider mode="Batch"> - <package namespaceUri="http://www.eclipse.org/uml2/3.0.0/UML"/> + <package namespaceUri="http://www.eclipse.org/uml2/4.0.0/UML"/> <package namespaceUri="http://www.eclipse.org/uml2/5.0.0/UML"/> <constraints - categories="org.eclipse.papyrus.designer.components.validation.constraints"> - <constraint - class="org.eclipse.papyrus.designer.components.validation.constraints.InstanceSpecificationSlotForAllProperties" - id="org.eclipse.papyrus.designer.components.validation.constraints.InstanceSpecificationSlotForAllProperties_ID" - lang="Java" - mode="Batch" - name="org.eclipse.papyrus.designer.components.validation.constraints.InstanceSpecificationSlotForAllProperties" - severity="WARNING" - statusCode="1"> - <message> - "Designer: {0}" - </message> - <description> - Is there a slot for all properties of a component within an instance specification? - </description> - <target - class="InstanceSpecification"> - </target> - </constraint> + categories="org.eclipse.papyrus.designer.validation.constraints/org.eclipse.papyrus.designer.components.validation.constraints"> <constraint class="org.eclipse.papyrus.designer.components.validation.constraints.ConnectorCallMultiplicity" id="org.eclipse.papyrus.designer.components.validation.constraints.ConnectorCallMultiplicity_ID" lang="Java" mode="Batch" - name="org.eclipse.papyrus.designer.components.validation.constraints.ConnectorCallMultiplicity" + name="Does the connector multiplicity match?" severity="WARNING" statusCode="1"> <message> "Designer: {0}" </message> <description> - Verify that a connection does not originate from a caller with to a server with the server multiplicity > 1 + Verify that a connection does not originate from a caller to a server with the server multiplicity > 1 </description> <target class="Property"> @@ -52,7 +35,7 @@ id="org.eclipse.papyrus.designer.components.validation.constraints.InitialEntryPoints_ID" lang="Java" mode="Batch" - name="org.eclipse.papyrus.designer.components.validation.constraints.InitialEntryPoints" + name="Does an application have exactly one entry point?" severity="WARNING" statusCode="1"> <message> @@ -71,7 +54,7 @@ isEnabledByDefault="false" lang="Java" mode="Batch" - name="org.eclipse.papyrus.designer.components.validation.constraints.UnconnectedProvPorts" + name="Are there unconnected provided ports?" severity="INFO" statusCode="1"> <message> @@ -89,7 +72,7 @@ id="org.eclipse.papyrus.designer.components.validation.constraints.UnconnectedReqPorts_ID" lang="Java" mode="Batch" - name="org.eclipse.papyrus.designer.components.validation.constraints.UnconnectedReqPorts" + name="Are there unconnected required ports?" severity="INFO" statusCode="1"> <message> @@ -103,29 +86,11 @@ </target> </constraint> <constraint - class="org.eclipse.papyrus.designer.components.validation.constraints.OperationsAreImplemented" - id="org.eclipse.papyrus.designer.components.validation.constraints.OperationsAreImplemented_ID" - lang="Java" - mode="Batch" - name="org.eclipse.papyrus.designer.components.validation.constraints.OperationsAreImplemented" - severity="WARNING" - statusCode="1"> - <message> - "Designer: {0}" - </message> - <description> - Operation is not implemented - </description> - <target - class="Operation"> - </target> - </constraint> - <constraint class="org.eclipse.papyrus.designer.components.validation.constraints.PortIsCorrectlyTyped" id="org.eclipse.papyrus.designer.components.validation.constraints.PortIsCorrectlyTyped_ID" lang="Java" mode="Batch" - name="org.eclipse.papyrus.designer.components.validation.constraints.PortIsCorrectlyTyped" + name="Is a port correctly typed?" severity="ERROR" statusCode="1"> <message> @@ -139,29 +104,11 @@ </target> </constraint> <constraint - class="org.eclipse.papyrus.designer.components.validation.constraints.BehaviorsWithoutSpecification" - id="org.eclipse.papyrus.designer.components.validation.constraints.BehaviorsWithoutSpecification_ID" - lang="Java" - mode="Batch" - name="org.eclipse.papyrus.designer.components.validation.constraints.BehaviorsWithoutSpecification" - severity="WARNING" - statusCode="1"> - <message> - "Designer: {0}" - </message> - <description> - Behavior without specification - </description> - <target - class="OpaqueBehavior"> - </target> - </constraint> - <constraint class="org.eclipse.papyrus.designer.components.validation.constraints.ConnectorConnectable" id="org.eclipse.papyrus.designer.components.validation.constraints.ConnectorConnectable_ID" lang="Java" mode="Batch" - name="org.eclipse.papyrus.designer.components.validation.constraints.ConnectorConnectable" + name="Is a connector between two ports valid?" severity="WARNING" statusCode="1"> <message> @@ -174,78 +121,6 @@ class="Connector"> </target> </constraint> - <constraint - class="org.eclipse.papyrus.designer.components.validation.constraints.AggregationKindValid" - id="org.eclipse.papyrus.designer.components.validation.constraints.AggregationKindValid_ID" - lang="Java" - mode="Batch" - name="org.eclipse.papyrus.designer.components.validation.constraints.AggregationKindValid" - severity="WARNING" - statusCode="1"> - <message> - "Designer: {0}" - </message> - <description> - Check whether aggregation kind is consistent with singleton information - </description> - <target - class="Property"> - </target> - </constraint> - <constraint - class="org.eclipse.papyrus.designer.components.validation.constraints.ConfigurationAttributeNotSet" - id="org.eclipse.papyrus.designer.components.validation.constraints.ConfigurationAttributeNotSet_ID" - lang="Java" - mode="Batch" - name="org.eclipse.papyrus.designer.components.validation.constraints.ConfigurationAttributeNotSet" - severity="WARNING" - statusCode="1"> - <message> - "Designer: {0}" - </message> - <description> - Check whether configuration attributes have a value in the deployment plans - </description> - <target - class="Slot"> - </target> - </constraint> - <constraint - class="org.eclipse.papyrus.designer.components.validation.constraints.OperationsWithTwoReturnValues" - id="org.eclipse.papyrus.designer.components.validation.constraints.OperationsWithTwoReturnValues_ID" - lang="Java" - mode="Batch" - name="org.eclipse.papyrus.designer.components.validation.constraints.OperationsWithTwoReturnValues" - severity="ERROR" - statusCode="1"> - <message> - "Designer: {0}" - </message> - <description> - Check whether an operation contains more than one return parameter - </description> - <target - class="Operation"> - </target> - </constraint> - <constraint - class="org.eclipse.papyrus.designer.components.validation.constraints.TemplateRefWithoutBinding" - id="org.eclipse.papyrus.designer.components.validation.constraints.TemplateRefWithoutBinding_ID" - lang="Java" - mode="Batch" - name="org.eclipse.papyrus.designer.components.validation.constraints.TemplateRefWithoutBinding" - severity="ERROR" - statusCode="1"> - <message> - "Designer: {0}" - </message> - <description> - Check whether a template parameter is referenced out of scope - </description> - <target - class="TypedElement"> - </target> - </constraint> </constraints> </constraintProvider> </extension> @@ -254,7 +129,7 @@ <clientContext default="false" id="org.eclipse.papyrus.designer.components.validation.context"> - <selector class="org.eclipse.papyrus.designer.components.validation.ValidationDelegateClientSelector"/> + <selector class="org.eclipse.papyrus.designer.components.validation.ValidationDelegateClientSelector"/> </clientContext> <binding context="org.eclipse.papyrus.designer.components.validation.context"> <category ref="org.eclipse.papyrus.designer.components.validation.constraints"/> diff --git a/plugins/components/org.eclipse.papyrus.designer.components.validation/src/org/eclipse/papyrus/designer/components/validation/constraints/ExecutorIsNotUsedAsPartName.java b/plugins/components/org.eclipse.papyrus.designer.components.validation/src/org/eclipse/papyrus/designer/components/validation/constraints/ExecutorIsNotUsedAsPartName.java deleted file mode 100644 index 46841b312..000000000 --- a/plugins/components/org.eclipse.papyrus.designer.components.validation/src/org/eclipse/papyrus/designer/components/validation/constraints/ExecutorIsNotUsedAsPartName.java +++ /dev/null @@ -1,48 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Ansgar Radermacher ansgar.radermacher@cea.fr - * - *****************************************************************************/ - -package org.eclipse.papyrus.designer.components.validation.constraints; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.validation.AbstractModelConstraint; -import org.eclipse.emf.validation.IValidationContext; -import org.eclipse.papyrus.designer.components.FCM.RuleApplication; -import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil; -import org.eclipse.uml2.uml.Class; - -/** - * Check whether an attribute used the name that is reserved for executors within a container - * - * - */ -public class ExecutorIsNotUsedAsPartName extends AbstractModelConstraint -{ - @Override - public IStatus validate(IValidationContext ctx) { - - Class class_ = (Class) ctx.getTarget(); - - if (StereotypeUtil.isApplied(class_, RuleApplication.class)) { - // limit check to classes applying a container rule. - // for (Property attribute : class_.getOwnedAttributes()) { - // FIXME if (attribute.getName().equals(ContainerTrafo.executorPartName)) { - // return ctx.createFailureStatus("A property may not use the reserved name \"_executor\""); //$NON-NLS-1$ - // } - //} - } - return ctx.createSuccessStatus(); - } -} diff --git a/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/.classpath b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/.classpath new file mode 100644 index 000000000..43b986286 --- /dev/null +++ b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/.classpath @@ -0,0 +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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="target/classes"/> +</classpath> diff --git a/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/.project b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/.project new file mode 100644 index 000000000..6bd4ce64b --- /dev/null +++ b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/.project @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.papyrus.designer.deployment.validation</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/.settings/org.eclipse.core.resources.prefs b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 000000000..99f26c020 --- /dev/null +++ b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8 diff --git a/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/.settings/org.eclipse.jdt.core.prefs b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..0c68a61dc --- /dev/null +++ b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/.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.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/.settings/org.eclipse.m2e.core.prefs b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 000000000..f897a7f1c --- /dev/null +++ b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/META-INF/MANIFEST.MF b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/META-INF/MANIFEST.MF new file mode 100644 index 000000000..8a3d7467c --- /dev/null +++ b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/META-INF/MANIFEST.MF @@ -0,0 +1,23 @@ +Manifest-Version: 1.0 +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.uml2.uml;bundle-version="3.0.1", + org.eclipse.emf.validation;bundle-version="1.3.0", + org.eclipse.ui, + org.eclipse.papyrus.uml.tools.utils;bundle-version="1.2.0", + org.eclipse.papyrus.designer.transformation.base;bundle-version="0.8.0", + org.eclipse.papyrus.designer.transformation.core;bundle-version="0.8.0", + org.eclipse.papyrus.designer.transformation.library;bundle-version="0.8.0", + org.eclipse.papyrus.designer.deployment.profile;bundle-version="0.8.0", + org.eclipse.papyrus.designer.deployment.tools;bundle-version="0.8.0", + org.eclipse.papyrus.designer.languages.common.validation;bundle-version="1.1.0" +Bundle-Vendor: %providerName +Bundle-ActivationPolicy: lazy +Bundle-Version: 0.8.1.qualifier +Bundle-Localization: plugin +Bundle-Name: %pluginName +Bundle-Activator: org.eclipse.papyrus.designer.deployment.validation.Activator +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.eclipse.papyrus.designer.deployment.validation;singleton:=true +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Import-Package: org.eclipse.papyrus.designer.deployment.tools +Automatic-Module-Name: org.eclipse.papyrus.designer.deployment.validation diff --git a/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/build.properties b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/build.properties new file mode 100644 index 000000000..f11190cf9 --- /dev/null +++ b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/build.properties @@ -0,0 +1,9 @@ +source.. = src/ +output.. = target/classes/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + .classpath,\ + .project,\ + icons/,\ + plugin.properties diff --git a/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/icons/validate.gif b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/icons/validate.gif Binary files differnew file mode 100644 index 000000000..6efaebec9 --- /dev/null +++ b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/icons/validate.gif diff --git a/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/plugin.properties b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/plugin.properties new file mode 100644 index 000000000..76f5bd6f7 --- /dev/null +++ b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/plugin.properties @@ -0,0 +1,10 @@ +# Copyright (c) CEA LIST. +# +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +pluginName=Papyrus extra: SW Designer designer validation rules (Incubation) +providerName=Eclipse Modeling Project diff --git a/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/plugin.xml b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/plugin.xml new file mode 100644 index 000000000..3317c04ea --- /dev/null +++ b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/plugin.xml @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.2"?> +<plugin> + <extension point="org.eclipse.emf.validation.constraintProviders"> + <category + id="org.eclipse.papyrus.designer.validation.constraints/org.eclipse.papyrus.designer.deployment.validation.constraints" + name="Transformation and deployment related validation rules"> + <![CDATA[Transformation and deployment related validation rules]]> + </category> + <constraintProvider mode="Batch"> + <package namespaceUri="http://www.eclipse.org/uml2/4.0.0/UML"/> + <package namespaceUri="http://www.eclipse.org/uml2/5.0.0/UML"/> + <constraints + categories="org.eclipse.papyrus.designer.validation.constraints/org.eclipse.papyrus.designer.deployment.validation.constraints"> + <constraint + class="org.eclipse.papyrus.designer.deployment.validation.constraints.InstanceSpecificationSlotForAllProperties" + id="org.eclipse.papyrus.designer.deployment.validation.constraints.InstanceSpecificationSlotForAllProperties_ID" + lang="Java" + mode="Batch" + name="Do instances cover all configuration properties?" + severity="WARNING" + statusCode="1"> + <message> + "Designer: {0}" + </message> + <description> + Is there a slot for all properties of a component within an instance specification? + </description> + <target + class="InstanceSpecification"> + </target> + </constraint> + <constraint + class="org.eclipse.papyrus.designer.deployment.validation.constraints.ConfigurationAttributeNotSet" + id="org.eclipse.papyrus.designer.deployment.validation.constraints.ConfigurationAttributeNotSet_ID" + lang="Java" + mode="Batch" + name="Is there a slot for all configuration properties?" + severity="WARNING" + statusCode="1"> + <message> + "Designer: {0}" + </message> + <description> + Check whether configuration attributes have a value in the deployment plans + </description> + <target + class="Slot"> + </target> + </constraint> + <constraint + class="org.eclipse.papyrus.designer.deployment.validation.constraints.AggregationKindValid" + id="org.eclipse.papyrus.designer.deployment.validation.constraints.AggregationKindValid_ID" + lang="Java" + mode="Batch" + name="Is aggregation kind consistent with Singleton information?" + severity="WARNING" + statusCode="1"> + <message> + "Designer: {0}" + </message> + <description> + Check whether aggregation kind is consistent with singleton information + </description> + <target + class="Property"> + </target> + </constraint> + <constraint + class="org.eclipse.papyrus.designer.deployment.validation.constraints.TemplateRefWithoutBinding" + id="org.eclipse.papyrus.designer.components.validation.constraints.TemplateRefWithoutBinding_ID" + lang="Java" + mode="Batch" + name="Is a type from the template signature used outside the template?" + severity="ERROR" + statusCode="1"> + <message> + "Designer: {0}" + </message> + <description> + Check whether a template parameter is referenced out of scope + </description> + <target + class="TypedElement"> + </target> + </constraint> + </constraints> + </constraintProvider> + </extension> + + <extension point="org.eclipse.emf.validation.constraintBindings"> + <clientContext + default="false" + id="org.eclipse.papyrus.designer.deployment.validation.context"> + <selector class="org.eclipse.papyrus.designer.deployment.validation.ValidationDelegateClientSelector"/> + </clientContext> + <binding context="org.eclipse.papyrus.designer.deployment.validation.context"> + <category ref="org.eclipse.papyrus.designer.deployment.validation.constraints"/> + </binding> + </extension> +</plugin> diff --git a/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/pom.xml b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/pom.xml new file mode 100644 index 000000000..483e084cc --- /dev/null +++ b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/pom.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.eclipse.papyrus.designer</groupId> + <artifactId>org.eclipse.papyrus.designer.deployment</artifactId> + <version>0.8.1-SNAPSHOT</version> + </parent> + <artifactId>org.eclipse.papyrus.designer.deployment.validation</artifactId> + <description>This module contains the validation rules related to deployment</description> + <packaging>eclipse-plugin</packaging> +</project> diff --git a/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/src/org/eclipse/papyrus/designer/deployment/validation/Activator.java b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/src/org/eclipse/papyrus/designer/deployment/validation/Activator.java new file mode 100644 index 000000000..20cacdabc --- /dev/null +++ b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/src/org/eclipse/papyrus/designer/deployment/validation/Activator.java @@ -0,0 +1,62 @@ +/** + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.papyrus.designer.deployment.validation; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.papyrus.designer.deployment.validation"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/src/org/eclipse/papyrus/designer/deployment/validation/ValidationDelegateClientSelector.java b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/src/org/eclipse/papyrus/designer/deployment/validation/ValidationDelegateClientSelector.java new file mode 100644 index 000000000..624b7e7fc --- /dev/null +++ b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/src/org/eclipse/papyrus/designer/deployment/validation/ValidationDelegateClientSelector.java @@ -0,0 +1,29 @@ +/** + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.papyrus.designer.deployment.validation; + +import org.eclipse.emf.validation.model.IClientSelector; +import org.eclipse.uml2.uml.Element; + +public class ValidationDelegateClientSelector implements IClientSelector { + + /** + * Queries whether to select the specified object, which indicates that it + * belongs to this client context. + * + * @param object + * a model element of some kind + * @return <code>true</code> if the <code>object</code> matches my client + * context; <code>false</code>, otherwise + */ + @Override + public boolean selects(Object object) { + return (object instanceof Element); + } +} diff --git a/plugins/components/org.eclipse.papyrus.designer.components.validation/src/org/eclipse/papyrus/designer/components/validation/constraints/AggregationKindValid.java b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/src/org/eclipse/papyrus/designer/deployment/validation/constraints/AggregationKindValid.java index 6022e7f50..b217f8930 100644 --- a/plugins/components/org.eclipse.papyrus.designer.components.validation/src/org/eclipse/papyrus/designer/components/validation/constraints/AggregationKindValid.java +++ b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/src/org/eclipse/papyrus/designer/deployment/validation/constraints/AggregationKindValid.java @@ -6,7 +6,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.eclipse.papyrus.designer.components.validation.constraints; +package org.eclipse.papyrus.designer.deployment.validation.constraints; import org.eclipse.core.runtime.IStatus; import org.eclipse.emf.validation.AbstractModelConstraint; diff --git a/plugins/components/org.eclipse.papyrus.designer.components.validation/src/org/eclipse/papyrus/designer/components/validation/constraints/ConfigurationAttributeNotSet.java b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/src/org/eclipse/papyrus/designer/deployment/validation/constraints/ConfigurationAttributeNotSet.java index d7d4e4463..b442d1473 100644 --- a/plugins/components/org.eclipse.papyrus.designer.components.validation/src/org/eclipse/papyrus/designer/components/validation/constraints/ConfigurationAttributeNotSet.java +++ b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/src/org/eclipse/papyrus/designer/deployment/validation/constraints/ConfigurationAttributeNotSet.java @@ -6,7 +6,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.eclipse.papyrus.designer.components.validation.constraints; +package org.eclipse.papyrus.designer.deployment.validation.constraints; import org.eclipse.core.runtime.IStatus; import org.eclipse.emf.validation.AbstractModelConstraint; diff --git a/plugins/components/org.eclipse.papyrus.designer.components.validation/src/org/eclipse/papyrus/designer/components/validation/constraints/InstanceSpecificationSlotForAllProperties.java b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/src/org/eclipse/papyrus/designer/deployment/validation/constraints/InstanceSpecificationSlotForAllProperties.java index d2ae8046c..b278ee6d5 100644 --- a/plugins/components/org.eclipse.papyrus.designer.components.validation/src/org/eclipse/papyrus/designer/components/validation/constraints/InstanceSpecificationSlotForAllProperties.java +++ b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/src/org/eclipse/papyrus/designer/deployment/validation/constraints/InstanceSpecificationSlotForAllProperties.java @@ -14,7 +14,7 @@ * *****************************************************************************/ -package org.eclipse.papyrus.designer.components.validation.constraints; +package org.eclipse.papyrus.designer.deployment.validation.constraints; import org.eclipse.core.runtime.IStatus; import org.eclipse.emf.validation.AbstractModelConstraint; diff --git a/plugins/components/org.eclipse.papyrus.designer.components.validation/src/org/eclipse/papyrus/designer/components/validation/constraints/TemplateRefWithoutBinding.java b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/src/org/eclipse/papyrus/designer/deployment/validation/constraints/TemplateRefWithoutBinding.java index e18a48c31..1a26f97b1 100644 --- a/plugins/components/org.eclipse.papyrus.designer.components.validation/src/org/eclipse/papyrus/designer/components/validation/constraints/TemplateRefWithoutBinding.java +++ b/plugins/deployment/org.eclipse.papyrus.designer.deployment.validation/src/org/eclipse/papyrus/designer/deployment/validation/constraints/TemplateRefWithoutBinding.java @@ -14,7 +14,7 @@ * *****************************************************************************/ -package org.eclipse.papyrus.designer.components.validation.constraints; +package org.eclipse.papyrus.designer.deployment.validation.constraints; import org.eclipse.core.runtime.IStatus; import org.eclipse.emf.validation.AbstractModelConstraint; diff --git a/plugins/deployment/pom.xml b/plugins/deployment/pom.xml index de196e5b9..645aaeec4 100644 --- a/plugins/deployment/pom.xml +++ b/plugins/deployment/pom.xml @@ -16,6 +16,7 @@ <modules> <module>org.eclipse.papyrus.designer.deployment.profile</module> <module>org.eclipse.papyrus.designer.deployment.tools</module> + <module>org.eclipse.papyrus.designer.deployment.validation</module> </modules> </project> diff --git a/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/.classpath b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/.classpath new file mode 100644 index 000000000..43b986286 --- /dev/null +++ b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/.classpath @@ -0,0 +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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="target/classes"/> +</classpath> diff --git a/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/.project b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/.project new file mode 100644 index 000000000..2a75b0119 --- /dev/null +++ b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/.project @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.papyrus.designer.languages.common.validation</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/.settings/org.eclipse.core.resources.prefs b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 000000000..99f26c020 --- /dev/null +++ b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8 diff --git a/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/.settings/org.eclipse.jdt.core.prefs b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..0c68a61dc --- /dev/null +++ b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/.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.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/.settings/org.eclipse.m2e.core.prefs b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 000000000..f897a7f1c --- /dev/null +++ b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/META-INF/MANIFEST.MF b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/META-INF/MANIFEST.MF new file mode 100644 index 000000000..b27ff3d2f --- /dev/null +++ b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.uml2.uml;bundle-version="3.0.1", + org.eclipse.emf.validation;bundle-version="1.3.0", + org.eclipse.ui, + org.eclipse.papyrus.uml.tools.utils;bundle-version="1.2.0", + org.eclipse.papyrus.designer.deployment.profile;bundle-version="0.8.0", + org.eclipse.papyrus.designer.deployment.tools;bundle-version="0.8.0" +Bundle-Vendor: %providerName +Bundle-ActivationPolicy: lazy +Bundle-Version: 1.1.1.qualifier +Bundle-Localization: plugin +Bundle-Name: %pluginName +Bundle-Activator: org.eclipse.papyrus.designer.languages.common.validation.Activator +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.eclipse.papyrus.designer.languages.common.validation;singleton:=true +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Import-Package: org.eclipse.papyrus.designer.deployment.tools +Automatic-Module-Name: org.eclipse.papyrus.designer.languages.common.validation diff --git a/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/build.properties b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/build.properties new file mode 100644 index 000000000..f11190cf9 --- /dev/null +++ b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/build.properties @@ -0,0 +1,9 @@ +source.. = src/ +output.. = target/classes/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + .classpath,\ + .project,\ + icons/,\ + plugin.properties diff --git a/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/icons/validate.gif b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/icons/validate.gif Binary files differnew file mode 100644 index 000000000..6efaebec9 --- /dev/null +++ b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/icons/validate.gif diff --git a/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/plugin.properties b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/plugin.properties new file mode 100644 index 000000000..6e457fde9 --- /dev/null +++ b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/plugin.properties @@ -0,0 +1,10 @@ +# Copyright (c) CEA LIST. +# +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +pluginName=SW Designer designer validation rules related to programming languages +providerName=Eclipse Modeling Project diff --git a/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/plugin.xml b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/plugin.xml new file mode 100644 index 000000000..4247a3d07 --- /dev/null +++ b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/plugin.xml @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.2"?> +<plugin> + <extension point="org.eclipse.emf.validation.constraintProviders"> + <category + id="org.eclipse.papyrus.designer.validation.constraints" + name="Papyrus designer validation rules"> + <![CDATA[Papyrus SW designer validation rules]]> + </category> + <category + id="org.eclipse.papyrus.designer.validation.constraints/org.eclipse.papyrus.designer.languages.common.validation.constraints" + name="Common programming language rules"> + <![CDATA[Papyrus SW designer ommon programming language rules]]> + </category> + <constraintProvider mode="Batch"> + <package namespaceUri="http://www.eclipse.org/uml2/4.0.0/UML"/> + <package namespaceUri="http://www.eclipse.org/uml2/5.0.0/UML"/> + <constraints + categories="org.eclipse.papyrus.designer.validation.constraints/org.eclipse.papyrus.designer.languages.common.validation.constraints"> + <constraint + class="org.eclipse.papyrus.designer.languages.common.validation.constraints.OperationsAreImplemented" + id="org.eclipse.papyrus.designer.languages.common.validation.constraints.OperationsAreImplemented_ID" + lang="Java" + mode="Batch" + name="Are (non-abstract) operations implemented?" + severity="WARNING" + statusCode="1"> + <message> + "Designer: {0}" + </message> + <description> + Operation is not implemented + </description> + <target + class="Operation"> + </target> + </constraint> + <constraint + class="org.eclipse.papyrus.designer.languages.common.validation.constraints.BehaviorsWithoutSpecification" + id="org.eclipse.papyrus.designer.languages.common.validation.constraints.BehaviorsWithoutSpecification_ID" + lang="Java" + mode="Batch" + name="Are there behaviors without specification?" + severity="WARNING" + statusCode="1"> + <message> + "Designer: {0}" + </message> + <description> + Behavior without specification + </description> + <target + class="OpaqueBehavior"> + </target> + </constraint> + <constraint + class="org.eclipse.papyrus.designer.languages.common.validation.constraints.OperationsWithTwoReturnValues" + id="org.eclipse.papyrus.designer.languages.common.validation.constraints.OperationsWithTwoReturnValues_ID" + lang="Java" + mode="Batch" + name="Does an operation have more than one return parameter?" + severity="ERROR" + statusCode="1"> + <message> + "Designer: {0}" + </message> + <description> + Check whether an operation contains more than one return parameter + </description> + <target + class="Operation"> + </target> + </constraint> + </constraints> + </constraintProvider> + </extension> + + <extension point="org.eclipse.emf.validation.constraintBindings"> + <clientContext + default="false" + id="org.eclipse.papyrus.designer.languages.common.validation.context"> + <selector class="org.eclipse.papyrus.designer.languages.common.validation.ValidationDelegateClientSelector"/> + </clientContext> + <binding context="org.eclipse.papyrus.designer.languages.common.validation.context"> + <category ref="org.eclipse.papyrus.designer.languages.common.validation.constraints"/> + </binding> + </extension> +</plugin> diff --git a/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/pom.xml b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/pom.xml new file mode 100644 index 000000000..48474134b --- /dev/null +++ b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/pom.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.eclipse.papyrus.designer</groupId> + <artifactId>org.eclipse.papyrus.designer.languages.common</artifactId> + <version>1.1.1-SNAPSHOT</version> + </parent> + <artifactId>org.eclipse.papyrus.designer.languages.common.validation</artifactId> + <description>This module contains the validation rules for component-based design</description> + <packaging>eclipse-plugin</packaging> +</project> diff --git a/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/src/org/eclipse/papyrus/designer/languages/common/validation/Activator.java b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/src/org/eclipse/papyrus/designer/languages/common/validation/Activator.java new file mode 100644 index 000000000..f996561ae --- /dev/null +++ b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/src/org/eclipse/papyrus/designer/languages/common/validation/Activator.java @@ -0,0 +1,62 @@ +/** + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.papyrus.designer.languages.common.validation; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.papyrus.designer.languages.common.validation"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/src/org/eclipse/papyrus/designer/languages/common/validation/ValidationDelegateClientSelector.java b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/src/org/eclipse/papyrus/designer/languages/common/validation/ValidationDelegateClientSelector.java new file mode 100644 index 000000000..872cc647d --- /dev/null +++ b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/src/org/eclipse/papyrus/designer/languages/common/validation/ValidationDelegateClientSelector.java @@ -0,0 +1,29 @@ +/** + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.papyrus.designer.languages.common.validation; + +import org.eclipse.emf.validation.model.IClientSelector; +import org.eclipse.uml2.uml.Element; + +public class ValidationDelegateClientSelector implements IClientSelector { + + /** + * Queries whether to select the specified object, which indicates that it + * belongs to this client context. + * + * @param object + * a model element of some kind + * @return <code>true</code> if the <code>object</code> matches my client + * context; <code>false</code>, otherwise + */ + @Override + public boolean selects(Object object) { + return (object instanceof Element); + } +} diff --git a/plugins/components/org.eclipse.papyrus.designer.components.validation/src/org/eclipse/papyrus/designer/components/validation/constraints/BehaviorsWithoutSpecification.java b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/src/org/eclipse/papyrus/designer/languages/common/validation/constraints/BehaviorsWithoutSpecification.java index cda12a27a..0fe0a3732 100644 --- a/plugins/components/org.eclipse.papyrus.designer.components.validation/src/org/eclipse/papyrus/designer/components/validation/constraints/BehaviorsWithoutSpecification.java +++ b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/src/org/eclipse/papyrus/designer/languages/common/validation/constraints/BehaviorsWithoutSpecification.java @@ -14,13 +14,11 @@ * *****************************************************************************/ -package org.eclipse.papyrus.designer.components.validation.constraints; +package org.eclipse.papyrus.designer.languages.common.validation.constraints; import org.eclipse.core.runtime.IStatus; import org.eclipse.emf.validation.AbstractModelConstraint; import org.eclipse.emf.validation.IValidationContext; -import org.eclipse.papyrus.designer.transformation.profile.Transformation.DerivedElement; -import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil; import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.NamedElement; import org.eclipse.uml2.uml.OpaqueBehavior; @@ -28,9 +26,6 @@ import org.eclipse.uml2.uml.OpaqueBehavior; /** * Check whether all behaviors have a specification. This happens for instance, if the user * deletes a specification and "forgets" to delete the associated behavior. - * - * @author ansgar - * */ public class BehaviorsWithoutSpecification extends AbstractModelConstraint { @@ -41,25 +36,11 @@ public class BehaviorsWithoutSpecification extends AbstractModelConstraint { if (behavior.getSpecification() == null) { Element class_ = behavior.getOwner(); - if (StereotypeUtil.isApplicable(class_, DerivedElement.class)) { - // check whether DerivedElement is applicable => indirect check whether FCM is applied (make rule specific to SW Designer) - // TODO alternative? check whether behavior is referenced from either an activity, since that is possible in general? - /* - * boolean hasRef = false; - * for (Setting setting : UML2Util.getNonNavigableInverseReferences(behavior)) { - * if (setting.getEObject() ... - * hasRefFromIS = true; - * break; - * } - * } - */ - if (class_ instanceof NamedElement) { - return ctx.createFailureStatus("The behavior '%s' of '%s' has no specification", //$NON-NLS-1$ - behavior.getName(), ((NamedElement) class_).getQualifiedName()); - } - else { - return ctx.createFailureStatus(String.format("The behavior '%s' of '%s' has no specification", behavior.getName())); //$NON-NLS-1$ - } + + // it's quite normal that behaviors in state-machines have no specification. Check whether owner is class + if (class_ instanceof org.eclipse.uml2.uml.Class) { + return ctx.createFailureStatus("The behavior '%s' of '%s' has no specification", //$NON-NLS-1$ + behavior.getName(), ((NamedElement) class_).getQualifiedName()); } } return ctx.createSuccessStatus(); diff --git a/plugins/components/org.eclipse.papyrus.designer.components.validation/src/org/eclipse/papyrus/designer/components/validation/constraints/DuplicateOperation.java b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/src/org/eclipse/papyrus/designer/languages/common/validation/constraints/DuplicateOperation.java index fc949f205..0cdaaf569 100644 --- a/plugins/components/org.eclipse.papyrus.designer.components.validation/src/org/eclipse/papyrus/designer/components/validation/constraints/DuplicateOperation.java +++ b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/src/org/eclipse/papyrus/designer/languages/common/validation/constraints/DuplicateOperation.java @@ -14,7 +14,7 @@ * *****************************************************************************/ -package org.eclipse.papyrus.designer.components.validation.constraints; +package org.eclipse.papyrus.designer.languages.common.validation.constraints; /** * Check whether two operations have the same name *and* have indistinguishable parameter lists @@ -23,6 +23,7 @@ package org.eclipse.papyrus.designer.components.validation.constraints; * the requirements of programming languages. Many OO languages allow for identical operation names * if the operation can be uniquely identified via the type and number of parameters. * + * TODO: implement this class */ public class DuplicateOperation { diff --git a/plugins/components/org.eclipse.papyrus.designer.components.validation/src/org/eclipse/papyrus/designer/components/validation/constraints/OperationsAreImplemented.java b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/src/org/eclipse/papyrus/designer/languages/common/validation/constraints/OperationsAreImplemented.java index e7611885a..dbb101c37 100644 --- a/plugins/components/org.eclipse.papyrus.designer.components.validation/src/org/eclipse/papyrus/designer/components/validation/constraints/OperationsAreImplemented.java +++ b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/src/org/eclipse/papyrus/designer/languages/common/validation/constraints/OperationsAreImplemented.java @@ -14,7 +14,7 @@ * *****************************************************************************/ -package org.eclipse.papyrus.designer.components.validation.constraints; +package org.eclipse.papyrus.designer.languages.common.validation.constraints; import org.eclipse.core.runtime.IStatus; import org.eclipse.emf.validation.AbstractModelConstraint; diff --git a/plugins/components/org.eclipse.papyrus.designer.components.validation/src/org/eclipse/papyrus/designer/components/validation/constraints/OperationsWithTwoReturnValues.java b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/src/org/eclipse/papyrus/designer/languages/common/validation/constraints/OperationsWithTwoReturnValues.java index 738a38275..9f5a86fb0 100644 --- a/plugins/components/org.eclipse.papyrus.designer.components.validation/src/org/eclipse/papyrus/designer/components/validation/constraints/OperationsWithTwoReturnValues.java +++ b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/src/org/eclipse/papyrus/designer/languages/common/validation/constraints/OperationsWithTwoReturnValues.java @@ -14,13 +14,11 @@ * *****************************************************************************/ -package org.eclipse.papyrus.designer.components.validation.constraints; +package org.eclipse.papyrus.designer.languages.common.validation.constraints; import org.eclipse.core.runtime.IStatus; import org.eclipse.emf.validation.AbstractModelConstraint; import org.eclipse.emf.validation.IValidationContext; -import org.eclipse.papyrus.designer.transformation.profile.Transformation.DerivedElement; -import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil; import org.eclipse.uml2.uml.Operation; import org.eclipse.uml2.uml.Parameter; import org.eclipse.uml2.uml.ParameterDirectionKind; @@ -45,14 +43,9 @@ public class OperationsWithTwoReturnValues extends AbstractModelConstraint firstReturn = false; } else { - if (StereotypeUtil.isApplicable(operation, DerivedElement.class)) { - return ctx.createFailureStatus(String.format( - "The operation '%s' has more than one return parameter. It must have at most one", //$NON-NLS-1$ - operation.getName())); - } - else { - break; - } + return ctx.createFailureStatus(String.format( + "The operation '%s' has more than one return parameter. It must have at most one", //$NON-NLS-1$ + operation.getName())); } } } diff --git a/plugins/languages/common/pom.xml b/plugins/languages/common/pom.xml index 763f7161d..5b3593864 100644 --- a/plugins/languages/common/pom.xml +++ b/plugins/languages/common/pom.xml @@ -21,5 +21,6 @@ <module>org.eclipse.papyrus.designer.languages.common.texteditor.model</module> <module>org.eclipse.papyrus.designer.languages.common.texteditor.modelexplorer</module> <module>org.eclipse.papyrus.designer.languages.common.testutils</module> + <module>org.eclipse.papyrus.designer.languages.common.validation</module> </modules> </project> diff --git a/plugins/patterns/org.eclipse.papyrus.designer.patterns.transformations/plugin.xml b/plugins/patterns/org.eclipse.papyrus.designer.patterns.transformations/plugin.xml index 9a1f38197..499007366 100644 --- a/plugins/patterns/org.eclipse.papyrus.designer.patterns.transformations/plugin.xml +++ b/plugins/patterns/org.eclipse.papyrus.designer.patterns.transformations/plugin.xml @@ -27,7 +27,7 @@ locationURI="popup:org.eclipse.papyrus.designer.popup?after=designer"> <command commandId="org.eclipse.papyrus.designer.profiles.designpattern.menuActions.ApplyPatternCmd" - icon="icons/designpattern_16x16.gif" + icon="platform:/plugin/org.eclipse.papyrus.designer.patterns.profile.ui/icons/designpattern_16x16.gif" id="org.eclipse.papyrus.designer.profiles.designpattern.menuActions.ApplyPatternMenu" label="Apply a design pattern" mode="FORCE_TEXT" |