Adding action to menu on right click of TabInfo
Hello,
I have been looking for a way to add an action to the menu of a TabInfo used for tabs in JBtabs, does anyone know the proper way to implement this? I tried the following but it does not seem to ad the action to the popup menu.
DefaultActionGroup actionGroup = new DefaultActionGroup();
actionGroup.add(new RenameTab(tabInfo));tabInfo.setTabLabelActions(actionGroup, ActionPlaces.EDITOR_TAB_POPUP)
Please sign in to leave a comment.
Please try calling JBTabs.setPopupGroup() instead.
Thank you :) your assistance has aided me alot the latest weeks.
As a follow up question, is there a way to know in the action that is called, wich TabInfo object was right clicked? To make renaming possible.
Edit : you can use tabs.getTargetInfo() to do this, but you have to allocate this right after the action happens. The targetInfo returns (i guess) the tab under the mouse pointer.
You should be able to implement DataProvider in the component that lives in the tab, and use a custom data key to identify the active tab.