@param workspace Workspace to set.
(Workspace workspace)
| 47 | * @param workspace Workspace to set. |
| 48 | */ |
| 49 | public void setWorkspace(Workspace workspace) { |
| 50 | Collection<WorkspacePlugin> plugins = PluginsManager.getInstance().ofType(WorkspacePlugin.class); |
| 51 | Workspace old = this.workspace; |
| 52 | if (old != null) { |
| 53 | plugins.forEach(plugin -> plugin.onClosed(old)); |
| 54 | } |
| 55 | this.workspace = workspace; |
| 56 | Recaf.setCurrentWorkspace(workspace); |
| 57 | plugins.forEach(plugin -> plugin.onOpened(workspace)); |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * @return Current workspace. |