From d0fbf4a31381c8c046ab23fff4152f93730d1cdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 16 Jan 2019 12:02:29 +0100 Subject: [PATCH] Explanations --- .../pmd/util/fxdesigner/NodeInfoPanelController.java | 7 +++++-- .../pmd/util/fxdesigner/SourceEditorController.java | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/NodeInfoPanelController.java b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/NodeInfoPanelController.java index 4882790c9e..bd0f321b81 100644 --- a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/NodeInfoPanelController.java +++ b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/NodeInfoPanelController.java @@ -50,7 +50,7 @@ public class NodeInfoPanelController extends AbstractController { private final MainDesignerController parent; - /** List of attribute names that are ignored if {@link #isShowAllAttributes()} is false. */ + /** List of attribute names that are ignored if {@link #isHideCommonAttributes()} is true. */ private static final List IGNORABLE_ATTRIBUTES = Arrays.asList("BeginLine", "EndLine", "BeginColumn", "EndColumn", "FindBoundary", "SingleLine"); @@ -152,8 +152,11 @@ public class NodeInfoPanelController extends AbstractController { scopeHierarchyTreeView.setRoot(rootScope); if (focusScopeView && previousSelection != null) { + // Try to find the node that was previously selected and focus it in the new ascendant hierarchy + // Otherwise, when you select a node in the scope tree, since focus of the app is shifted to that + // node, the scope hierarchy is reset and you lose the selection - even though obviously the node + // you selected is in its own scope hierarchy so it looks buggy. int maxDepth = IteratorUtil.count(IteratorUtil.parentIterator(previousSelection, true)); - rootScope.tryFindNode(previousSelection.getValue(), maxDepth) .ifPresent(scopeHierarchyTreeView.getSelectionModel()::select); } diff --git a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/SourceEditorController.java b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/SourceEditorController.java index 61717ea961..4b76e41638 100644 --- a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/SourceEditorController.java +++ b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/SourceEditorController.java @@ -70,13 +70,13 @@ public class SourceEditorController extends AbstractController { private static final Duration AST_REFRESH_DELAY = Duration.ofMillis(100); + @FXML + private MenuButton languageSelectionMenuButton; @FXML private ToolbarTitledPane editorTitledPane; @FXML private ToolbarTitledPane astViewTitledPane; @FXML - private MenuButton languageSelectionMenuButton; - @FXML private TreeView astTreeView; @FXML private HighlightLayerCodeArea codeEditorArea;