Bug 517502 - [aird editor] two representations may be created when using the Create new representation wizard from aird editor
Summary: [aird editor] two representations may be created when using the Create new re...
Status: ASSIGNED
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 5.0.0   Edit
Hardware: All All
: P5 normal (vote)
Target Milestone: ---   Edit
Assignee: Pierre Guilet CLA
QA Contact:
URL:
Whiteboard: aird_editor ux
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2017-05-31 05:16 EDT by Pierre Guilet CLA
Modified: 2018-08-21 10:04 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre Guilet CLA 2017-05-31 05:16:36 EDT
In some cases two representations can be created if the representation description they come from has the property "Initialization" activated.

Steps to reproduce:

- Import org.eclipse.emf.ecoretools.design in your workspace
- Change the entity representation description by activating the "Initialization" parameter
- Create a new modeling project.
- Open aird editor
- Add a new ecore model with one package.
- Worskpace viewpoint Design should be disabled.
- Right click on your model package > New representation > Other
- Select the "Entities in class diagram" representation description in workspace Design viewpoint.
- Create the new representation
- Two representations are now present.
- Disabling the viewpoint and redoing the same creation does not create two representations.
Comment 1 Pierre-Charles David CLA 2017-06-06 11:41:14 EDT
Moiving to 5.0.1 to discuss further. After discussion with Pierre, it's not clear the current behavior can be considered a bug. Even if in some very specific (and probably rather rare) circumstances it can produce a surprising behavior, it's not clear what other behavior could be considered more correct.
Comment 2 Pierre Guilet CLA 2017-06-07 05:48:58 EDT
Representations are automatically created for compatible root elements of loaded models when activating a viewpoint with VSM option "Initialization" activated for the first time for a session. 

This behavior seems to me not complete. Because if we load a model, then activate the viewpoint creating all representations needed for the current model elements, then load another model, this new model will never have the automatic creation done et we have no way to do it except by creating a new aird to replace the old one where viewpoint has already been activated once.

In a situation where the user want to create a new representation associated to a viewpoint that has never been initialized from session, we want to do the representation initialization automatically when activating viewpoint before creation or the option will not mean anything because it will be not used. And we cannot use it after.

We also cannot take the representation created automatically and use it instead of the one the user is currently creating. Indeed the wizard to create new representation asks user for the name of a representation. So it will be confusing for a user to have in some context the name asked and in some other a default name used.

So we have different solutions: 
Either we consider the functionality of creating automatically representations not complete and we do an action for it that must be triggered manually but will do all the creation automatically. In this case when loading models after viewpoint initialization user will be able to create it automatically. And we will have no more two representations created with the wizard.

or we can keep the current behavior that we consider normal. It would be the same result as activating the viewpoint first and creating a new representation after. This flow seems normal. The only difference with the wizard is that the user will have difficulty to identify it was caused by viewpoint activation. But if he does not look to its model before creating a new representation, he will also have the same difficulty to identify what causes this.

Finally we can do the representation creation automatically for all model elements except for the one the user want to create a representation for.
Comment 3 Pierre-Charles David CLA 2017-06-22 08:40:18 EDT
The limitations you mention of the "Initialization" option is known. The option also has negative impacts on performance, and is generally not a good idea. It should probably be deprecated/removed if/when we can find a different mechanism to fill the same need (which exists).

In the meantime, I guess we'll have to live with the consequences, including the double creation mentioned in this ticket. I'm moving this ticket to 5.1 to give it another chance; maybe after some more reflection we can find a better compromise. Otherwise it will probably be closed as WONTFIX.