WorkbenchFX icon indicating copy to clipboard operation
WorkbenchFX copied to clipboard

Removing a module from the collection returned by getModules() should also close and remove the module from the openModules collection as accessing them will throw an exception.

Open balazsvero opened this issue 1 year ago • 0 comments

To reproduce:

Create a toolbarButton that removes all the modules from the workbench. Start the app, open some modules. Activate the button. Click on the tab of the modules. IllegalArgumentException: Module has not been loaded yet is thrown

Possible solutions:

  • never return the internal lists but add functions to manage them (add/remove) and take care of syncing them
  • create a listener for the modules list and call close() on the module if it was open
  • remove the openModules list property from the Workbench and add a booleanProperty to the WorkbenchModule class. getOpenModules could then return the modules list filtered for this boolean indicating open status.

balazsvero avatar May 19 '23 15:05 balazsvero