Skip to content

Commit

Permalink
Close work editor closeWork is called
Browse files Browse the repository at this point in the history
Fixes #1602
  • Loading branch information
danilovesky committed May 17, 2024
1 parent 9342e87 commit 51dc91a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
10 changes: 8 additions & 2 deletions workcraft/WorkcraftCore/src/org/workcraft/Framework.java
Original file line number Diff line number Diff line change
Expand Up @@ -656,15 +656,21 @@ public void mergeWork(WorkspaceEntry we, File file) throws DeserialisationExcept
*/
@SuppressWarnings("unused")
public void closeWork(WorkspaceEntry we) {
getWorkspace().removeWork(we);
if ((we != null) && (mainWindow != null)) {
we.setChanged(false);
mainWindow.closeEditor(we);
}
if (we != null) {
workspace.removeWork(we);
}
}

/**
* Used in core-workspace.js JavaScript wrapper.
*/
@SuppressWarnings("unused")
public void closeAllWorks() {
for (WorkspaceEntry we : getWorkspace().getWorks()) {
for (WorkspaceEntry we : workspace.getWorks()) {
closeWork(we);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ private void closeDockableEditorWindow(DockableWindow window, GraphEditor editor
toggleDockableWindowMaximized(window);
}
DockableWindow dockableWindow = weWindowMap.remove(we);
// Close the work it has no associated windows, or clear listeners otherwise
// Close the work if it has no associated windows, or clear listeners otherwise
if (dockableWindow == null) {
Framework.getInstance().closeWork(we);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ public void addMount(Path<String> path, File file, boolean temporary) {
fireWorkspaceChanged();
}

public void removeMount(Path<String> path) {
mounts.remove(path);
permanentMounts.remove(path);

}

public void fireWorkspaceChanged() {
// TODO : categorise and route events
for (WorkspaceListener listener : workspaceListeners) {
Expand Down

0 comments on commit 51dc91a

Please sign in to comment.