Skip to main content



      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 15:08 Go to next message
Eclipse UserFriend
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 17:07 Go to previous message
Eclipse UserFriend
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: Wed Mar 12 00:37:04 EDT 2025

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

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

Back to the top