Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Changing a toolbar icon from within an IViewActionDelegate
Changing a toolbar icon from within an IViewActionDelegate [message #326440] Wed, 19 March 2008 19:08 Go to next message
John J. Barton is currently offline John J. BartonFriend
Messages: 311
Registered: July 2009
Senior Member
I added an 'action' via extension point org.eclipse.ui.viewActions. The
button appears, but I need to alter its appearance when it is pushed.
When the button is pushed I get control in my IViewActionDelegate, but
how to find the button? If this was XUL or HTML I would do something
like document.getElementById(<action-id>): is there something similar
for eclipse? Another way to get the button widget?

I know I can copy an paste a Action implementation from LinkEditorAction
in org.eclipse.ui.navigator, but I'd like to have a more compact
implementation.

Thanks,
John.
Re: Changing a toolbar icon from within an IViewActionDelegate [message #326496 is a reply to message #326440] Thu, 20 March 2008 21:07 Go to previous message
John J. Barton is currently offline John J. BartonFriend
Messages: 311
Registered: July 2009
Senior Member
John J Barton wrote:
> I added an 'action' via extension point org.eclipse.ui.viewActions. The
> button appears, but I need to alter its appearance when it is pushed.
> When the button is pushed I get control in my IViewActionDelegate, but
> how to find the button? If this was XUL or HTML I would do something
> like document.getElementById(<action-id>): is there something similar
> for eclipse? Another way to get the button widget?
>
> I know I can copy an paste a Action implementation from LinkEditorAction
> in org.eclipse.ui.navigator, but I'd like to have a more compact
> implementation.

1) Set the style of the 'action' in the markup to "toggle"

2) record the view passed to your IViewActionDelegate in init()
(eg this.view = view).

3) extract the action from the view:
public IAction getAction() {
IViewSite site = (IViewSite) this.view.getSite();
IContributionItem item =
site.getActionBars().getToolBarManager().find("com.ibm.research.Fireclipse.LinkFirebugAction ");
return ((ActionContributionItem) item).getAction();
}

4) change the action when the state changes:
getAction().setChecked(newValue);
Previous Topic:Integration with CVS - please help
Next Topic:Unit Testing
Goto Forum:
  


Current Time: Thu Nov 14 07:58:49 GMT 2024

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

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

Back to the top