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

Bug 492607

Summary: Inner container does not auto-fit to the parent container when opening diagram using sirius "Navigate"
Product: [Modeling] Sirius Reporter: Parsa Pourali <pourali_parsa>
Component: DiagramAssignee: Project Inbox <sirius.diagram-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: info, julien.dupont, laurent.redor, maxime.porhel, pourali_parsa
Version: 3.1.0Keywords: triaged
Target Milestone: 3.1.6   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on: 495046, 495119, 495707, 497398, 497402, 497403, 499828, 499831    
Bug Blocks:    
Attachments:
Description Flags
Screenshot of the problem
none
reproducible minimal example for bug
none
FormlGrammar
none
Ecore use case none

Description Parsa Pourali CLA 2016-04-27 17:49:20 EDT
Created attachment 261319 [details]
Screenshot of the problem

Hi,

In my diagram I have a statemachine in which a State can have multiple regions inside it. The thing is that when I initialize a diagram for the statemachine I can see two problems.

- (See Attached Image) The inner region(main) is not auto-fit to the parent container(SM_f4:StateDiagram).However, when I add the second region (main's sibling), it will fix the problem and both regions will be autofit in the parent container.

- The position of the root statemachine container (SM_F4:StateDiagram) goes to the right-down corner of the diagram. I think it soould be kept on the left-upper corner.

This happens when: From my class diagram, I right click on a class and choose "Create State Diagram". Then, I create a state machine semantic object in the model, and a main region inside it and also an initial state for the user to start with. Then I use Navigate tool in Sirius to create and open a new state diagram associated to the object I just created. And the image is what I get !

The outer region : "SM_F4: StateDiagram" is a vertical stack (to show multiple concurrent regions). The size for Height Computation Expression and Width Computation Expression is set to 50 , 30. Note that if I change it to -1 and -1 and it will be autosized and fixes the problem. However it will become a very small box (I need 50X30 as the size).

The inner Region "main" is a Free Form container and also with the size of -1 and -1.

So, everything is fine when I myself open the diagram , resize the outer region. It only occurs when I use Navigate to create the diagram.

The other thing is that when this happens, I tried to add the second region (in the outer vertical stack region), it fixed the main region and the main region will also become automatically fit to the parent one.

So, I guess the problem is only with using Navigate to initialize the diagram.


Thanks,
Best Regards,
Parsa
Comment 1 Julien Dupont CLA 2016-04-28 10:06:48 EDT
Hi, 

Thank you for your feedback.

Would you give us your reproducible use case?

Regards,
Comment 2 Parsa Pourali CLA 2016-04-28 10:51:39 EDT
Created attachment 261342 [details]
reproducible minimal example for bug
Comment 3 Parsa Pourali CLA 2016-04-28 10:56:57 EDT
Hi Julien,

I have attached the reproducible attachment for bug. 
1- Import the zip file in your workspace. 
2- In the test_modeling folder, open the feature classes diagram.
3- Right click on a feature (e.g. F4) -> Navigate to -> Create Feature Module.
4- A State machine will be opened and you will see the look.

Note 1: The action for navigation in the odesign description can be found in:
->Forml Design Description -> Feature Classes Diagram ->Feature Classes (Layer) -> Section Clickable Actions -> PopUp Menu Navigate to -> Operation Action Create Feature Module.

Note 2: You might need to select view point in order to be able to use the description.

Thanks,
Bests,
Parsa
Comment 4 Julien Dupont CLA 2016-04-28 11:44:13 EDT
Hi Parsa, 

Would you give me a model forml valid? This used by use case does not work. I can't open it. 
Error obtained: org.xml.sax.SAXParseExceptionpublicId: platform:/resource/test_modeling/My.forml; systemId: platform:/resource/test_modeling/My.forml; lineNumber: 1; columnNumber: 1; Contenu non autorisé dans le prologue.

Regards,
Comment 5 Parsa Pourali CLA 2016-04-28 13:01:40 EDT
Hi Julien,

The my.forml model is valid, I think it throws error because you have to have the forml metamodel registered in your environment. I guess the problem can be fixed by taking the following steps:

1- there are uw.cs.watform.forml and uw.cs.watform.forml.odesign projects in the zip file. import these two into your workspace first.

2- Open the uw.cs.watform.forml project. There is an xtext file (forml.xtext) in it. Create the xtext artifacts by right clicking the file and use Run As-> Generate Xtext Artifacts.

3- Run the project in a new eclipse environment (Run As-> New Eclipse Application).

4- Import the modeling project from the zip file (test_modeling).

5- Now the my.forml should be valid. You should right click on the modeling project and select viewpoint (Forml viewpoint).

6- Then open the feature classes diagram and the rest as explained before.

Please let me know if it still didn't work.
Thanks,
Bests,
Parsa
Comment 6 Julien Dupont CLA 2016-04-29 08:51:42 EDT
Hi Parsa, 

It seems like that uw.cs.watform.forml.ui is required during Xtext generation.
Could you confirm and send me if it's required?

Thanks.

Regards,
Comment 7 Parsa Pourali CLA 2016-04-30 14:19:56 EDT
Hi Julien,

Sorry, I totally forgot that. Please find attached the complete grammar files and folder.

Thank you,
Bests,
Parsa
Comment 8 Parsa Pourali CLA 2016-04-30 14:20:29 EDT
Created attachment 261391 [details]
FormlGrammar
Comment 9 Julien Dupont CLA 2016-05-03 11:50:04 EDT
Created attachment 261436 [details]
Ecore use case

Problem reproduced with an example ecore. 

To reproduce problem:
- open my.project.design
- open My.aird in model directory and open new DiagramClass
- right click on E1 CreateDiagramDataType/CreateDataType

The graphical element E1 Datatype is created in the middle of the canvas instead of top left corner.
Comment 10 Maxime Porhel CLA 2016-06-29 04:56:41 EDT
The corrections of Bug 495046, Bug 495119 and Bug 495707 might improve the situation.
Comment 11 Laurent Redor CLA 2016-07-07 10:24:33 EDT
In use case of comment 9, the new element is in the middle of the canvas (visible part of the diagram). This is the expected behavior: the new elements without known layout data information are created in the middle of the visible part of the diagram.
Technical information: This is done through SiriusLayoutDataManagerImpl.getArrangeCreatedViewsCommand(List<IAdaptable>, List<IAdaptable>, IGraphicalEditPart).


For the initial problem about the auto-fit, I think it is resolved in Sirius 3.1.6 with clones of bugzilla mentioned by Maxime above. Sirius 3.1.6 is not released but you can use a nightly build to test ([1], [2], [3] or [4]).

Feel free to reopen this bug if it is not the case.

[1] http://download.eclipse.org/sirius/updates/nightly/3.1.x/juno
[2] http://download.eclipse.org/sirius/updates/nightly/3.1.x/kepler
[3] http://download.eclipse.org/sirius/updates/nightly/3.1.x/luna
[4] http://download.eclipse.org/sirius/updates/nightly/3.1.x/mars
Comment 12 Parsa Pourali CLA 2016-07-07 10:35:39 EDT
Hi Laurent,

(In reply to Laurent Redor from comment #11)
> In use case of comment 9, the new element is in the middle of the canvas
> (visible part of the diagram). This is the expected behavior: the new
> elements without known layout data information are created in the middle of
> the visible part of the diagram.
> Technical information: This is done through
> SiriusLayoutDataManagerImpl.getArrangeCreatedViewsCommand(List<IAdaptable>,
> List<IAdaptable>, IGraphicalEditPart).
> 
> 

that's true, but just as a suggestion, if you take a look at the attachment which name is "Screenshot of the problem", you can see that the container is placed at the middle , but since it is a big one, it causes Horizontal scroll bar on the canvas. So, the user needs to scroll to see the whole container. If you take a look at the attachment, you can see that I have scrolled to the end and then took the snapshot. I am not sure, but my guess is that either
- the upper left corner of the container is considered to be placed at the middle of the canvas. In this case I think it is better to consider the container's center point as the reference point to be placed at the middle of canvas.
- or the canvas size is measured wrongly. In this case I guess the canvas size should be considered as the canvas viewable area rather than the whole size.

Thanks,
Parsa
Comment 13 Laurent Redor CLA 2016-07-07 10:59:18 EDT
Hi Parsa,

Indeed, it is an interesting suggestion. Can you create a new bugzilla as enhancement for this.
You can reuse the use case of Julien [1] to illustrate it.

[1] https://bugs.eclipse.org/bugs/attachment.cgi?id=261436
Comment 14 Pierre-Charles David CLA 2016-10-11 04:39:15 EDT
Available in Sirius 3.1.6.