Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 462323

Summary: [Model Import] Structure diagram gets a name even if it has none in the source model
Product: [Modeling] Papyrus-rt Reporter: Robert Lundbäck <robert.lundback>
Component: toolAssignee: Christian Damus <give.a.damus>
Status: CLOSED FIXED QA Contact: Peter Cigehn <peter.cigehn>
Severity: normal    
Priority: P2 CC: charles, cletavernier, papyrus-bugs, peter.cigehn, ronan.barrett, rschnekenburger
Version: 0.7.2   
Target Milestone: 0.8.0   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/75789
https://git.eclipse.org/c/papyrus-rt/org.eclipse.papyrus-rt.git/commit/?id=2639899e0ecf328775f1c0558c8f41d697cf44c8
https://git.eclipse.org/r/75953
https://git.eclipse.org/c/papyrus-rt/org.eclipse.papyrus-rt.git/commit/?id=14f8a4e9e1b0b7179ee1bac97c60f0cdb556921a
https://git.eclipse.org/r/77090
https://git.eclipse.org/c/papyrus-rt/org.eclipse.papyrus-rt.git/commit/?id=758429efe876368a24ca2c8951e450c4c372e8b3
Whiteboard:
Bug Depends on: 496439    
Bug Blocks: 469851    

Description Robert Lundbäck CLA 2015-03-17 05:30:52 EDT
If you import a rsarte model containing a Capsule with its structure diagram, and this diagram is unnamed, the resulting diagram after import in Papyrus is named with same name as the Capsule.

The importer shall not add a name if the diagram is unnamed in the source.

An additional and related aspect of this is what label that shall be shown in the model explorer if the diagram is unnamed. One obvious option is to show the Capsule name ( but that is not same thing as giving the Capsules name to the diagram during the import). This last aspect will probable be handled in a separate bugzilla (yet to be written).
Comment 1 Camille Letavernier CLA 2015-03-17 06:13:00 EDT
I'm pretty sure we had the opposite request, to explicitly give a name to unnamed diagrams, because Unnamed diagrams in RSA are displayed with the name of their base element, whereas in Papyrus the displayed name is not computed at all (i.e. unnamed diagrams result in empty label in Papyrus, but not in RSA).

Additionally, I'm not sure that unnamed diagrams are properly handled in Papyrus, but these may be separate issues as well.
Comment 2 Camille Letavernier CLA 2015-03-17 06:13:58 EDT
*** Bug 462329 has been marked as a duplicate of this bug. ***
Comment 3 Camille Letavernier CLA 2015-06-29 09:47:04 EDT
We could reuse the LabelProviderService of Papyrus to override the behavior (Keep the current one in Papyrus, and override it for specific users/contexts/applications such as Papyrus-RT)

However, the LabelProviderService is not used everywhere in Papyrus. Especially, it is currently not used for the nested editor Tabs, but it would work in the ModelExplorer. So the suggested steps are:

- Let the Nested Tabs rely on the LabelProviderService to display their text and icon
- Contribute a Label Provider for RSA-imported models (Not enabled by default in Papyrus), that provides the name of the Context if the diagram is unnamed
- Change the RSA-To-Papyrus transformation so that it doesn't give a name to unnamed diagrams

Since this impacts both Papyrus Core and RSA Migration, this can't be implemented until at least SR1

Adding Ronan and Peter in CC, as this would affect all users of the Model Import tool (And not only Papyrus-RT)

Does this sound good for you?
Comment 4 Peter Cigehn CLA 2015-06-29 11:12:53 EDT
I am not sure that I understand all the details and implications here. But from what I understand, the proposal sounds reasonable. The important aspect I see is that if we decide to leave the diagrams unnamed, then the Papyrus-RT tooling should be aligned to this and also do the same for newly created diagrams. See Bugzilla 469851 Comment 6.

But if we agree on that both the import tool and the Papyrus-RT tooling shall leave the composite structure diagram unnamed, and the nested editor tab and the name in the model explorer to be picked up from the root element, i.e. the capsule itself, then I think that this is a good solution. 

