Notification when closing a dockable

Hi,

Which listener should I use to get notified when the user click on the x (close) button of a dockable?

I tried CDockableStateListener, but it is also notified when I change the visibility of a dockable

Thank you

Normally clicking on the x calls “setVisible” and does nothing else. You’ll need to replace the button to be specifically notified of someone clicking the x:

  • Make a subclass of CCloseAction and override “close”. This method is only called if the users clicked on the button.
  • Install your custom action using AbstractCDockable.putAction(key,action) where “key” is CDockable.ACTION_KEY_CLOSE.

Thank you. It is working perfectly…

Is there any built in implementation in the framework in order to search for hidden dockable? To search if a dockable is still registerered but setted to visible false

Thank you

You can access the CControlRegister (CControl.getRegister), this interface offers several methods to get all the CDockables that are currently registered. Then you would just loop over the lists, and filter Dockables using “CDockable.isVisible”.