Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Change label icon when a change a property
Change label icon when a change a property [message #153692] Fri, 05 October 2007 07:08 Go to next message
Eclipse UserFriend
Originally posted by: ijerez2001.gmail.com

Hello,
I want to change a icon when a property from a element change in the
property sheet.
is it possible?
Thanks
Re: Change label icon when a change a property [message #153767 is a reply to message #153692] Fri, 05 October 2007 07:42 Go to previous messageGo to next message
Eclipse UserFriend
Hi Iván,

Override handleNotificationEvent(Notification) method in your edit part
to refresh visual properties in response to changes.

Best regards,
Boris


Iván Jerez wrote:
> Hello,
> I want to change a icon when a property from a element change in the
> property sheet.
> is it possible?
> Thanks
Re: Change label icon when a change a property [message #153851 is a reply to message #153767] Fri, 05 October 2007 11:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ijerez2001.gmail.com

I try it but i don´t get it.
I have a rectangle figure that contain a Label with icon. The element for
the Figure have 2 attribute, name and type. The name is contain in the
Label.
When I change the type I want to change the label icon.
So, I try that you said, in the VariableEditPart i access to the wraplabel
and I try to set icon with setIcon method but it´s not work. My code is the
following:

Image icono = new
Image(getPrimaryShape().fFigureVariableNameFigure.getIcon(). getDevice(), "icons/obj16/Propiedad.gif");
getPrimaryShape().fFigureVariableNombreFigure.setIcon(icono) ;

I think that it´s incorrect because the path is not good, I want to do
reference to the image in the diagram project /icons/obj16/Propiedad.gif.

I need help.
Thanks.

"Boris Blajer" <boris.blajer@borland.com> escribió en el mensaje de
noticias:fe57v0$7sa$1@build.eclipse.org...
> Hi Iván,
>
> Override handleNotificationEvent(Notification) method in your edit part to
> refresh visual properties in response to changes.
>
> Best regards,
> Boris
>
>
> Iván Jerez wrote:
>> Hello,
>> I want to change a icon when a property from a element change in the
>> property sheet.
>> is it possible?
>> Thanks
Re: Change label icon when a change a property [message #154318 is a reply to message #153851] Tue, 09 October 2007 06:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ijerez2001.gmail.com

I solve this problem.
If someone want to know how it work ask in this post.


"Iván Jerez" <ijerez2001@gmail.com> escribió en el mensaje de
noticias:fe5lkb$olj$1@build.eclipse.org...
>I try it but i don´t get it.
> I have a rectangle figure that contain a Label with icon. The element for
> the Figure have 2 attribute, name and type. The name is contain in the
> Label.
> When I change the type I want to change the label icon.
> So, I try that you said, in the VariableEditPart i access to the wraplabel
> and I try to set icon with setIcon method but it´s not work. My code is
> the following:
>
> Image icono = new
> Image(getPrimaryShape().fFigureVariableNameFigure.getIcon(). getDevice(), "icons/obj16/Propiedad.gif");
> getPrimaryShape().fFigureVariableNombreFigure.setIcon(icono) ;
>
> I think that it´s incorrect because the path is not good, I want to do
> reference to the image in the diagram project /icons/obj16/Propiedad.gif.
>
> I need help.
> Thanks.
>
> "Boris Blajer" <boris.blajer@borland.com> escribió en el mensaje de
> noticias:fe57v0$7sa$1@build.eclipse.org...
>> Hi Iván,
>>
>> Override handleNotificationEvent(Notification) method in your edit part
>> to refresh visual properties in response to changes.
>>
>> Best regards,
>> Boris
>>
>>
>> Iván Jerez wrote:
>>> Hello,
>>> I want to change a icon when a property from a element change in the
>>> property sheet.
>>> is it possible?
>>> Thanks
>
Re: Change label icon when a change a property [message #154326 is a reply to message #154318] Tue, 09 October 2007 06:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: snej_NO-SPAM_.esuark.de

Iván Jerez schrieb:
> I solve this problem.
> If someone want to know how it work ask in this post.

How did you solve it?

regards
jens
Re: Change label icon when a change a property [message #154341 is a reply to message #154326] Tue, 09 October 2007 08:13 Go to previous message
Eclipse UserFriend
Originally posted by: ijerez2001.gmail.com

In the EditPart than you want to do this, you have to override the method
handleNotificationEvent

/**
* @generated NOT
* @param notification : the notification event
*/
protected final void handleNotificationEvent(final Notification
notification) {
Object notifier = notification.getNotifier();
if (notification.getEventType() == Notification.SET
&& notifier instanceof <<YOURNODE>>
&& <<another logic to capture this event, for example the
attribute type with the feature of the notification>>) {

if (<<sentences depend of the value of attribute>>){
IAdaptable variableViewAdapter =
(IAdaptable) <<the element type that contain the icon>> ;// for example
MindMapElementType.Topic_2003;
Image image = <<class element type>>.getImage(variableViewAdapter); //for
example, MindMapElementType.getImage(variableViewAdapter);
getPrimaryShape().fFigureVariableNombreFigure.setIcon(imagen ); // access
to the figure label for this shape and change his icon.
}else if(<<another>>){
.......... // the same that the above if, but
change the variableViewAdapte to obtain another icon.
}
}
super.handleNotificationEvent(notification);
}

Regards


"Jens Krause" <snej_NO-SPAM_@esuark.de> escribió en el mensaje de
noticias:fefmj2$gom$1@build.eclipse.org...
> Iván Jerez schrieb:
>> I solve this problem.
>> If someone want to know how it work ask in this post.
>
> How did you solve it?
>
> regards
> jens
Previous Topic:tool available in toolbar but can't be placed on the canvas
Next Topic:Dialog from action
Goto Forum:
  


Current Time: Fri May 09 13:48:12 EDT 2025

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

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

Back to the top