Search code examples
viewtabseclipse-rcpunderline

Eclipse RCP view tabs text underlined


I am developing the Eclipse RCP application and have added

org.eclipse.ui/SHOW_TRADITIONAL_STYLE_TABS=false

to the plugin_customization.ini file. This gives me nice style to the view and editor tabs.

However, there is a strange problem occurring only the first time users start the application. The text in the first view tab is underlined, as you can see in the picture:

Picture @ ImageShack

As soon as I switch to different view the underline is not visible any more, not even with the focused tab. But I have also noticed that even when the underline is initially gone, clicking on the tab and holding the mouse button for several seconds will return the underline.

These three views are placed in the folder, with the simple

IFolderLayout.addView(String viewId)

and folder is created with

IPageLayout.createFolder(String folderId, int relationship, float ratio, String refId)

Any help on why the underline is there at the first place or how to remove it would be great. Thanks in advance.


Solution

  • To remove the underline in your view title you have to do the following:

    1. Implement IWorkbenchPart#setFocus() in your view
    2. Pass the focus to an element inside your view

    Example

    In your view you have an org.eclipse.jface.viewers.TableViewer named viewer, so you can pass the focus like this:

    public void setFocus() {
        viewer.getControl().setFocus();
    }