Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Showing an image in a diagram
Showing an image in a diagram [message #1837846] Mon, 08 February 2021 15:05 Go to next message
Giray Ozel is currently offline Giray OzelFriend
Messages: 18
Registered: February 2018
Junior Member
I want an image to appear in the diagram when a node is selected. I did some digging but couldn't find how to do this so I'm moving towards adding a new type to the meta-model just so I can make a node representing that type in my diagram and showing/hiding it on double-clicking another type of node.


  1. Is there a better solution overall?
  2. Is it possible to do this without a semantic element? Something like a decoration?
  3. Is it easy to hook an event on node selection instead of double click edit tool?

Re: Showing an image in a diagram [message #1837872 is a reply to message #1837846] Tue, 09 February 2021 10:33 Go to previous messageGo to next message
Laurent Redor is currently offline Laurent RedorFriend
Messages: 300
Registered: July 2009
Senior Member
Hi Giray,
What is the goal of this image (to better understand what you need)?

For question 1 and 2: Instead of adding a new type in the meta-model. You can use an unsyncrhonized border node (with "aql:self" as "semantic candidates expression"). See documentation for details about "Synchronization". And then you can "create"/"delete" this border node with a double-click tool (like you already done with your "specific semantic element").

For question 3: No, there is no simple way to do that. You can maybe have a look on org.eclipse.gef.handles.AbstractHandle. There is for example, org.eclipse.gmf.runtime.diagram.ui.handles.CompartmentCollapseHandle, that adds a "+" or "-" on collapsible compartment when compartment is selected.
index.php/fa/39971/0/
But there is no "tool" or helper in Sirius to do that...

Regards,

Laurent


Laurent Redor - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Showing an image in a diagram [message #1837916 is a reply to message #1837872] Wed, 10 February 2021 13:34 Go to previous messageGo to next message
Giray Ozel is currently offline Giray OzelFriend
Messages: 18
Registered: February 2018
Junior Member
Hi Laurent,

The image I want to show will act as a placeholder for future meta-model extensions. The user should be able to see some details of the related instance of the extended type but for now the meta-model is not going to be extended, so I would like to have a placeholder image.

The bordered node solution is interesting. With the new type in the meta-model I was hiding/revealing the node. But with the bordered node I need to trigger the creation of the node itself and not reveal/hide it. Do you have an example of how to programmatically create a bordered node? Also, how to see if it is already there in case I want to delete it on another double click.

Thanks!
Re: Showing an image in a diagram [message #1837959 is a reply to message #1837872] Thu, 11 February 2021 11:18 Go to previous messageGo to next message
Giray Ozel is currently offline Giray OzelFriend
Messages: 18
Registered: February 2018
Junior Member
Your bordered node suggestion gave me an idea of creating a new node with a workspace image in the diagram representation, representing the same type as the diagram. It works nicely as a workaround and placeholder.

Is it possible to change the image of a node at runtime?
Re: Showing an image in a diagram [message #1838002 is a reply to message #1837916] Fri, 12 February 2021 16:39 Go to previous message
Laurent Redor is currently offline Laurent RedorFriend
Messages: 300
Registered: July 2009
Senior Member
Hi,
You can create a border node with "Create View" operation and delete it with a "Delete View" operation. You have an example in "SampleWithBorderNodeOnDoubleClick.zip".

Unfortunatelly, there is nothing to have a dynamic image for a border node.

There is this kind of feature with the decorator (with the "Image expression" property). But the decorator is not really expected to react at double click...

Regards,

Laurent


Laurent Redor - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:How to handle XInclude in existing model instances ?
Next Topic:Xtext integration with Sirius
Goto Forum:
  


Current Time: Fri Apr 19 21:53:18 GMT 2024

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

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

Back to the top