IDEA-104706 Remove currently active file from "Recent Files" popup

This commit is contained in:
Konstantin Bulenkov
2013-12-20 19:40:07 +04:00
parent d2e8aa1934
commit 317be6ec95
2 changed files with 6 additions and 5 deletions
@@ -23,7 +23,6 @@ import com.intellij.featureStatistics.FeatureUsageTracker;
import com.intellij.ide.IdeBundle;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
@@ -36,10 +35,7 @@ public class ShowRecentFilesAction extends DumbAwareAction {
final Project project = e.getData(CommonDataKeys.PROJECT);
if (project != null) {
FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.recent.files");
final Switcher.SwitcherPanel switcher = Switcher.createAndShowSwitcher(project, IdeBundle.message("title.popup.recent.files"), true);
if (FileEditorManagerEx.getInstanceEx(project).hasOpenedFile()) {
switcher.goForward();
}
Switcher.createAndShowSwitcher(project, IdeBundle.message("title.popup.recent.files"), true);
}
}
}
@@ -345,7 +345,12 @@ public class Switcher extends AnAction implements DumbAware {
final int maxFiles = Math.max(editors.size(), recentFiles.length);
final int len = isPinnedMode() ? recentFiles.length : Math.min(toolWindows.getModel().getSize(), maxFiles);
boolean firstRecentMarked = false;
final List<VirtualFile> selectedFiles = Arrays.asList(editorManager.getSelectedFiles());
for (int i = 0; i < len; i++) {
if (isPinnedMode() && selectedFiles.contains(recentFiles[i])) {
continue;
}
final FileInfo info = new FileInfo(recentFiles[i], null);
boolean add = true;
if (isPinnedMode()) {