Monday, October 08, 2007

Contributing to the Eclipse Cool Bar

To add stuff to the eclipse cool bar , u need to
1) implement the extension point org.eclipse.ui.editor .
2) Specify a contributorClass for the above mentioned extension point.

This contributor class will provide actions that would be contributed to the
coolbar.
Lets call this calls MyContributorClass.

3) Have this class extend BaseEditorContributor , It should override contributeToParentCoolbar .

4) In the given method create a ContributionItem that would be contributed to the coolbar.

Lets call this myContributionItem.

5) Use the parentCoolBarManager to add create a ToolBarManager.

IToolBarManager toolbar = new ToolBarManager(parentCoolBarManager.getStyle())

6) Add myContributionItem to toolbar.

toolbar.add(myContributionItem);

7) Create a ToolBarContributionItem and add it to the parent cool bar.

ToolBarContributionItem toolBarItem = new ToolBarContributionItem(toolbar,myContributionItem.getId())

parentCoolBarManager.add(toolBarItem);

and finally

coolBarItems.add(toolBarItem);

parentCoolBarManager and coolBarItem are protected members and are available from the base class .

1 comment:

axemclion said...

hey, parashuram here...could not find any other way to contact you....sure i like the idea of colloborative painting !!! [:)]