[vcs-log] VcsLogGraphTable.jumpToRow ensures that table is focused after jumping

This makes it unnecessary to request focus from the action and focus problems after filters were reset.
This commit is contained in:
Julia Beliaeva
2017-11-11 00:09:02 +03:00
parent 25f6827309
commit 6134d18173
2 changed files with 4 additions and 12 deletions
@@ -30,6 +30,7 @@ import com.intellij.openapi.util.Couple;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.vcs.VcsDataKeys;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.ui.ColoredTableCellRenderer;
import com.intellij.ui.JBColor;
import com.intellij.ui.ScrollingUtil;
@@ -443,6 +444,9 @@ public class VcsLogGraphTable extends TableWithProgress implements DataProvider,
if (rowIndex >= 0 && rowIndex <= getRowCount() - 1) {
scrollRectToVisible(getCellRect(rowIndex, 0, false));
setRowSelectionInterval(rowIndex, rowIndex);
if (!hasFocus()) {
IdeFocusManager.getInstance(myLogData.getProject()).requestFocus(this, true);
}
}
}
@@ -17,7 +17,6 @@ package git4idea.log;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.PerformInBackgroundOption;
import com.intellij.openapi.progress.ProgressIndicator;
@@ -30,7 +29,6 @@ import com.intellij.openapi.vcs.VcsDataKeys;
import com.intellij.openapi.vcs.VcsKey;
import com.intellij.openapi.vcs.history.VcsFileRevision;
import com.intellij.openapi.vcs.history.VcsRevisionNumber;
import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.vcs.log.impl.VcsLogContentUtil;
import com.intellij.vcs.log.impl.VcsProjectLog;
import com.intellij.vcs.log.ui.VcsLogUiImpl;
@@ -100,7 +98,6 @@ public class GitShowCommitInLogAction extends DumbAwareAction {
public void run(@NotNull ProgressIndicator indicator) {
try {
future.get();
ApplicationManager.getApplication().invokeLater(() -> ensureHasFocus(project, logUi));
}
catch (CancellationException | InterruptedException ignored) {
}
@@ -110,14 +107,5 @@ public class GitShowCommitInLogAction extends DumbAwareAction {
}
});
}
else {
ensureHasFocus(project, logUi);
}
}
private static void ensureHasFocus(@Nullable Project project, @NotNull VcsLogUiImpl logUi) {
if (!logUi.getTable().hasFocus()) {
IdeFocusManager.getInstance(project).requestFocus(logUi.getTable(), true);
}
}
}