[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform] Re: Enabling and disabling commands / menu items

I am having the same problem! I have a Play, Pause and Stop button in the
toolbar. If the user clicks STOP, i want to disable the button until the
PLAY button is clicked. I have been looking for a way to do this but I
have thus far been unsuccessful. There are several things in plugins.xml
(like enablesfor and the objectState stuff) that are somewhat similar to
what I need, but not exactly. 

Any help would be greatly appreciated!!

Thanks,
JW


Robbie Jameson wrote:

> Hello,

> I've been discovering the complexity of what Eclipse has to offer in the way
> of handling actionsets, commands, activites, contexts, contributions, etc,
> but I've got the feeling that something still seems to be missing.

> I would like to define some actions in plugin.xml for a stand-alone
> application. I would like most of them to be disabled (i.e. grayed, not
> invisible) at the start of the application until an event occurs (e.g. a new
> session is opened), and at will to disable them again (e.g. when the session
> gets closed). I am mainly thinking in terms of menu items.

> This seems to me to be quite reasonable. It is true that I could define some
> activities, and only make them visible when the conditions were right, but
> then the program would look excessively bare if there were only a very few
> visible menu items at start-up. I would rather the user be able to play
> around a bit and get a glimpse of all the exciting things he will be able to
> do later.

> The  javadoc says of ICommandManager:

> "An instance of ICommandManager can be used to obtain instances of ICommand,
> as well as manage whether or not those instances are active or inactive,
> enabled or disabled. "

> This sounds like a good start, even though I would prefer to define a group
> of actions or commands in plugin.xml and disable or enable that in one go at
> run-time, but I can't find anything about how to actually use
> ICommandManager for managing "whether or not those instances are active or
> inactive, enabled or disabled". It looks as though it isn't fully
> implemented.

> I just can't figure out how to use what I've put in plugin.xml intelligently
> and not have to program a lot of stuff by hand to obtain the desired
> behaviour. A lot of things look as though they're made for doing it, but
> none has actually turned out to be a complete solution. A look at the bug
> reports seems to suggest that some discussions are still going on, but I
> really feel as though the solution exists right now and is out there for who
> knows how!

> Thanks in advance for any advice,

> Robbie Jameson