Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Toolbar icon starting in disabled state
Toolbar icon starting in disabled state [message #314085] Tue, 03 April 2007 03:32 Go to next message
Eclipse UserFriend
Hi All,

I have an "actionSets" plug-in (very simple, based on the HelloWorld
template).
I use "selectionChanged" and "ResourceChangeListener" during the life of
the plug-in to handle the enabled state of his toolbar icon. This is fine.
But, I would like his toolbar icon start in disabled (grey) state when
Eclipse is launched.

In my Action class,
the action() constructor
the init() method
the run() method
the selectionChanged() method
etc...
are all called too late (on a mouse click, after the icon is drawn on the
toolbar).

Is there a way to send a setEnable(false) to my icon before the icon is
drawn by eclipse (or just after :-) ?
--
Philippe
Re: Toolbar icon starting in disabled state [message #314091 is a reply to message #314085] Tue, 03 April 2007 06:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Philippe,

Eclipse intentionally waits as long as possible to activate your plugin
since having all plugins that contribute toolbar icons activate during
startup would kill startup performance. So you should feel strongly
discouraged from trying to change this behavior.


Philippe wrote:
> Hi All,
>
> I have an "actionSets" plug-in (very simple, based on the HelloWorld
> template).
> I use "selectionChanged" and "ResourceChangeListener" during the life
> of the plug-in to handle the enabled state of his toolbar icon. This
> is fine.
> But, I would like his toolbar icon start in disabled (grey) state when
> Eclipse is launched.
>
> In my Action class,
> the action() constructor
> the init() method
> the run() method
> the selectionChanged() method
> etc...
> are all called too late (on a mouse click, after the icon is drawn on
> the toolbar).
>
> Is there a way to send a setEnable(false) to my icon before the icon
> is drawn by eclipse (or just after :-) ?
Re: Toolbar icon starting in disabled state [message #314107 is a reply to message #314091] Tue, 03 April 2007 11:37 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Ed,

You're right, of course, I agree with the Eclipse behavior.
I thought of a field in the xml definition.
As for the "state" flag which functions for "toggle" buttons.

Maybe there is a better approach:

The main task of my plugin is to manage a CDT project.
My wanted behavior is: No project = No icon or Disabled icon.
Maybe it's possible to create the actionSet after the CDT project is
created.
I mean: If I don't use actionSet xml extension, Eclipse don't create my
toolbar. Then, when a project is created (instantiating my CDT plugin), I
create the toolbar with my icon...

Would this be correct?
Is there a sample source code to do that?
--
Philippe

Ed Merks wrote:

> Philippe,

> Eclipse intentionally waits as long as possible to activate your plugin
> since having all plugins that contribute toolbar icons activate during
> startup would kill startup performance. So you should feel strongly
> discouraged from trying to change this behavior.
Re: Toolbar icon starting in disabled state [message #314108 is a reply to message #314107] Tue, 03 April 2007 11:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Philippe,

This does sound better. Sorry, I don't really know how to do that
though. Maybe someone else will have a good suggestion.

Isn't it also okay just to be enabled and when the user clicks on it, it
will suddenly become disabled if that's the state it should actually be
in? That would be the "standard Eclipse way", I think...


Philippe wrote:
> Thanks Ed,
>
> You're right, of course, I agree with the Eclipse behavior.
> I thought of a field in the xml definition.
> As for the "state" flag which functions for "toggle" buttons.
> Maybe there is a better approach:
>
> The main task of my plugin is to manage a CDT project.
> My wanted behavior is: No project = No icon or Disabled icon.
> Maybe it's possible to create the actionSet after the CDT project is
> created.
> I mean: If I don't use actionSet xml extension, Eclipse don't create
> my toolbar. Then, when a project is created (instantiating my CDT
> plugin), I create the toolbar with my icon...
>
> Would this be correct?
> Is there a sample source code to do that?
Re: Toolbar icon starting in disabled state [message #314142 is a reply to message #314108] Wed, 04 April 2007 02:57 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Ed,

This is exactly what I do, while waiting better :-).

Ed Merks wrote:

> Isn't it also okay just to be enabled and when the user clicks on it, it
> will suddenly become disabled if that's the state it should actually be
> in?
Re: Toolbar icon starting in disabled state [message #314774 is a reply to message #314142] Mon, 23 April 2007 12:16 Go to previous message
Eclipse UserFriend
Originally posted by: eddie.streambase.com

Philippe wrote:
> Thanks Ed,
>
> This is exactly what I do, while waiting better :-).
>
> Ed Merks wrote:
>
>> Isn't it also okay just to be enabled and when the user clicks on it,
>> it will suddenly become disabled if that's the state it should
>> actually be in?
>
>


What I did, a variation may work for you:

I set enablesFor to + and the enablement to not(objectClass,
java.lang.Object)

I still think eclipse should have a way to say "starts disabled"
succintly.

- Eddie
Previous Topic:"Clean..." does always build workspace ?
Next Topic:Public API to deal with writing in plug-in.xml file ?
Goto Forum:
  


Current Time: Wed Jun 18 15:42:11 EDT 2025

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

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

Back to the top