WorkbenchFX
WorkbenchFX copied to clipboard
WorkbenchModule.close() does not work with Workbech.getOpenModules()
Using the following code with more than one modules opened
workbench.getOpenModules().forEach(WorkbenchModule::close);
and as the close() method removes the module from the original list, it messes up the forEach(...)
The result is that some of the modules remain open.
Possible solution would be to return a copy of the original list (FXCollection.copy or List.copyOf) or to provide Workbench.closeAllModules() method as the first 2 options might cause other issues, depending on the usage.
I would also add `addModule(WorkbenchModule)' and 'removeModule(WorkbenchModule)' (and addAll, removeAll) instead of opening the internal API by returning the collections themselves to prevent side-effects like the above.