Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF decorators
EMF decorators [message #893525] Wed, 04 July 2012 13:00 Go to next message
becks m is currently offline becks mFriend
Messages: 59
Registered: June 2012
Member
HI,

How can I use decorators such as overlayicon image in emf.

[Updated on: Wed, 04 July 2012 13:00]

Report message to a moderator

Re: EMF decorators [message #893531 is a reply to message #893525] Wed, 04 July 2012 13:08 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
Have a look at ETypedElementItemProvider.getComposedImage.

On 04/07/2012 3:00 PM, becks m wrote:
> HI,
>
> How can I use decorators such as overlayicon image in eclipse emf.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF decorators [message #893540 is a reply to message #893531] Wed, 04 July 2012 13:44 Go to previous messageGo to next message
becks m is currently offline becks mFriend
Messages: 59
Registered: June 2012
Member
Ed,
Where to use it ?
I've looked at it but I don't know where exactly should I use this method.


I've the generated item provider adapters for all classes ( edit plugin)

should I use this in getImage method ? also, this class ETypedElementItemProvider where to extend it or what to change in the current generated model.


all I wanted to add flag icon on an existing icon upon if condition.
Re: EMF decorators [message #893570 is a reply to message #893540] Wed, 04 July 2012 15:35 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
Comments below.

On 04/07/2012 3:44 PM, becks m wrote:
> Ed,
> Where to use it ?
I pointed to it as an example of how to use ComposedImage.
> I've looked at it but I don't know where exactly should I use this
> method.
You don't use it, you look at how it works.
>
>
> I've the generated item provider adapters for all classes ( edit plugin)
>
> should I use this in getImage method ?
You'll want to specialize your getImage method to use ComposedImage.
> also, this class ETypedElementItemProvider where to extend it or what
> to change in the current generated model.
>
>
> all I wanted to add flag icon on an existing icon upon if condition.
Much like we want to add multiplicity decorations to a basic image...


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF decorators [message #893571 is a reply to message #893570] Wed, 04 July 2012 15:48 Go to previous messageGo to next message
becks m is currently offline becks mFriend
Messages: 59
Registered: June 2012
Member
Ed Merks wrote on Wed, 04 July 2012 11:35
Comments below.

On 04/07/2012 3:44 PM, becks m wrote:
> Ed,
> Where to use it ?
I pointed to it as an example of how to use ComposedImage.
> I've looked at it but I don't know where exactly should I use this
> method.
You don't use it, you look at how it works.
>
>
> I've the generated item provider adapters for all classes ( edit plugin)
>
> should I use this in getImage method ?
You'll want to specialize your getImage method to use ComposedImage.
> also, this class ETypedElementItemProvider where to extend it or what
> to change in the current generated model.
>
>
> all I wanted to add flag icon on an existing icon upon if condition.
Much like we want to add multiplicity decorations to a basic image...



Great, I went through it, and I reached something , wanted to share it with you.

In the edit plugin I override the method overlayImage which is used in each getImage method.

and used it easily by setting the image in it with the one i wanted to add on the original image. so, task was done there.

 protected Object overlayImage(Object object, Object image)
	  {
	  
	      List<Object> images = new ArrayList<Object>(2);
	      images.add(image);
	      images.add(getResourceLocator().getImage("full/obj16/requiredImagetoBeAddedOnOriginal"));
	      image = new ComposedImage(images);
	    
	    return image;
	  }


Thanks Ed.

[Updated on: Wed, 04 July 2012 15:50]

Report message to a moderator

Re: EMF decorators [message #893578 is a reply to message #893571] Wed, 04 July 2012 16:42 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
That method is intended to adding the "controlled object" overlay so
reusing it for something else will disable it for that purpose. As you
can see, that method too simply uses ComposedImage so you could add your
own utility method just like that...


On 04/07/2012 5:48 PM, becks m wrote:
> Ed Merks wrote on Wed, 04 July 2012 11:35
>> Comments below.
>>
>> On 04/07/2012 3:44 PM, becks m wrote:
>> > Ed,
>> > Where to use it ?
>> I pointed to it as an example of how to use ComposedImage.
>> > I've looked at it but I don't know where exactly should I use this
>> > method.
>> You don't use it, you look at how it works.
>> >
>> >
>> > I've the generated item provider adapters for all classes ( edit
>> plugin)
>> >
>> > should I use this in getImage method ?
>> You'll want to specialize your getImage method to use ComposedImage.
>> > also, this class ETypedElementItemProvider where to extend it or
>> what > to change in the current generated model.
>> >
>> >
>> > all I wanted to add flag icon on an existing icon upon if condition.
>> Much like we want to add multiplicity decorations to a basic image...
>
>
>
> Great, I went through it, and I reached to something, wanted to share
> it with you.
>
> In the edit plugin I override the method overlayImage which is used in
> each getImage method.
>
> and used it easily by setting the image in it with the one i wanted to
> add on the original image. so, task was done there.
>
> Thanks Ed.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF decorators [message #893649 is a reply to message #893578] Thu, 05 July 2012 06:41 Go to previous message
becks m is currently offline becks mFriend
Messages: 59
Registered: June 2012
Member
Yes I disabled its default action for a certain class which I wanted to add decoration for. as I don't need to track the controlled object thing in my program.
but it still affects the rest of classes.

this was very helpful.

Thanks!

Ed Merks wrote on Wed, 04 July 2012 12:42
That method is intended to adding the "controlled object" overlay so
reusing it for something else will disable it for that purpose. As you
can see, that method too simply uses ComposedImage so you could add your
own utility method just like that...


On 04/07/2012 5:48 PM, becks m wrote:
> Ed Merks wrote on Wed, 04 July 2012 11:35
>> Comments below.
>>
>> On 04/07/2012 3:44 PM, becks m wrote:
>> > Ed,
>> > Where to use it ?
>> I pointed to it as an example of how to use ComposedImage.
>> > I've looked at it but I don't know where exactly should I use this
>> > method.
>> You don't use it, you look at how it works.
>> >
>> >
>> > I've the generated item provider adapters for all classes ( edit
>> plugin)
>> >
>> > should I use this in getImage method ?
>> You'll want to specialize your getImage method to use ComposedImage.
>> > also, this class ETypedElementItemProvider where to extend it or
>> what > to change in the current generated model.
>> >
>> >
>> > all I wanted to add flag icon on an existing icon upon if condition.
>> Much like we want to add multiplicity decorations to a basic image...
>
>
>
> Great, I went through it, and I reached to something, wanted to share
> it with you.
>
> In the edit plugin I override the method overlayImage which is used in
> each getImage method.
>
> and used it easily by setting the image in it with the one i wanted to
> add on the original image. so, task was done there.
>
> Thanks Ed.

[Updated on: Thu, 05 July 2012 06:49]

Report message to a moderator

Previous Topic:Xcore Validation
Next Topic:[CDO] Migration
Goto Forum:
  


Current Time: Thu Apr 18 07:48:02 GMT 2024

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

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

Back to the top