Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-07-23 12:05:27 +0000
committerCamille Letavernier2014-07-23 12:08:42 +0000
commitb9c0e6a4873de0dc72c325324bba681f467bd755 (patch)
treecdb659dda9d036483d314478125fd41770b46fca /plugins
parent6b8769b84cca3e7c5d1b133d3c0514cb0780aa2c (diff)
downloadorg.eclipse.papyrus-b9c0e6a4873de0dc72c325324bba681f467bd755.tar.gz
org.eclipse.papyrus-b9c0e6a4873de0dc72c325324bba681f467bd755.tar.xz
org.eclipse.papyrus-b9c0e6a4873de0dc72c325324bba681f467bd755.zip
439781: Profile datatype attribute values are lost when updating
hierarchical profile https://bugs.eclipse.org/bugs/show_bug.cgi?id=439781
Diffstat (limited to 'plugins')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/DefineProfileCommand.java26
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.profile/plugin.properties4
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.profile/plugin.xml18
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/constraints/PropertyHasTypeConstraint.java41
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/tree/ProfileElementLabelProvider.java61
5 files changed, 45 insertions, 105 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/DefineProfileCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/DefineProfileCommand.java
index 2eec165d4ea..49086bb7a4f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/DefineProfileCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/DefineProfileCommand.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2010 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -55,9 +55,9 @@ import org.eclipse.uml2.uml.util.UMLUtil.UML2EcoreConverter;
/**
* This command is used to define a profile
- *
+ *
* @author VL222926
- *
+ *
*/
public class DefineProfileCommand extends AbstractTransactionalCommand {
@@ -74,9 +74,9 @@ public class DefineProfileCommand extends AbstractTransactionalCommand {
private boolean saveConstraint;
/**
- *
+ *
* Constructor.
- *
+ *
* @param domain
* @param papyrusAnnotation
* @param rootProfile
@@ -92,7 +92,7 @@ public class DefineProfileCommand extends AbstractTransactionalCommand {
/**
* Define this package if it is a profile and its sub-profiles
- *
+ *
* @param thePackage
* the package to define (if it is a profile)
*/
@@ -121,7 +121,9 @@ public class DefineProfileCommand extends AbstractTransactionalCommand {
//
options.put(Profile2EPackageConverter.OPTION__COMMENTS, UMLUtil.OPTION__IGNORE);
- options.put(Profile2EPackageConverter.OPTION__FOREIGN_DEFINITIONS, UMLUtil.OPTION__IGNORE);
+ options.put(Profile2EPackageConverter.OPTION__FOREIGN_DEFINITIONS, UMLUtil.OPTION__PROCESS);
+
+ options.put(Profile2EPackageConverter.OPTION__UNTYPED_PROPERTIES, UMLUtil.OPTION__PROCESS); //Closer to the UML semantics of untyped properties
List<EPackage> result = new LinkedList<EPackage>();
@@ -142,11 +144,11 @@ public class DefineProfileCommand extends AbstractTransactionalCommand {
}
/**
- *
- *
+ *
+ *
* @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor,
* org.eclipse.core.runtime.IAdaptable)
- *
+ *
* @param monitor
* @param info
* @return
@@ -227,9 +229,9 @@ public class DefineProfileCommand extends AbstractTransactionalCommand {
}
/**
- *
+ *
* @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#getAffectedFiles()
- *
+ *
* @return
*/
@Override
diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/plugin.properties b/plugins/uml/org.eclipse.papyrus.uml.profile/plugin.properties
index b398a086c8c..f61a2bdb452 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.profile/plugin.properties
+++ b/plugins/uml/org.eclipse.papyrus.uml.profile/plugin.properties
@@ -1,10 +1,6 @@
pluginName=Papyrus Profile
providerName=Eclipse Modeling Project
-property_has_type.name = Stereotype property has type (Batch Mode)
-property_has_type.desc = For correct definition of the profile, every stereotype properties must have a type.
-property_has_type.msg = "{0}" must have a type.
-
property_has_default.name = Stereotype property has required default value (Batch Mode)
property_has_default.desc = For correct definition of the profile, every stereotype properties (typed by enumeration or primitive type) with multiplicity > 0 requires default value.
property_has_default.msg = "{0}" must have a default value.
diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/plugin.xml b/plugins/uml/org.eclipse.papyrus.uml.profile/plugin.xml
index 6b2b2d4b804..fbf8a739ccb 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.profile/plugin.xml
+++ b/plugins/uml/org.eclipse.papyrus.uml.profile/plugin.xml
@@ -53,24 +53,6 @@
</target>
</constraint>
<constraint
- class="org.eclipse.papyrus.uml.profile.constraints.PropertyHasTypeConstraint"
- id="com.cea.papyrus.profile.constraints.PropertyHasTypeID"
- lang="Java"
- mode="Batch"
- name="%property_has_type.name"
- severity="ERROR"
- statusCode="0">
- <message>
- %property_has_type.msg
- </message>
- <description>
- %property_has_type.desc
- </description>
- <target
- class="uml.Property">
- </target>
- </constraint>
- <constraint
class="org.eclipse.papyrus.uml.profile.constraints.PropertyHasDefaultValueConstraint"
id="com.cea.papyrus.profile.constraints.PropertyHasDefaultID"
lang="Java"
diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/constraints/PropertyHasTypeConstraint.java b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/constraints/PropertyHasTypeConstraint.java
deleted file mode 100644
index 2cf0ef29c2b..00000000000
--- a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/constraints/PropertyHasTypeConstraint.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Chokri Mraidha (CEA LIST) Chokri.Mraidha@cea.fr - Initial API and implementation
- * Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - modification
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.profile.constraints;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.validation.AbstractModelConstraint;
-import org.eclipse.emf.validation.IValidationContext;
-import org.eclipse.papyrus.uml.profile.utils.ProfileConstraintUtils;
-import org.eclipse.uml2.uml.Property;
-
-
-public class PropertyHasTypeConstraint extends AbstractModelConstraint {
-
- public PropertyHasTypeConstraint() {
- super();
- }
-
- public IStatus validate(IValidationContext ctx) {
-
- if(ProfileConstraintUtils.isStereotypeProperty(ctx.getTarget())) {
- Property property = (Property)ctx.getTarget();
-
- if(!ProfileConstraintUtils.hasType(property)) {
- return ctx.createFailureStatus(ctx.getTarget());
- }
- }
- return ctx.createSuccessStatus();
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/tree/ProfileElementLabelProvider.java b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/tree/ProfileElementLabelProvider.java
index d7f1aa2dad8..570e9e3507f 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/tree/ProfileElementLabelProvider.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/tree/ProfileElementLabelProvider.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2008 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -43,6 +43,7 @@ import org.eclipse.papyrus.uml.profile.tree.objects.UserPrimitiveTypeValueTreeOb
import org.eclipse.papyrus.uml.profile.tree.objects.ValueTreeObject;
import org.eclipse.papyrus.uml.profile.utils.Util;
import org.eclipse.papyrus.uml.tools.utils.ProfileUtil;
+import org.eclipse.papyrus.uml.tools.utils.TypeUtil;
import org.eclipse.swt.graphics.Image;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Element;
@@ -88,10 +89,10 @@ public class ProfileElementLabelProvider extends LabelProvider {
/**
* Gets the image.
- *
+ *
* @param object
* the object
- *
+ *
* @return the image
*/
@Override
@@ -128,10 +129,10 @@ public class ProfileElementLabelProvider extends LabelProvider {
/**
* Gets the text.
- *
+ *
* @param object
* the object
- *
+ *
* @return the text
*/
@Override
@@ -177,14 +178,14 @@ public class ProfileElementLabelProvider extends LabelProvider {
/**
* Returns the label to show for a property.
- *
+ *
* @param currentPropType
* current property type
* @param currentProp
* current property
* @param currentPropValue
* current property value
- *
+ *
* @return the String label
*/
private String getPropLabel(Property currentProp, Type currentPropType, Object currentPropValue) {
@@ -218,14 +219,14 @@ public class ProfileElementLabelProvider extends LabelProvider {
/**
* Returns the label to show for a property with type that is a Enumeration.
- *
+ *
* @param currentPropType
* current property type
* @param currentProp
* current property
* @param currentPropValue
* current property value
- *
+ *
* @return the String label
*/
private String getPropEnumerationLabel(Property currentProp, Type currentPropType, Object currentPropValue) {
@@ -250,14 +251,14 @@ public class ProfileElementLabelProvider extends LabelProvider {
/**
* Returns the label to show for a property with type that is a Stereotype.
- *
+ *
* @param currentPropType
* current property type
* @param currentProp
* current property
* @param currentPropValue
* current property value
- *
+ *
* @return the String label
*/
private String getPropStereotypeLabel(Property currentProp, Type currentPropType, Object currentPropValue) {
@@ -293,14 +294,14 @@ public class ProfileElementLabelProvider extends LabelProvider {
/**
* Returns the label to show for a property with type that is a Metaclass or Composite.
- *
+ *
* @param currentPropType
* current property type
* @param currentProp
* current property
* @param currentPropValue
* current property value
- *
+ *
* @return the String label
*/
private String getPropClassLabel(Property currentProp, Type currentPropType, Object currentPropValue) {
@@ -330,12 +331,12 @@ public class ProfileElementLabelProvider extends LabelProvider {
/**
* Returns the label to show for a property with type that is neither Metaclass / Composite / Enumeration / Stereotype.
- *
+ *
* @param currentProp
* current property
* @param currentPropValue
* current property value
- *
+ *
* @return the String label
*/
private String getPropDefaultLabel(Property currentProp, Object currentPropValue) {
@@ -350,10 +351,10 @@ public class ProfileElementLabelProvider extends LabelProvider {
/**
* Creates the label based on type + multiplicity for the selected property.
- *
+ *
* @param property
* the property
- *
+ *
* @return the property short label
*/
private String getPropertyShortLabel(Property property) {
@@ -369,7 +370,7 @@ public class ProfileElementLabelProvider extends LabelProvider {
Type type = property.getType();
- String typeName = type.getName();
+ String typeName = type == null ? TypeUtil.UNDEFINED_TYPE_NAME : type.getName();
String name = property.getName();
if(upper != -1) {
@@ -383,10 +384,10 @@ public class ProfileElementLabelProvider extends LabelProvider {
/**
* Gets the label.
- *
+ *
* @param object
* the object
- *
+ *
* @return the label
*/
private String getLabel(ValueTreeObject object) {
@@ -407,10 +408,10 @@ public class ProfileElementLabelProvider extends LabelProvider {
/**
* Gets the label.
- *
+ *
* @param object
* the object
- *
+ *
* @return the label
*/
private String getLabel(PrimitiveTypeValueTreeObject object) {
@@ -425,10 +426,10 @@ public class ProfileElementLabelProvider extends LabelProvider {
/**
* Gets the label.
- *
+ *
* @param object
* the object
- *
+ *
* @return the label
*/
private String getLabel(DataTypeValueTreeObject object) {
@@ -443,10 +444,10 @@ public class ProfileElementLabelProvider extends LabelProvider {
/**
* Gets the label.
- *
+ *
* @param object
* the object
- *
+ *
* @return the label
*/
private String getLabel(EnumerationValueTreeObject object) {
@@ -488,10 +489,10 @@ public class ProfileElementLabelProvider extends LabelProvider {
/**
* Gets the label.
- *
+ *
* @param object
* the object
- *
+ *
* @return the label
*/
private String getLabel(StereotypeValueTreeObject object) {
@@ -530,10 +531,10 @@ public class ProfileElementLabelProvider extends LabelProvider {
/**
* Gets the label.
- *
+ *
* @param object
* the object
- *
+ *
* @return the label
*/
private String getLabel(MetaclassValueTreeObject object) {

Back to the top