Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » How to Highlight all references to an object in a Sirius Diagram
How to Highlight all references to an object in a Sirius Diagram [message #1794043] Wed, 22 August 2018 19:13 Go to next message
Steve Hickman is currently offline Steve HickmanFriend
Messages: 56
Registered: August 2017
Member
I'm creating a Sirius VSM where the edges represent a network. Information can flow across the edges from node to node. I would like to be able to select a data structure from a list of those defined in my model and then highlight every place that data structure is referenced *and* show the transitive closure of how that data structure can flow across the edges of the network from node to node.

I can create a Java service that will identify the references and transitive closure, given a data structure.

What I don't know how to do is:
1) Create a selection dialog to select a data structure from a list of possible data structures (I have found very little documentation on this)
2) How to dynamically change the visual representation of the nodes and edges through which the data structure passes.

Any pointers / suggestions?
Re: How to Highlight all references to an object in a Sirius Diagram [message #1794072 is a reply to message #1794043] Thu, 23 August 2018 08:58 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 572
Registered: May 2011
Senior Member
Hello,

I think that the simplest solution if to use a Selection Wizard [1] where you can select a data structure (that would be your first point). In the candidates expressions, you should have an expression returning every element that can be selected to a data structure. Then in the "Element to Select"[2] field you simply specify "var:element". This way all the elements that were selected in the Selection Wizard will be selected on the diagram, once you press finish. As they are selected they will be highlighted.

Best regards,
Steve

[1] https://www.eclipse.org/sirius/doc/specifier/diagrams/Diagrams.html#tools
[2] https://www.eclipse.org/sirius/doc/specifier/general/ToolsSpecification.html


Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: How to Highlight all references to an object in a Sirius Diagram [message #1794363 is a reply to message #1794072] Wed, 29 August 2018 15:04 Go to previous messageGo to next message
Steve Hickman is currently offline Steve HickmanFriend
Messages: 56
Registered: August 2017
Member
Thanks for your rapid response. I am trying this out. I apparently did not properly communicate one key thing.
The items that I select (data structures) do not have a visual representation in the diagram (which contains only nodes,
ports on those nodes, and edges between ports). What I'm trying to do is highlight the nodes, ports and edges that the
data structures flow through. I've written a service method that takes the selected data structures and finds the nodes,
ports, and edges (the semantic elements, not the DRepresentationElements). The challenge I'm facing is that the service method in
the 'Elements to Select' field isn't being called. The service method for the 'Candidates Expression' is being called, so I know
I've properly registered the service class.

In the 'Candidates Expression' field, the successful call looks like this:
service:<method name>()

In the 'Elements to Select' field, I've tried the following:
1) service:<static method call using class.method name>()
2) service:<instance method name where the first parameter is the same type as the one used in the 'Candidates Expression' service method call>()
3) [container.<instance method where the first parameter is the same type as the one used in the 'Candidates Expression' service method call>()/]
4) [element.<instance method>()/]
Note that I have defined methods that take as the first parameter an object of type:
EObject, Collection<EObject>, the type used in the successful 'Candidate Expression' call, as well as a static method that takes no parameters.

None of these methods get called.

None of these have worked. What's the correct call? What is the context this method will be called in? What am I doing wrong?

Other notes:
*) I'm using the standard GEMOC Studio distribution which includes Sirius 5.1.1.201801311428.
1) Users will select a single data structure but that multiple diagram elements will be highlighted as a result. Should the Selection Wizard mulitple box be checked or not in this case?
2) I'm looking at https://www.eclipse.org/forums/index.php/t/1000795/ to see if that will provide additional insight

Follow up:
I changed my method that supplies the 'Candidates Expression' field to return a list of edges (these semantic elements have a graphical representation). I then checked the 'Multiple' field so that element should contain a Collection<EObject> and set the 'Elements to Select' field to 'var:element'
That should mean that all the selected edges should be highlighted after the Selection Wizard is finished. That did not happen. The selection did not change.

More Follow Up:
The Sirius Tool Specification doc , in the 'Selection after tool execution' section, says: In any case, if the default list of elements is not empty, the list of elements returned is filtered with the default selected elements. In case of creation tool, the default list contains newly created elements so, the returned list can contain at most that elements. If I understand this correctly, this means that the list of items finally displayed as selected must be a subset of those selected in the Selection Wizard dialog. In other words, this means that I cannot use the Selection Wizard to select something other than what I want to appear as selected or a superset thereof. If that is true, then I cannot use the Selection Wizard for my original intended purpose because I cannot use the Selection Wizard to select something with no graphical representation, use that input to calculate what I want to appear as selected, and expect the selected elements to change after using the tool.

Is that correct?

[Updated on: Wed, 29 August 2018 20:15]

Report message to a moderator

