fluminis
fluminis

Reputation: 4099

Add a custom widget in a CoolBar?

Is it possible in a standalone SWT/JFace application to add a custom widget in a CoolBarManager (a text box for exemple) ?

I look for IContributionItem but I didn't find useful examples.

HelpSearchContributionItem seems to work only with a RCP application (it uses objects from RCP : IWorkbenchWindow for example).

Thanks in advance

Upvotes: 1

Views: 207

Answers (2)

Prakash G. R.
Prakash G. R.

Reputation: 4892

You should subclass ControlContribution and implement createControl() method.

Then add a ToolBarManager/ToolBarManagerContributionItem to the coolbar, and your subclass of ControlContribution to the ToolBarManager.

Upvotes: 4

Matyas
Matyas

Reputation: 13712

Although it is not recommended, you can subclass the ToolItem class and provide your own implementation. To do this you also have to override the checkSubclass method.


public class MyToolItem extends ToolItem {
    @Override
    protected void checkSubClass(){
        // leave it empty
    }
}

Upvotes: 0

Related Questions