How to call own Java Method in Sirius [message #1847407] |
Tue, 26 October 2021 07:21  |
Eclipse User |
|
|
|
Hi, I want to call my own java method when the user clicked to the diagram element. How can I do it? I can not use Services class in VSP. What should I do? Should I use the External Java Actions? Is there any tutorial for external java actions?
|
|
|
|
|
Re: How to call own Java Method in Sirius [message #1847804 is a reply to message #1847609] |
Mon, 08 November 2021 18:20   |
Eclipse User |
|
|
|
Hello,
Indeed, you should use a double click tool in the end, but before that fix the problem with your java services. You don't have to use java services, but it quickly become an easy solution with more complex tools. When you created your Viewpoint Specification Project (project with the .odesign), it should have created a class with the name of your viewpoint and ending by services (if you called your odesign project "AwesomeProject" the java service class will be named "AwesomeProjectServices"). Each public java method you add to this class is accessible from your odesign, in the "interpreted expression" fields like "semantic candidate expression" (all the text fileds with a yellow background). If you have a java service named "myJavaService", in the odesign you can call it with the expression aql:self.myJavaService. Remember that the class of the first parameter of the java service should match the class of the context where the expression will be executed. For instance, if you make a double click tool for a node mapping with the domain class "MyClass", then the java service should have as first argument a "MyClass" element. You can have your service with a first element as an EObject as a first test, but you will probably want to switch it to a proper type later in order to only have the service for the good context when you are working in your odesign.
Best regards,
Steve
|
|
|
Re: How to call own Java Method in Sirius [message #1848011 is a reply to message #1847804] |
Wed, 17 November 2021 07:07  |
Eclipse User |
|
|
|
Steve Monnier wrote on Mon, 08 November 2021 23:20Hello,
Indeed, you should use a double click tool in the end, but before that fix the problem with your java services. You don't have to use java services, but it quickly become an easy solution with more complex tools. When you created your Viewpoint Specification Project (project with the .odesign), it should have created a class with the name of your viewpoint and ending by services (if you called your odesign project "AwesomeProject" the java service class will be named "AwesomeProjectServices"). Each public java method you add to this class is accessible from your odesign, in the "interpreted expression" fields like "semantic candidate expression" (all the text fileds with a yellow background). If you have a java service named "myJavaService", in the odesign you can call it with the expression aql:self.myJavaService. Remember that the class of the first parameter of the java service should match the class of the context where the expression will be executed. For instance, if you make a double click tool for a node mapping with the domain class "MyClass", then the java service should have as first argument a "MyClass" element. You can have your service with a first element as an EObject as a first test, but you will probably want to switch it to a proper type later in order to only have the service for the good context when you are working in your odesign.
Best regards,
Steve
Thank you
|
|
|
Powered by
FUDForum. Page generated in 0.04002 seconds