mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
local history: Made "ShowHistoryAction" operate on single selected file
And not on the common parent of all the selected files (as before)
This commit is contained in:
+3
-11
@@ -21,11 +21,11 @@ import com.intellij.history.integration.IdeaGateway;
|
||||
import com.intellij.history.integration.LocalHistoryImpl;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vcs.VcsDataKeys;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.vcsUtil.VcsUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -71,14 +71,6 @@ public abstract class LocalHistoryAction extends AnAction implements DumbAware {
|
||||
|
||||
@Nullable
|
||||
protected VirtualFile getFile(@NotNull AnActionEvent e) {
|
||||
VirtualFile[] ff = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
|
||||
if (ff == null || ff.length == 0) return null;
|
||||
|
||||
VirtualFile commonParent = ff[0];
|
||||
for (int i = 1; i < ff.length; i++) {
|
||||
commonParent = VfsUtilCore.getCommonAncestor(commonParent, ff[i]);
|
||||
if (commonParent == null) break;
|
||||
}
|
||||
return commonParent;
|
||||
return VcsUtil.getIfSingle(e.getData(VcsDataKeys.VIRTUAL_FILE_STREAM));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user