close copies of a file in all splitters when it's deleted (IDEA-79964)

This commit is contained in:
Dmitry Jemerov
2012-01-19 11:53:29 +01:00
parent b949776066
commit c323fbb811
2 changed files with 8 additions and 8 deletions
@@ -462,7 +462,7 @@ public class Switcher extends AnAction implements DumbAware {
final JList jList = getSelectedList();
final EditorWindow wnd = findAppropriateWindow(info);
if (wnd == null) {
editorManager.closeFile(virtualFile, false);
editorManager.closeFile(virtualFile, false, false);
} else {
editorManager.closeFile(virtualFile, wnd, false);
}
@@ -534,10 +534,10 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Projec
//============================= EditorManager methods ================================
public void closeFile(@NotNull final VirtualFile file) {
closeFile(file, true);
closeFile(file, true, false);
}
public void closeFile(@NotNull final VirtualFile file, final boolean moveFocus) {
public void closeFile(@NotNull final VirtualFile file, final boolean moveFocus, final boolean closeAllCopies) {
assertDispatchThread();
final LocalFileSystem.WatchRequest request = file.getUserData(WATCH_REQUEST_KEY);
@@ -547,14 +547,14 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Projec
CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
public void run() {
closeFileImpl(file, moveFocus);
closeFileImpl(file, moveFocus, closeAllCopies);
}
}, "", null);
}
private void closeFileImpl(@NotNull final VirtualFile file, final boolean moveFocus) {
private void closeFileImpl(@NotNull final VirtualFile file, final boolean moveFocus, boolean closeAllCopies) {
assertDispatchThread();
runChange(new FileEditorManagerChange() {
public void run(EditorsSplitters splitters) {
@@ -581,7 +581,7 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Projec
}
}
}
}, getActiveSplitters(true).getResult());
}, closeAllCopies ? null : getActiveSplitters(true).getResult());
}
//-------------------------------------- Open File ----------------------------------------
@@ -1439,8 +1439,8 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Projec
final VirtualFile file = e.getFile();
final VirtualFile[] openFiles = getOpenFiles();
for (int i = openFiles.length - 1; i >= 0; i--) {
if (VfsUtil.isAncestor(file, openFiles[i], false)) {
closeFile(openFiles[i]);
if (VfsUtilCore.isAncestor(file, openFiles[i], false)) {
closeFile(openFiles[i], true, true);
}
}
}