diff --git a/modules/decima-ui/src/main/java/com/shade/decima/ui/data/handlers/ReferenceValueHandler.java b/modules/decima-ui/src/main/java/com/shade/decima/ui/data/handlers/ReferenceValueHandler.java index 658d25bf1..d1a2f2f5b 100644 --- a/modules/decima-ui/src/main/java/com/shade/decima/ui/data/handlers/ReferenceValueHandler.java +++ b/modules/decima-ui/src/main/java/com/shade/decima/ui/data/handlers/ReferenceValueHandler.java @@ -7,7 +7,11 @@ import com.shade.decima.ui.data.registry.ValueHandlerRegistration; import com.shade.decima.ui.data.registry.ValueHandlerRegistration.Selector; import com.shade.decima.ui.data.registry.ValueHandlerRegistration.Type; +import com.shade.decima.ui.editor.core.CoreEditor; +import com.shade.decima.ui.editor.core.menu.FollowReferenceItem; import com.shade.platform.ui.controls.TextAttributes; +import com.shade.platform.ui.editors.Editor; +import com.shade.platform.ui.editors.EditorManager; import com.shade.util.NotNull; import com.shade.util.Nullable; @@ -24,15 +28,15 @@ public class ReferenceValueHandler implements ValueHandler { public Decorator getDecorator(@NotNull RTTIType type) { return (value, component) -> { if (value instanceof RTTIReference.External ref) { - component.append(ref.path(), TextAttributes.REGULAR_ATTRIBUTES); - component.append(" : ", TextAttributes.REGULAR_ATTRIBUTES); - component.append(RTTIUtils.uuidToString(ref.uuid()), TextAttributes.REGULAR_ATTRIBUTES); + component.append(ref.path() + " : " + RTTIUtils.uuidToString(ref.uuid())); component.append(" (" + ref.kind() + ")", TextAttributes.GRAYED_ATTRIBUTES); + component.append(" open", TextAttributes.LINK_ATTRIBUTES, e -> follow(ref)); } else if (value instanceof RTTIReference.Internal ref) { - component.append(RTTIUtils.uuidToString(ref.uuid()), TextAttributes.REGULAR_ATTRIBUTES); + component.append(RTTIUtils.uuidToString(ref.uuid())); component.append(" (" + ref.kind() + ")", TextAttributes.GRAYED_ATTRIBUTES); + component.append(" open", TextAttributes.LINK_ATTRIBUTES, e -> follow(ref)); } else { - component.append("none", TextAttributes.REGULAR_ATTRIBUTES); + component.append("none"); } }; } @@ -52,4 +56,11 @@ public String getText(@NotNull RTTIType type, @NotNull Object value) { return null; } } + + private void follow(@NotNull RTTIReference reference) { + final Editor editor = EditorManager.getInstance().getActiveEditor(); + if (editor instanceof CoreEditor e) { + FollowReferenceItem.follow(reference, e); + } + } } diff --git a/modules/decima-ui/src/main/java/com/shade/decima/ui/editor/core/CoreTree.java b/modules/decima-ui/src/main/java/com/shade/decima/ui/editor/core/CoreTree.java index 4dc0d1233..db1deaed6 100644 --- a/modules/decima-ui/src/main/java/com/shade/decima/ui/editor/core/CoreTree.java +++ b/modules/decima-ui/src/main/java/com/shade/decima/ui/editor/core/CoreTree.java @@ -7,8 +7,7 @@ public class CoreTree extends Tree { public CoreTree(@NotNull CoreNodeFile root) { - setCellRenderer(new CoreTreeCellRenderer()); - + setCellRenderer(new CoreTreeCellRenderer().withTags(this)); setModel(new CoreTreeModel(this, root)); setSelectionPath(new TreePath(root)); } diff --git a/modules/decima-ui/src/main/java/com/shade/decima/ui/editor/core/menu/FollowReferenceItem.java b/modules/decima-ui/src/main/java/com/shade/decima/ui/editor/core/menu/FollowReferenceItem.java index 54134d618..da40b4832 100644 --- a/modules/decima-ui/src/main/java/com/shade/decima/ui/editor/core/menu/FollowReferenceItem.java +++ b/modules/decima-ui/src/main/java/com/shade/decima/ui/editor/core/menu/FollowReferenceItem.java @@ -81,7 +81,7 @@ private static boolean isValidReference(@Nullable Object value) { || value instanceof RTTIReference.External; } - private static void follow(@NotNull RTTIReference reference, @NotNull CoreEditor currentEditor) { + public static void follow(@NotNull RTTIReference reference, @NotNull CoreEditor currentEditor) { final RTTIObject uuid; final CompletableFuture future;