WorkbenchFX
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.
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.