Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Diagram node as image
Diagram node as image [message #235656] Wed, 08 July 2009 14:27 Go to next message
Gary is currently offline GaryFriend
Messages: 125
Registered: July 2009
Senior Member
Hi, does anyone have any ideas how to set a diagram node to display as an
image?

Thanks in advance,
Gary
Re: Diagram node as image [message #235707 is a reply to message #235656] Thu, 09 July 2009 09:38 Go to previous messageGo to next message
Daniel is currently offline DanielFriend
Messages: 19
Registered: July 2009
Junior Member
Hi

I use a custom figure.

In your Figure Gallery > Figure Descriptor > Rectangle > Custom Figure

In the properties of the Custom Figure:
Name: as your want
Qualified Class Name:
org.eclipse.gmf.runtime.draw2d.ui.render.figures.ScalableIma geFigure

Then generate etc.

Now you'll see some error on the files XXXPart.java

look for the method CreateContents()

and put something like this

URL url = this.getClass().getResource("");
ScalableImageFigure name_your_put = new
ScalableImageFigure(RenderedImageFactory.getInstance(url),tr ue,true,true);

this.add(name_your_put);


Try this
Re: Diagram node as image [message #235761 is a reply to message #235707] Thu, 09 July 2009 11:15 Go to previous messageGo to next message
Gary is currently offline GaryFriend
Messages: 125
Registered: July 2009
Senior Member
Thanks for your reply!

Just wondering, do you know of a way to do this before code generation?
The model I am working with is still undergoing change, so I currently
have to change my model and regenerate the code on a weekly basis, because
of this don't want to be editing the code after generation if I can avoid
it.

I'm rather supprised that GMF doesn't allow you to select an image (in the
place of a shape) for a node, I would have thought many people would want
this sort of functionality!

Thanks in advance,
Gary
Re: Diagram node as image [message #235768 is a reply to message #235761] Thu, 09 July 2009 11:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: aurelien.pupier.esial.net

Hi Gary,

comments below.


Gary a écrit :
> Thanks for your reply!
>
> Just wondering, do you know of a way to do this before code generation?
> The model I am working with is still undergoing change, so I currently
> have to change my model and regenerate the code on a weekly basis,
> because of this don't want to be editing the code after generation if I
> can avoid it.
>
You can set @generated NOT flag to the modified function or modified the template used for generation.


> I'm rather supprised that GMF doesn't allow you to select an image (in
> the place of a shape) for a node, I would have thought many people would
> want this sort of functionality!

You can open a bug to ask for this enhancement.


>
> Thanks in advance,
> Gary
>
Re: Diagram node as image [message #235809 is a reply to message #235707] Thu, 09 July 2009 13:33 Go to previous messageGo to next message
Gary is currently offline GaryFriend
Messages: 125
Registered: July 2009
Senior Member
Hi, a quick question!

-in the code you suggested, do i put the image url as shown below?
URL url = this.getClass().getResource(" --my image url-- ");

also what does 'RenderedImageFactory' reference in the lines below?

ScalableImageFigure nodeFig0 = new
ScalableImageFigure(RenderedImageFactory.getInstance(url),tr ue,true,true);
Re: Diagram node as image [message #236139 is a reply to message #235707] Tue, 14 July 2009 11:43 Go to previous message
Gary is currently offline GaryFriend
Messages: 125
Registered: July 2009
Senior Member
using eclipse ganymede, cannot import
org.eclipse.gmf.runtime.draw2d.ui.render.renderedImageFactor y;
for use with the previously mentioned suggestion for replacing my nodes
with images.

Does anyone know of a solution?
thanks in advance,
Gary
Previous Topic:Drag parent by dragging child
Next Topic:Confirm delete shape
Goto Forum:
  


Current Time: Fri Mar 29 15:59:37 GMT 2024

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

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

Back to the top