Bug 109565

Summary: [RCP] [Workbench] Enable WorkbenchWindow configuring the display position of Coolbar button's label
Product: [Eclipse Project] Platform Reporter: Feng Dihai <fengdh>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P5 CC: bokowski, ioana.negru
Version: 3.1Keywords: helpwanted
Target Milestone: ---   
Hardware: All   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Sample Image none

Description Feng Dihai CLA 2005-09-15 02:28:32 EDT
ActionContributionItem#setMode(MODE_FORCE_TEXT) can enable Coolbar rendering a 
label under toolbar button's icon. For a RCP application, it is an important 
feature targeting non-expert users. In our project, we want to place the label 
just beside icon horizontally to save main display area, just like what 
Eclipse's PerspectiveSwitcher or IE can do.

By hacking WorkbenchWindow class like below, we can really change toolbar 
label's position. 

    public WorkbenchWindow(int number) {
        super(null);
        ... ...
        // Add contribution managers that are exposed to other plugins.
        addMenuBar();
        addCoolBar(SWT.FLAT);      // ==> addCoolBar(SWT.FLAT | SWT.RIGHT)
        addStatusLine();
        ... ...

But the problem is:

1. Hacking an internal class is a not good practice when considering 
platform's future upgrades. 

2. A better way maybe use an interface simillar to IWorkbenchWindowConfigure 
to provid a chance of configuration.

3. User maybe want to customize the way where to show toolbar button's label 
or just hide it off. Dynamic configuration is expected for platform's UI 
component.

4. Sometime when I tried to enable label showing and disable it later, text 
disappeard but some ugly space still left.


(I have an image file to describe the problem, but not knowing how to upload 
it).
Comment 1 Feng Dihai CLA 2005-09-15 02:31:53 EDT
Created attachment 27151 [details]
Sample Image
Comment 2 Tod Creasey CLA 2007-06-14 16:36:23 EDT
There are currently no plans to do this but we would be happy to look at a patch
Comment 3 Feng Dihai CLA 2007-06-14 20:27:54 EDT
According to Eclipse 3.2 or above, there is a new internal IToolBarManager2 interface which can be used to change caption position of Coolbar button. But I have to reference to some internal implementations to create my new PresentationFactory (also see Bug#169106 to get more information):

import org.eclipse.jface.internal.provisional.action.IToolBarManager2;
import org.eclipse.jface.internal.provisional.action.ToolBarManager2;
import org.eclipse.ui.internal.provisional.presentations.IActionBarPresentationFactory;
import org.eclipse.ui.presentations.WorkbenchPresentationFactory;
...
public class MyPresentationFactory 
                    extends WorkbenchPresentationFactory
                    implements IActionBarPresentationFactory {
    ...
    
    final public IToolBarManager2 createToolBarManager() {
        return new ToolBarManager2(SWT.FLAT | SWT.BOTTOM);
    }

}


(In reply to comment #2)
> There are currently no plans to do this but we would be happy to look at a
> patch
> 
Comment 4 Boris Bokowski CLA 2009-11-26 16:14:58 EST
Prakash is now responsible for watching bugs in the [RCP] component area.