This also then avoids any synchronization issues whenever the name of the capsule is changed, and the diagram picks up the new name automatically (without having to change the notation file). Which in its turn also avoids issues with EMF Compare and getting duplicate name changes that must be grouped into one change and so on.

I assume that this solution can be used for other diagram types as well. I do know that also state machine diagrams are left unnamed, and its name label is derived from the semantic model. This is especially important for nested state machines, where the diagram gets its name based both on the name of the capsule and the parent state of the diagram.

Also to further align with legacy models, in case if the diagrams is given an explicit name, then that name shall be used as the name label.
Comment 5 Peter Cigehn CLA 2015-06-29 11:15:29 EDT
(In reply to Peter Cigéhn from comment #4)
> The important aspect
> I see is that if we decide to leave the diagrams unnamed, then the
> Papyrus-RT tooling should be aligned to this and also do the same for newly
> created diagrams. See Bugzilla 469851 Comment 6.

That should be Bug 469851 Comment 6.
Comment 6 Camille Letavernier CLA 2015-06-29 11:16:32 EDT
> The important aspect I see is that if we decide to leave the diagrams unnamed, then the Papyrus-RT tooling should be aligned to this and also do the same for newly created diagrams. See Bugzilla 469851 Comment 6.

Good point. I don't know how this should be implemented however; I suspect that diagram names are currently hard-coded and can't be easily overridden.

Bug 469851 might actually be the solution for UML-RT, since it suggests that the diagram should be created automatically via the UML-RT Tooling (Rather than the standard Papyrus Toolbar, which would be difficult to override)
Comment 7 Peter Cigehn CLA 2015-06-29 11:21:33 EDT
(In reply to Camille Letavernier from comment #6)
> Bug 469851 might actually be the solution for UML-RT, since it suggests that
> the diagram should be created automatically via the UML-RT Tooling (Rather
> than the standard Papyrus Toolbar, which would be difficult to override)

Yes, I would assume that the Papyrus-RT tooling can and should then leave the diagram, that shall be automatically created when the capsule is created, unnamed.
Comment 8 Peter Cigehn CLA 2015-12-08 10:57:02 EST
Not sure if this import related Bugzilla should be moved over to the Papyrus-RT project now when we move the RSARTE specific import functionality over to the Papyrus-RT project as tracked by Bug 48382. Either we see this naming issue to be a pure RSARTE specific naming scheme, or if this naming strategy could be seen as generic RSA behavior then we leave it for RSA import tool.

But since the Bugzilla originally was written specifically for the RSARTE import case, maybe it is simplest to move it over to Papyrus-RT and handle this case as something RSARTE specific.
Comment 9 Eclipse Genie CLA 2016-06-22 21:42:40 EDT
New Gerrit change created: https://git.eclipse.org/r/75789
Comment 11 Christian Damus CLA 2016-06-22 23:04:10 EDT
(In reply to Eclipse Genie from comment #10)
> Gerrit change https://git.eclipse.org/r/75789 was merged to [master].

Capsule structure diagrams and state machine diagrams that were unnamed in the RSA-RTE model now are also unnamed in the Papyrus model resulting from the import.
Comment 12 Peter Cigehn CLA 2016-06-23 06:53:16 EDT
Verified in the latest Papyrus-RT build (including the latest Papyrus build), that unnamed diagrams still are left unnamed after import, and the diagrams with an explicit name gets that name. This ensures that the derived diagram namel label is picked up for unnamed diagrams.
Comment 13 Eclipse Genie CLA 2016-06-24 17:17:44 EDT
New Gerrit change created: https://git.eclipse.org/r/75953
Comment 15 Eclipse Genie CLA 2016-07-12 00:02:43 EDT
New Gerrit change created: https://git.eclipse.org/r/77090
Comment 17 Charles Rivet CLA 2016-09-29 14:39:29 EDT
Closing - no update since August.