Changing Palette Icons programmatically [message #658462] |
Tue, 08 March 2011 10:40  |
Eclipse User |
|
|
|
Hi,
I want to use two different styles of icons in my gmf palette. So I need to change the icon of a tool during runtime depending on the user settings (preference page). Is there a way to do this?
Thanks in advance
|
|
|
|
|
|
Re: Changing Palette Icons programmatically [message #661213 is a reply to message #661098] |
Wed, 23 March 2011 11:14   |
Eclipse User |
|
|
|
inlined....
On 23-03-11 00:39, Dave wrote:
> Thanks for the hint.
> I managed to find the related source code but unfortunatly I don't know
> how to change it, since my code is generated with GMF and is regenerated
> regulary. So I thought I can use an extension somewhere to override the
> existing code but that wasn't successful either. Do you have an idea how
> to change the generated code for a palette entries?
>
I am not sure why you want to override the palettefactory. What you
really want (At least, if I understand from the original post), is to
subscribe to preference changes, and then reload the palette right? So
from the palette factory, you simply re-use the parts which make sense
like this:
I found this comment in the EditingDomain.setPaletteRoot(..)
/**
* Sets the PalatteRoot for this EditDomain. If the EditDomain already
knows
* about a PaletteViewer, this root will be set into the palette viewer
* also. Loads the default Tool after the root has been set.
* <p>
* It is recommended that the palette root not be set multiple times. Some
* components (such as the PaletteCustomizerDialog for the PaletteViewer)
* might still hold on to the old root. If the input has changed or
needs to
* be refreshed, just remove all the children from the root and add the new
* ones.
*
* @param root
* the palette's root
*/
so, obviously not a good idea to reset the root.
You would need to play (Add/remove) with this:
this.getEditDomain().getPaletteViewer().getPaletteRoot().get Children()
Please let us know the result!
>
> Thank you very much indeed!
>
>
> Cheers
> Dave
|
|
|
|
|
Re: Changing Palette Icons programmatically [message #665857 is a reply to message #661277] |
Sun, 17 April 2011 05:56  |
Eclipse User |
|
|
|
Hi,
sorry for the continued delay in my message.
I was playing around with PaletteViewer and PaletteRoot and it seems the palette is refreshed but eclipse is using cached images. So there is no visible change. Can you confirm this?
Since I need to refresh the my editor edit part images as well I thought I can write a global class for doing that. When I close my editor and restart it again, I see the changed images in both palette and editor. Any ideas on how to accomplish that in a simple class programmatically?
Thank you very much indeed
Dave
|
|
|
Powered by
FUDForum. Page generated in 0.05322 seconds