Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Some question about usage of Sirius
Some question about usage of Sirius [message #1768942] Tue, 25 July 2017 07:26 Go to next message
Nicholas Kong is currently offline Nicholas KongFriend
Messages: 59
Registered: July 2016
Location: China
Member
Sirius is a great modeling project. But I encounter some questions when I use it. So I wish I can get the answer here. Sorry for my poor English.

1. How to add a constraint "User can only create just one diagram for one object"?
index.php/fa/30127/0/

2. I checked the odesign file in EcoreTools project, I found when user double-click Empty-Diagram (like below), it will create view for the 'Not synchronized' elements. I need a function: automatic load the 'Not synchronized' elements when user creates a new diagram (need not trigger from double-click an image).
index.php/fa/30128/0/
I tried defining the 'Begin' in the diagram, but it can't work, maybe the 'Container View Expression' is not correct. How to implement this function?

3. How to implement a function: automatic set the bordered node position when user creates a new object.
For example:
When user creates a new object, I need create two ports, one is in the middle of the left edge, and another one is in the middle of the right edge, like below.
index.php/fa/30129/0/
I know I can define the 'Authorized Sides' in the Style properties, but I don't know how to define the 'middle of the edge' limitation.

4. How to resize the Container width when user moves the inner element from right to left.
For example:
There is a Diagram like below.
index.php/fa/30130/0/
When user shifts Paris from left to right side, France container will automatic increase its width value to cover Paris.

But when user shifts Paris from right to left, France will not change its size to cover Paris.

I need implement a function: the behavior (when user shifts Paris from right to left) same to the behavior (when user shifts Paris from left to right).
How to implement it?

5. I have a requirement: When user connects A and B, the port will connect like: 2-a, 2-b, 2-c.
index.php/fa/30131/0/
I think implement this requirement by configuration in odesign is very difficult. So I implement this function use Java Service. I define a "Change Context: aql:source.Connect(source, target)" in odesign. And implement the connect operation in Java code:
public List<Connector> Connect (EObject e, EObject source, EObject target) {
MyPackage MyPackage = MyPackage.eINSTANCE;
MyFactory MyFactory = MyPackage.getMyFactory();
EClass eClass = (EClass) MyPackage.getConnector();
Instance instance = (Instance) source.eContainer();

//Create three Connector and link the port.
for(...){
Connector newConnector = (Connector) MyFactory.create(eClass);
newConnector.setSrc(...);
newConnector.setDest(...);
Instance.connector.add(newConnector);
...
}
}
The behavior is OK now, but I don't know is it a correct way to implement the requirement. Can I change the model value by Java code in here? Does it cause other problems?

These are the question I need to help.
  • Attachment: 1.png
    (Size: 4.41KB, Downloaded 484 times)
  • Attachment: 2.png
    (Size: 19.12KB, Downloaded 472 times)
  • Attachment: 3.png
    (Size: 1.03KB, Downloaded 468 times)
  • Attachment: 4.jpg
    (Size: 69.21KB, Downloaded 797 times)
  • Attachment: 7.png
    (Size: 18.59KB, Downloaded 488 times)

[Updated on: Wed, 26 July 2017 01:31]

Report message to a moderator

Re: Some question about usage of Sirius [message #1768981 is a reply to message #1768942] Tue, 25 July 2017 12:08 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 470
Registered: May 2011
Senior Member
Hello,

I tried to see your attached images, but they can't be opened. I will try to answer your questions anyway.

1. Yes, using the extension point "org.eclipse.sirius.ecore.extender.PermissionProvider" you can provide your own IPermissionAuthority where you would check is a representation already exists.

2. "Not synchronized" diagram element is not the default behavior. On a (Node/Container/Edge) mapping, in the advanced tab, by default the synchronization field is set to unsynchronizable. This means that by default every candidate element will appear on the diagram (but it can be unsynchronized by the user). Therefore, the behavior you want is the default one. The Ecore Tool uses the "Not synchronized" feature in order to let the user display only what he wants.

3. Indeed the Authorized size will not center the element (as a matter of fact, the border elements are placed clockwise by GMF). The user can improve placement using the "Distribute" action. However, if you want to automatically place the element at the middle of a border, you will need to implement your own layout [1].

4. Yes, you can set the container to autosize using the contextual menu Format/Autosize

5. I am not entirely sure what you are doing without the images but yes you can change semantic elements values in your Java code as the modification realized by a tool are executed inside a RecordingCommand (EMFT).

Regards,
Steve

[1] https://www.eclipse.org/sirius/doc/developer/extensions-provide_custom-arrange-all.html


Steve Monnier - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Some question about usage of Sirius [message #1769030 is a reply to message #1768981] Wed, 26 July 2017 02:04 Go to previous messageGo to next message
Nicholas Kong is currently offline Nicholas KongFriend
Messages: 59
Registered: July 2016
Location: China
Member
Hi Steve,

Thanks for you reply.
Sorry for you can not see the image, I have re-attached them.
Mr. Bo Zhang will give you some feedback about these problem.

Thanks
Re: Some question about usage of Sirius [message #1769069 is a reply to message #1768981] Wed, 26 July 2017 09:14 Go to previous messageGo to next message
Bo Zhang is currently offline Bo ZhangFriend
Messages: 28
Registered: July 2017
Junior Member
Hi Steve thanks for your replay.

For your answer:
1. Yes, using the extension point "org.eclipse.sirius.ecore.extender.PermissionProvider" you can provide your own IPermissionAuthority where you would check is a representation already exists.
Thank you, I found an Uri https://www.eclipse.org/forums/index.php/t/1087632/, it also provides make the diagram read-only function that I need.
But I can't find more detail information about "PermissionProvider" (also I don't know is there other provider I can use), where can I get more information about Providers, do you have any documents?

2. "Not synchronized" diagram element is not the default behavior. On a (Node/Container/Edge) mapping, in the advanced tab, by default the synchronization field is set to unsynchronizable. This means that by default every candidate element will appear on the diagram (but it can be unsynchronized by the user). Therefore, the behavior you want is the default one. The Ecore Tool uses the "Not synchronized" feature in order to let the user display only what he wants.
Thanks for your explanation, I know the difference between "Not synchronized" and "Unsynchronizable", and I know the EcoreTools uses the "Not synchronized" feature. The function I need is same to "Double click Import Current EClasses"(defined in "Entities in a Class Diagram"-"Default"-"Section Existing Elements"), but I wish the diagram could import the element by default with a condition, need not user double click an image to trigger the import action like EcoreTools. I already implement a function "Container Drop" for user imports other element to the diagram.


3. Indeed the Authorized size will not center the element (as a matter of fact, the border elements are placed clockwise by GMF). The user can improve placement using the "Distribute" action. However, if you want to automatically place the element at the middle of a border, you will need to implement your own layout [1].
Sorry I can't find the "Distribute" action, is it a new feature in Sirius? I use 4.1.2 now.
About implement a new layout. I know it is a huge work........

4. Yes, you can set the container to autosize using the contextual menu Format/Autosize
Sorry I can't find the Format/Autosize menu....
The image is OK now, please look at the image, you can know my particular requirement. Thank you.


5. I am not entirely sure what you are doing without the images but yes you can change semantic elements values in your Java code as the modification realized by a tool are executed inside a RecordingCommand (EMFT).

So I will modify the semantic elements values. And I found I can change the view after "Create View".
I think user java Service to modify it is more easy and clarity than configure many items in odesign file.

Re: Some question about usage of Sirius [message #1769269 is a reply to message #1769069] Fri, 28 July 2017 13:21 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 470
Registered: May 2011
Senior Member
Hello,

1. There are some documentations on the extension page and in the Sirius help pages [1].

2. I am not entirely sure to understand what you want to do. From what I understood, you should have two mappings:
- one mapping that is synchronized and with a precondition. This way, when the diagram is created the candidate elements will be displayed automatically.
- another mapping that is unsynchronized and your Container drop uses this mapping to display the element you drag and drop.
- both mappings uses the same style so the user will not see the difference.

3. The action is in the tabbar, it should be the third one when you have a selection. It was already available in Sirius 4.1.

4. This contextual menu is available once an element is selected.

5. If your Edge mapping is synchronized, you should not have to add a "Create View" operation, as the graphical element will be automatically created on refresh.
You can create the reference using java code, but I do not think it would be difficult using the Model Operation in a Edge Creation Tool. You should only need some "Set Value" operation and a "Create Instance" operation if you are using an Element Base Edge Mapping.

Regards,
Steve

[1] https://www.eclipse.org/sirius/doc/developer/integration-plm.html


Steve Monnier - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Some question about usage of Sirius [message #1773536 is a reply to message #1769269] Fri, 29 September 2017 03:36 Go to previous message
Bo Zhang is currently offline Bo ZhangFriend
Messages: 28
Registered: July 2017
Junior Member
Hi Steve MonnierFriend,
For Question 4:
When users drag Paris from left to right, France container will automatic extend its boundary to cover Paris.:
But when users drag Paris from right to left, France's boundary will not be adjusted to cover Paris.
https://www.eclipse.org/forums/index.php/fa/30130/0/

Paris will be hidden when user move it to left. is this a normal feature of Sirius?
Previous Topic:Eclipse ELK vs GEF
Next Topic:Move the node with the arrow key to jump to the position of the mouse
Goto Forum:
  


Current Time: Thu Apr 02 16:51:24 GMT 2020

Powered by FUDForum. Page generated in 0.02136 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top