Re: How to Highlight all references to an object in a Sirius Diagram [message #1794598 is a reply to message #1794363] Mon, 03 September 2018 14:46 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
Hi,
It seems correct to me.
I suggest you to create a stub data structure mapping. I.e a mapping without any style. It means it will not be visible on your diagram but still will exist. In this situation, your data structures will be available in your wizard.

Regards,



Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: How to Highlight all references to an object in a Sirius Diagram [message #1794717 is a reply to message #1794598] Wed, 05 September 2018 11:21 Go to previous messageGo to next message
Steve Hickman is currently offline Steve HickmanFriend
Messages: 56
Registered: August 2017
Member
I apologize for miscommunicating: I can create the Selection Wizard and populate it with the data structures without having a hidden stub mapping. The problem is that when I exit the Selection Wizard, I have a list of data structures but what I want to select/highlight is all the nodes and edges where those data structures are used. I'm trying to select/highlight something that isn't in my Selection Wizard list.

I originally thought that I could add a service call to the 'Elements to Select' property of the the Selection Wizard that would take the list of selected data structures as input and return a list of nodes and edges. But the documentation seems to indicate that the list returned from any expression in the 'Elements to Select' property can only contain elements that were in the list originally presented to the user (in my case, data structures) not something else (nodes and edges).
Re: How to Highlight all references to an object in a Sirius Diagram [message #1794720 is a reply to message #1794717] Wed, 05 September 2018 12:41 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
Hi,

The doc is not really clear but since your execution context is out of a tool, it should work. If not feel free to make a Sirius ticket in https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Sirius

Regards,


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: How to Highlight all references to an object in a Sirius Diagram [message #1794725 is a reply to message #1794720] Wed, 05 September 2018 14:59 Go to previous messageGo to next message
Steve Hickman is currently offline Steve HickmanFriend
Messages: 56
Registered: August 2017
Member
Thanks for your rapid response. Going back to the question in the longer post: My attempts to call a service in the 'Elements to Select' field are not working. Why? What should the type of the first parameter of my service be? Should it be the same as the type of an element from the selection list (a structure)? Should it be the type of the semantic element of the diagram as a whole? The type of the semantic element on which the selection list was called? Something else? Or is this what may need a bug report?

[Updated on: Wed, 05 September 2018 16:43]

Report message to a moderator

Re: How to Highlight all references to an object in a Sirius Diagram [message #1794778 is a reply to message #1794725] Thu, 06 September 2018 12:03 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
Sorry I missed that question.

With the following service:
    public Collection<EObject> myService(EObject self) {
        // TODO Auto-generated code
        return null;
    }



The service should be called with
aql:element.myService()


service: works only with services using self as parameter.

There is also a problem with multiple selection. In this case the element variable will only be the first element of the multiple selection.

I made a ticket: https://bugs.eclipse.org/bugs/show_bug.cgi?id=538727

Regards,


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: How to Highlight all references to an object in a Sirius Diagram [message #1794900 is a reply to message #1794778] Mon, 10 September 2018 15:55 Go to previous messageGo to next message
Steve Hickman is currently offline Steve HickmanFriend
Messages: 56
Registered: August 2017
Member
Thanks for your response. I've tried what you describe and it does not work for me. I added a System.out.println() statement to the method called from the 'Elements to Select' property , which should have printed the string in the console window but nothing showed there. The method used for the 'Candidates Expression' property also has a System.out.println() statement and that string does print in the console window.

I attempted to compare your sample to what I'm doing. I encountered two issues:
1) In the design project, I set the following dependency to optional because I don't have it installed:
org.eclipse.sirius.tests.sample.migration;resolution:=optional,

2) When attempting to load the sample project I got the following:
An internal error occurred during: "Loading models".
The modeling project "sample project" is invalid: Problem during loading models:
The Sirius resource (platform:/resource/sample%20project/representations.aird) can not be loaded because it comes from a more recent Sirius release.
Representation version is: 14.1.0.201808300808
Last Sirius migration version is: 13.0.0.201804031646

Does the first problem cause the second problem?
I've got Sirius 6.0.1.201808231529 installed - I just updated within the last 4 hours. How do i fix the problems?

[Updated on: Mon, 10 September 2018 17:38]

Report message to a moderator

Re: How to Highlight all references to an object in a Sirius Diagram [message #1794949 is a reply to message #1794900] Tue, 11 September 2018 13:54 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
Hi,

The project has been made with future 6.1.0 Sirius that is not released yet so it is normal you cannot use it.
But the sample would not be really useful for you. The interesting part in the design project.
What is your method signature and your aql expression?

Regards,


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: How to Highlight all references to an object in a Sirius Diagram [message #1794967 is a reply to message #1794949] Tue, 11 September 2018 19:24 Go to previous messageGo to next message
Steve Hickman is currently offline Steve HickmanFriend
Messages: 56
Registered: August 2017
Member
My current test copied the content of your sample:
Methods:
/**
* See http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.sirius.doc%2Fdoc%2Findex.html&cp=24 for
* documentation on how to write service methods.
*/
public Collection<EObject> myService(EObject self) {
// TODO Auto-generated code
System.out.println("myService EObject self");
return null;
}

/**
* See http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.sirius.doc%2Fdoc%2Findex.html&cp=24 for
* documentation on how to write service methods.
*/
public Collection<EObject> myService(EObject self, EObject self2) {
// TODO Auto-generated code
System.out.println("myService EObject self EObject self2");
return null;
}

/**
* See http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.sirius.doc%2Fdoc%2Findex.html&cp=24 for
* documentation on how to write service methods.
*/
public Collection<EObject> myService(Object self) {
// TODO Auto-generated code
System.out.println("myService Object self");
return null;
}

/**
* See http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.sirius.doc%2Fdoc%2Findex.html&cp=24 for
* documentation on how to write service methods.
*/
public Collection<EObject> myService(Collection<Object> self) {
// TODO Auto-generated code
System.out.println("myService Collection<Object> self");
return null;
}

Call in 'Elements to Select' (each tried separately):
aql:element.myService()
service:self.myService()
service:self.myService(element)
aql:self.myService(element)

In no case do I see anything from these methods in the console window.
Re: How to Highlight all references to an object in a Sirius Diagram [message #1795009 is a reply to message #1794967] Wed, 12 September 2018 14:59 Go to previous message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
HI,

Is your service class containing the method registered in the odesign?
If so I don't know why this method does not trigger.
Can you provide us your metamodel and odesign project to check it or a small version with a design with ecore where you can reproduce the problem?

Regards,


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Edge creation for several relations
Next Topic:Advised method to learn and use sirius
Goto Forum:
  


Current Time: Sat Apr 20 03:03:21 GMT 2024

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

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

Back to the top