Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Change node icon programmatically
Change node icon programmatically [message #1693706] Mon, 27 April 2015 17:14 Go to next message
Benedek Horvath is currently offline Benedek HorvathFriend
Messages: 6
Registered: April 2015
Junior Member
Hello,

Is there any way to change the icon of a node in a Sirius editor programmatically?

I mean, I have a Representation of the model in a Sirius editor, and I would like to change the icon of a specific node on the canvas.

Therefore I created and added a new External Java Action in the odesign file, that receives all the views, and I iterate over each node, and I want to change the style / icon / graphical representation of a specified node. Is there any way to do it?

Thank you for help, in advance!

Best regards,
Ben
Re: Change node icon programmatically [message #1694055 is a reply to message #1693706] Thu, 30 April 2015 09:20 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 501
Registered: May 2011
Senior Member
Hello,

I think you should use a Diagram Styles Customization (see
https://www.eclipse.org/sirius/doc/specifier/diagrams/Diagrams.html#customization).
You should create a "Property Customization (by expression)". In the
"Applied On" field, you select the style you want to replace the icon.
In the "value expression" you set the path of the new icon.

Regards,
Steve

Le 28/04/2015 18:47, Benedek Horvath a écrit :
> Hello,
>
> Is there any way to change the icon of a node in a Sirius editor
> programmatically?
>
> I mean, I have a Representation of the model in a Sirius editor, and I
> would like to change the icon of a specific node on the canvas.
> Therefore I created and added a new External Java Action in the odesign
> file, that receives all the views, and I iterate over each node, and I
> want to change the style / icon / graphical representation of a
> specified node. Is there any way to do it?
>
> Thank you for help, in advance!
>
> Best regards,
> Ben


--
Steve Monnier - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius


Steve Monnier - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Change node icon programmatically [message #1694209 is a reply to message #1694055] Sat, 02 May 2015 07:25 Go to previous messageGo to next message
Benedek Horvath is currently offline Benedek HorvathFriend
Messages: 6
Registered: April 2015
Junior Member
Dear Steve,

Thank you for the advice, but I would like to enable for the users of my editor (created using Sirius) to change the icon only for one node from the specified types.

For example, I have Present Boxes, and I would like to enable that if the user double-clicks on a Present Box, then its icon will change for something else, while the other Present Boxes remain the same as they were before.

Can I do this using Sirius?

Thank you for help.

Best regards,
Ben
Re: Change node icon programmatically [message #1694296 is a reply to message #1694209] Mon, 04 May 2015 08:39 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 500
Registered: July 2009
Location: Nantes, France
Senior Member
Hi Benedek,


Le 02/05/2015 09:25, Benedek Horvath a écrit :
> Dear Steve,
>
> Thank you for the advice, but I would like to enable for the users of my
> editor (created using Sirius) to change the icon only for one node from
> the specified types.

> For example, I have Present Boxes, and I would like to enable that if
> the user double-clicks on a Present Box, then its icon will change for
> something else, while the other Present Boxes remain the same as they
> were before.
>
> Can I do this using Sirius?

When the user double click on a Present Box, does it change something
somewhere in the model ? You could use this change/state in the
expression of the style customization mentionned by Steve to compute the
name of the icon you want to use.

>
> Thank you for help.
>
> Best regards,
> Ben


Regards

--
Maxime - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius


Maxime Porhel - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Change node icon programmatically [message #1694351 is a reply to message #1694296] Mon, 04 May 2015 15:56 Go to previous messageGo to next message
Benedek Horvath is currently offline Benedek HorvathFriend
Messages: 6
Registered: April 2015
Junior Member
Dear Maxime,

Unfortunately they are pretty identical from the model's point of view, it is just a View Model information.

I suppose I should develope a new model, which contains additional View Model information, which neither can be specified in the Sirius, nor in the original model (because it is not a domain information, rather a display information).

Thank you for all of your help.

Best regards,
Benedek
Re: Change node icon programmatically [message #1694423 is a reply to message #1694351] Tue, 05 May 2015 08:59 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 500
Registered: July 2009
Location: Nantes, France
Senior Member
Hi Benedek,

You could also add some additional the aird.

There are several ways to do that:
. types like DDiagram accept some kind of annotations (DAnnotation, AnnotationEntry,..)
. the feature extensions mechanism can also be used to store an additional model in the aird.

You could take a look to the Graal modeler [1]:
. the metamodel of the feature extension is located in [2] and generated in [3]
. 2 classes to define the extension (see the declaration in the plugin.xml): org.obeonetwork.graal.design.extension.GraalFeatureExtension and GraalFeatureExtensionService
. One service class to manipulate/set/get the data: org.obeonetwork.graal.design.services.configuration.UIConfigurationServices , which uses FeatureExtensionsManager.INSTANCE.saveFeatureExtensionData and FeatureExtensionsManager.INSTANCE.retrieveFeatureExtensionData

Regards

--
Maxime - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius

--
[1] https://github.com/ObeoNetwork/InformationSystem/tree/od7.0merge/designs/graal/plugins/org.obeonetwork.graal.design

[2] https://github.com/ObeoNetwork/InformationSystem/tree/od7.0merge/designs/graal/plugins/org.obeonetwork.graal.design/model

[3] https://github.com/ObeoNetwork/InformationSystem/tree/od7.0merge/designs/graal/plugins/org.obeonetwork.graal.design/src-gen/org/obeonetwork/graal/design/graalfeatureextensions
Re: Change node icon programmatically [message #1694684 is a reply to message #1694423] Thu, 07 May 2015 07:21 Go to previous message
Benedek Horvath is currently offline Benedek HorvathFriend
Messages: 6
Registered: April 2015
Junior Member
Dear Maxime,

Thank you for the help, I shall look at the references you recommended.

Regards,
Benedek
Previous Topic:First editor loading : null pointer exception
Next Topic:Montreal Roadshow 2015
Goto Forum:
  


Current Time: Wed Jan 20 04:37:25 GMT 2021

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

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

Back to the top