Keep first open tab visible

Hi Beni

We use the feature in the eclipse theme which moves tabs to the “overflow-menu” on the right instead of making them smaller when a lot of tabs are opened.

Now, the first tab we open is something like a “Home” tab which should always stay visible at the very left position, even if other tabs get moved to the popup-menu.

Do you see any possibility how we could implement that?

Thanks
Daniela

The location of the tabs and which tabs are put into the menu are defined by the “TabLayoutManager”. Using the property-key “TabPane.LAYOUT_MANAGER” you can globally set a custom TabLayoutManager.

For the modification you intend I see no other way than to copy the source code of “MenuLineLayout” (this is the one TabLayoutManager used by the EclipseTheme). I think you can get far if you replace line 155 “tabs = new LineTabsLayoutBlock();” with “tabs = new CustomLineTabsLayoutBlock” where “CustomLineTabsLayoutBlock extends LineTabsLayoutBlock”.

In CustomLineTabsLayoutBlock you would need to override the “insertTab” method to order the tabs such that your special tab is always on the left side. Also the method “getTabsOrderedByImportance” would need to return always the special tab as most important tab.

Hm, this gets bad…
… if you really need that home-Dockable I can write you an interface that forces the correct order on the Dockables. There is no easy solution for this problem, the framework was really not designed to be used that way.

Some more issues that would need your attention:

Actually you may need to tell the StackDockStation that no Dockable other than your Home Dockable can be at position 0.

Implementing your own Combiner which introduces its own StackDockStation would be necessary. To install this combiner you would need to call “EclipseTheme.setCombiner”. You would need to override , “exactTabIndexAt” and make sure 0 is not returned for the wrong Dockable.

You may need to check the “stalled”-property of DockRegister (DockController.getRegister): if it is true then the framework is doing some reordering of Dockables and you may not want to interfer. You would check the entire tree once the DockRegister fires its events.

Morning Beni

If it’s that complex, we won’t take the effort. Thank you very much for thinking it through.