views:

343

answers:

3

I am working on an Eclipse RCP-based application, and we have decided that we do not want any of the menu items to display icons next to the text. The problem we are seeing is that the standard actions like Undo, Redo, Cut, Copy, Paste, and so on all display the default icons for the corresponding actions.

Is there any way to tell the action management infrastructure to ignore the icons? My brute force solution to this was to rebuild the SWT so that MenuItem.setImage() was a no-op, and then include our own copy of the SWT in the final product, but it seems like there should be a lighter-weight solution.

A: 

I believe you want to further examine going into the manifest and looking into org.eclipse.ui.views and seeing if there is anything in there for removing icons

PSU_Kardi
A: 

What is the reason for not including icons? A lot of effort went into creating a standard interface, what would be the benefit of deviating from the standard? Do you think their omission increases usability?

Having said all that you could try contributing a fragment with some AspectJ around advice to intercept calls to setImage() and veto them.

Rich Seller
We want an application that doesn't look like the Eclipse workbench. RCP does not define what a 'standard interface' looks like, and the icons appear nowhere else in the UI, so if anything they add confusion by being there.
Scott K.
+1  A: 

This turned out to be easier than I had hoped.

Create a subclass of org.eclipse.ui.application.ActionBarAdvisor. Override the method register like this:

protected void register(IAction action) {
    super.register(action);
    action.setImageDescriptor(null);
}

Then, create a subclass of org.eclipse.ui.application.WorkbenchWindowAdvisor that overrides createActionBarAdvisor:

public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) {
    return new MyActionBarAdvisor(configurer);
}

That's it. All actions will no longer have icons.

Scott K.