Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » IAction vs IViewActionDelegate
IAction vs IViewActionDelegate [message #316780] Mon, 18 June 2007 15:38 Go to next message
Eclipse UserFriend
Originally posted by: ku_long.hotmail.com

Hey,

Some buttons on the toolbar of my view are supposed to be
enabled/disabled by the status of an background thread.
I added the buttons into the toolbar of the view through
implementing the IViewActionDelegate. I know the buttons
can be disabled/enabled through the method setEnabled(boolean)
of an IAction. But in IViewActionDelegate, an IAction instace
can be got when the action occurred. I don't know how to
make a button on the toolbar of the view disabled when the
view is initially displayed?

If I create my action through extending from the Action class,
it is easy to implement this function. But how can I do if I
create those buttons through implementing IViewActionDelegate?

Thanks.
Re: IAction vs IViewActionDelegate [message #316801 is a reply to message #316780] Tue, 19 June 2007 07:07 Go to previous message
Eclipse UserFriend
Raymond wrote:
> Hey,
>
> Some buttons on the toolbar of my view are supposed to be
> enabled/disabled by the status of an background thread. I added the
> buttons into the toolbar of the view through implementing the
> IViewActionDelegate. I know the buttons can be disabled/enabled through
> the method setEnabled(boolean) of an IAction. But in
> IViewActionDelegate, an IAction instace can be got when the action
> occurred. I don't know how to make a button on the toolbar of the view
> disabled when the view is initially displayed?
>
> If I create my action through extending from the Action class,
> it is easy to implement this function. But how can I do if I
> create those buttons through implementing IViewActionDelegate?

The delegates are part of a lazily loaded system. As you found out,
they're not easy to retrieve.

Your best bet is to have each of your IViewActionDelegates register with
your "view/system/background thread" when they are created. Your thread
can then tell the delegate when it is enabled, and then when the
delegate is asked to refresh its enablement (usually with a call to
selectionChanged(*) that passes in the IAction) you can update the
IAction then.

BTW: you will usually get at least 2 instances of each IViewActionDelegate.

Later,
PW
Previous Topic:Hierarchy in Perspective selection dialog
Next Topic:Filelocator and Plugin as jar file
Goto Forum:
  


Current Time: Mon May 12 19:20:06 EDT 2025

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

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

Back to the top