Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Enabling and disabling commands / menu items
Enabling and disabling commands / menu items [message #258724] Tue, 06 July 2004 09:01 Go to next message
Eclipse UserFriend
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
Re: Enabling and disabling commands / menu items [message #262231 is a reply to message #258724] Sun, 18 July 2004 10:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: joshweinst.hotmail.com

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
Re: Enabling and disabling commands / menu items [message #262394 is a reply to message #262231] Mon, 19 July 2004 12:05 Go to previous message
Eclipse UserFriend
Originally posted by: s9902178.sms.ed.inf.ac.uk

You can programmatically enable/disable an action by calling
Action.setEnabled();
So perhaps you could get the .run() methods of your actions to reset
each other's enabled state.
hope that helps,
- Dan

Josh Weinstein wrote:
> 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
>
>
>
Previous Topic:how to store preferences to disk
Next Topic:Problem: Content Formatting in custom text editor
Goto Forum:
  


Current Time: Fri May 02 07:57:54 EDT 2025

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

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

Back to the top