Bug 462791 - [Profiles][UMLPropertiesView] Provide ability to unset optional tagged values.
Summary: [Profiles][UMLPropertiesView] Provide ability to unset optional tagged values.
Status: UNCONFIRMED
Alias: None
Product: Papyrus
Classification: Modeling
Component: Core (show other bugs)
Version: 1.1.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-22 12:49 EDT by Johan Van Noten CLA
Modified: 2017-08-07 10:46 EDT (History)
1 user (show)

See Also:


Attachments
Archive containing profile + model with applied profile (5.10 KB, application/x-zip-compressed)
2015-03-22 12:49 EDT, Johan Van Noten CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Johan Van Noten CLA 2015-03-22 12:49:47 EDT
Created attachment 251809 [details]
Archive containing profile + model with applied profile

Scenario (also see two models in attachment):
* Create a profile
* Import metaclass Class
* Extend Class with Stereotype1
* Add a property Attribute1 with:
  - Type: a newly created Enumeration1 with two literals
  - Multiplicity: 0..1
* Define it
* Create a UML model
* Apply the profile created above
* Create a Class diagram
* Add a Class
* Apply the Stereotype1
* Look at the tagged values

Problem (s):
* The tagged value is already filled with the first literal.
  This is strange. We didn't provide any default value.
* There is no way (afaik) to remove the value (so Attribute1==null)

Remark:
I took the example of an Enumeration here, but the same problem exists for basic types such as UML's Integer. There the value is automatically 0 and no null can be assigned.
Comment 1 Christian Damus CLA 2015-03-22 16:11:24 EDT
This is a consequence of the implementation of enumerations and primitives in EMF and Java.  In Java, primitive fields/variables always have a value.  They cannot be null (for that, the wrapper classes are required).  And EMF implements the same semantics for enumerations:  they are like primitives, always having a value.

However, EMF also provides for a separate set/unset state of a property, dubbed "unsettable"-ness.  Unset for primitives that have no explicit defaults could be interpreted as a null value, and an explicit unset action can return a property that was set back to unset state even when null cannot be assigned.  But, that interpretation is application-specific.  I don't think that it is something that Papyrus can impose.

This issue has been raised before in the UML2 project in the context of both code generation and dynamic profiles.  See, for example, bug 164095 which is resolved as "won't fix" with a statement that the Ecore profile should be used to tag properties as unsettable where needed.  I doubt that Papyrus can do anything more than this.
Comment 2 Camille Letavernier CLA 2015-03-23 04:50:21 EDT
One thing Papyrus could do, once the property is configured as "Unsettable", is to provide a button to actually unset it; and support the <<Unset>> value in the Combo Box
Comment 3 Christian Damus CLA 2015-03-23 06:02:02 EDT
(In reply to Camille Letavernier from comment #2)
> One thing Papyrus could do, once the property is configured as "Unsettable",
> is to provide a button to actually unset it; and support the <<Unset>> value
> in the Combo Box

+1

But other primitives such as Integer, String don't have combo boxes.  What to do for those?
Comment 4 Camille Letavernier CLA 2015-03-23 06:23:10 EDT
> But other primitives such as Integer, String don't have combo boxes. What to do for those?

Two options: An "unset" button for text fields, or a Magical <Unset> value. We used both already, and I think the <Unset> magical value is still used today (At least in the Papyrus properties view framework, which may not be used by the Profile tab)