Skip to content

Commit 261c0a0

Browse files
committed
Ensure that jump to source still focuses editor (#676)
1 parent ae2e4b6 commit 261c0a0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main/java/org/infernus/idea/checkstyle/toolwindow/CheckStyleToolWindowPanel.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ private void clearProgress() {
314314
*
315315
* @param treePath the tree path to scroll to.
316316
*/
317-
private void scrollToError(final TreePath treePath) {
317+
private void scrollToError(final TreePath treePath, final boolean focusEditor) {
318318
final DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) treePath.getLastPathComponent();
319319
if (treeNode == null || !(treeNode.getUserObject() instanceof ProblemResultTreeInfo nodeInfo)) {
320320
return;
@@ -331,7 +331,7 @@ private void scrollToError(final TreePath treePath) {
331331

332332
final FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
333333
ApplicationManager.getApplication().invokeLater(() -> {
334-
final FileEditor[] editor = fileEditorManager.openFile(virtualFile, false);
334+
final FileEditor[] editor = fileEditorManager.openFile(virtualFile, focusEditor);
335335

336336
if (editor.length > 0 && editor[0] instanceof TextEditor) {
337337
final LogicalPosition problemPos = new LogicalPosition(
@@ -376,7 +376,7 @@ public boolean isScrollToSource() {
376376
public void jumpToSource() {
377377
final TreePath treePath = resultsTree.getSelectionPath();
378378
if (treePath != null) {
379-
scrollToError(treePath);
379+
scrollToError(treePath, true);
380380
}
381381
}
382382

@@ -475,7 +475,7 @@ public void mouseClicked(final MouseEvent e) {
475475

476476
final TreePath treePath = resultsTree.getPathForLocation(e.getX(), e.getY());
477477
if (treePath != null) {
478-
scrollToError(treePath);
478+
scrollToError(treePath, false);
479479
}
480480
}
481481
}
@@ -507,7 +507,7 @@ public void valueChanged(final TreeSelectionEvent e) {
507507
}
508508

509509
if (e.getPath() != null) {
510-
scrollToError(e.getPath());
510+
scrollToError(e.getPath(), false);
511511
}
512512
}
513513

0 commit comments

Comments
 (0)