Change colour of specific node from code [message #1798850] |
Mon, 26 November 2018 10:29  |
Eclipse User |
|
|
|
Hi all,
I would like to know, if it is possible to change the colour of specific nodes by code.
In my project I create a model with the help of sirius editor. Then I use the another Add-on (henshin) for graph pattern matching on the model file. In the final step I would like to change the colour of certain nodes.
I read, that I should use java services to achieve my goal but I can't get it to work. My two problems are, that I don't know how to change the style properties when I only have the Eobject instance and I don't know how to call the service from outside the sirius editor. In the sirius tutorial it is only shown how to start a service from within the editor.
Any help is appreciated.
Regards
Florian
|
|
|
|
|
|
|
|
Re: Change colour of specific node from code [message #1799143 is a reply to message #1799089] |
Fri, 30 November 2018 07:41   |
Eclipse User |
|
|
|
Hi,
I didn't know about singletons, so I had to read up a little about the concept. It seems quite fitting for my purposes but there is a problem I couldn't solve. How can the editor and the external java class (which is looking for risk patterns) access this singleton class?
Right now I have two runtimes (like in the tutorial). In the first one I created the ecore model. The second one is started through running the .editor project as another eclipse instance. In the second instance is the sirius editor with the .odesign file. The singleton class is supposed to be in the same project as the pattern matching class in the first runtime, right?
For better understanding:
1. Runtime: Ecore model, .edit project, .editor project, pattern matching project
2. Runtime: Sirius editor project (with .odesign file), project with models for testing purposes
The problem is, that I can't place the singleton class in the sirius project nor in the pattern matching project because of the accessibility.
Regards,
Florian
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Change colour of specific node from code [message #1799769 is a reply to message #1799294] |
Thu, 13 December 2018 06:22  |
Eclipse User |
|
|
|
Sorry for the delayed reply but I had to finalize the project or rather I had to get it working. In the end it didn't work out the way I wanted because I couldn't get the singleton to work properly.
The reason it wasn't initialized was a check missing in the manifest of the project containing the project. ("Activate this plug-in when one of its classes is loaded"). With this check the sirius project was able to access the singleton instance properly but the Graph-Pattern Matching class in the project containing the singleton couldn't. It was always null.
In the end I created an xml File witch contained the findings of the Graph-Pattern Matching and let both projects access it. The path had to be hard coded so it's far from optimal but it works for now.
The current problem is rather me not knowing enough about plug-in development and singletons. So I will dig deeper into that. Thanks to you I know where I have to look.
Thanks a lot for all your help. I greatly appreciate it.
|
|
|
Powered by
FUDForum. Page generated in 0.06104 seconds