Order of Actions in Tab

Hi,

I am using the Eclipse Theme and added a second action (beside the close action) in the Tab area with the addAction Command and the annotation @EclipseTabDockAction. Is it possible to change the display order? At the moment my action is shown first and then the close action. Is it possible to switch position?

Thank you very much!
Lars

Yes, but… the actions you add directly to a CDockable will always be on the left side. Actions are collected in “DockActionSources”, and one action-source is always shown as one block of actions. But you can smuggle an additional action-source into your Dockable. That new source can stay on the very right side.

You will need to subclass “DefaultSingleCDockable” and override the “createCommonDockable” method to add the new action-source. Like in this example:

package test;

import javax.swing.JFrame;

import bibliothek.extension.gui.dock.theme.eclipse.EclipseTabDockAction;
import bibliothek.gui.dock.action.DefaultDockActionSource;
import bibliothek.gui.dock.action.LocationHint;
import bibliothek.gui.dock.common.CControl;
import bibliothek.gui.dock.common.DefaultSingleCDockable;
import bibliothek.gui.dock.common.action.CButton;
import bibliothek.gui.dock.common.intern.DefaultCommonDockable;
import bibliothek.gui.dock.common.theme.ThemeMap;

public class ActionOnRightSide {
	public static void main( String[] args ) {
		JFrame frame = new JFrame();
		frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
		frame.setBounds( 10, 10, 500, 500 );
		
		CControl control = new CControl( frame );
		control.setTheme( ThemeMap.KEY_ECLIPSE_THEME );
		frame.add( control.getContentArea() );
		
		RightDockable dockable = new RightDockable();
		dockable.setCloseable( true );
		control.addDockable( dockable );
		dockable.setVisible( true );
		
		frame.setVisible( true );
	}
	
	private static class RightDockable extends DefaultSingleCDockable{
		public RightDockable(){
			super( "right", "Right" );
		}
		
		@Override
		protected DefaultCommonDockable createCommonDockable() {
			DefaultDockActionSource rightSource = new 
					DefaultDockActionSource( new LocationHint( LocationHint.ACTION_GUARD, LocationHint.RIGHT_OF_ALL ) );
			
			rightSource.add( new RightButton().intern() );
			
			return new DefaultCommonDockable( this, getClose(), rightSource );
		}
	}
	
	@EclipseTabDockAction
	private static class RightButton extends CButton{
		public RightButton(){
			setText( "right" );
			setShowTextOnButtons( true );
		}
	}
}

Wow, thank you for the fast answer!