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:
Konstantin Kolosovsky
2016-08-04 22:37:12 +03:00
parent 5fe27a7566
commit cac05bda38
@@ -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));
}
}