diff --git a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/MainDesignerController.java b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/MainDesignerController.java index af573beade..33e86645ed 100644 --- a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/MainDesignerController.java +++ b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/MainDesignerController.java @@ -135,7 +135,7 @@ public class MainDesignerController extends AbstractController eventLogController.getValue().showPopup()); openEventLogMenuItem.textProperty().bind( - getLogger().numNewLogEntriesProperty().map(i -> "Exception log (" + (i > 0 ? i : "no") + " new)") + getLogger().numNewLogEntriesProperty().map(i -> "Event log (" + (i > 0 ? i : "no") + " new)") ); } @@ -199,15 +199,6 @@ public class MainDesignerController extends AbstractController { // These are "flag" categories that signal that previous exceptions // thrown during code or XPath edition may be discarded as uninteresting + // When in developer mode they're pushed to the event log too PARSE_OK("Parsing success", CategoryType.INTERNAL), XPATH_OK("XPath evaluation success", CategoryType.INTERNAL), - /** - * Used for events that occurred internally to the app and are only relevant to a developer of the app. - */ + // These are used for events that occurred internally to the app and are + // only relevant to a developer of the app. INTERNAL("Internal event", CategoryType.INTERNAL), SELECTION_EVENT_TRACING("Selection event tracing", CategoryType.INTERNAL); @@ -153,11 +151,6 @@ public class LogEntry implements Comparable { } - public boolean isFlag() { - return type == FLAG; - } - - public boolean isInternal() { return type == CategoryType.INTERNAL; } @@ -170,12 +163,11 @@ public class LogEntry implements Comparable { enum CategoryType { USER_EXCEPTION, - FLAG, INTERNAL } } - public static class LogEntryWithData extends LogEntry { + static class LogEntryWithData extends LogEntry { private final T userData; diff --git a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/app/NodeSelectionSource.java b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/app/NodeSelectionSource.java index 7df2533640..9c8d406424 100644 --- a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/app/NodeSelectionSource.java +++ b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/app/NodeSelectionSource.java @@ -14,6 +14,8 @@ import net.sourceforge.pmd.util.fxdesigner.XPathPanelController; import net.sourceforge.pmd.util.fxdesigner.util.beans.SettingsOwner; import net.sourceforge.pmd.util.fxdesigner.util.controls.AstTreeView; +import javafx.application.Platform; + /** * A control or controller that somehow displays nodes in a form that the user can select. @@ -53,7 +55,8 @@ public interface NodeSelectionSource extends ApplicationComponent { default void bubbleDown(NodeSelectionEvent selectionEvent) { if (alwaysHandleSelection() || selectionEvent.getOrigin() != this) { logSelectionEventTrace(selectionEvent, () -> "\t" + this.getDebugName() + " is handling event"); - setFocusNode(selectionEvent.getSelection()); + // roam the tree synchronously, execute handlers some time later + Platform.runLater(() -> setFocusNode(selectionEvent.getSelection())); } } @@ -74,7 +77,8 @@ public interface NodeSelectionSource extends ApplicationComponent { /** * An event fired when the user selects a node somewhere in the UI - * and bubbled up to the {@link MainDesignerController}. + * and bubbled up to the {@link MainDesignerController}. It's a pure + * data class. */ final class NodeSelectionEvent { diff --git a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/popups/EventLogController.java b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/popups/EventLogController.java index a985c90ccc..ed083b8483 100644 --- a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/popups/EventLogController.java +++ b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/popups/EventLogController.java @@ -245,7 +245,7 @@ public final class EventLogController extends AbstractController titleProperty() { - return parent.getLogger().numNewLogEntriesProperty().map(i -> "Exception log (" + (i > 0 ? i : "no") + " new)"); + return parent.getLogger().numNewLogEntriesProperty().map(i -> "Event log (" + (i > 0 ? i : "no") + " new)"); }