From 7378b397cee664ae81b7963b0355ef8ff013c3a7 Mon Sep 17 00:00:00 2001 From: Col-E Date: Sat, 29 May 2021 00:56:48 -0400 Subject: [PATCH] Minor tidying of #381 --- src/main/java/me/coley/recaf/command/impl/Remap.java | 9 ++++----- src/main/java/me/coley/recaf/config/ConfDisplay.java | 6 ------ .../recaf/ui/controls/node/ClassNodeEditorPane.java | 8 -------- src/main/java/me/coley/recaf/util/UiUtil.java | 8 +++----- 4 files changed, 7 insertions(+), 24 deletions(-) diff --git a/src/main/java/me/coley/recaf/command/impl/Remap.java b/src/main/java/me/coley/recaf/command/impl/Remap.java index 2270cb940..8d3b713f9 100644 --- a/src/main/java/me/coley/recaf/command/impl/Remap.java +++ b/src/main/java/me/coley/recaf/command/impl/Remap.java @@ -61,20 +61,19 @@ public Void call() throws Exception { byte[] manifestBytes = primary.getFiles().get("META-INF/MANIFEST.MF"); if (manifestBytes != null) { - debug("Found manifest file"); Manifest manifest = new Manifest(new ByteArrayInputStream(manifestBytes)); Attributes attr = manifest.getMainAttributes(); if (!attr.isEmpty()) { String mainClass = attr.getValue("Main-Class").replaceAll("\\.", "/"); if (mapped.containsKey(mainClass)) { - debug("Found Main-Class attribute"); - attr.putValue("Main-Class", new ClassReader(mapped.get(mainClass)) - .getClassName().replaceAll("/", "\\.")); + String mappedName = new ClassReader(mapped.get(mainClass)) + .getClassName().replaceAll("/", "\\."); + debug("Remapping Main-Class attribute in MANIFEST.MF from '{}' to '{}'", mainClass, mappedName); + attr.putValue("Main-Class", mappedName); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); manifest.write(outputStream); primary.getFiles().put("META-INF/MANIFEST.MF", outputStream.toByteArray()); outputStream.close(); - debug("Remapped manifest"); } } } diff --git a/src/main/java/me/coley/recaf/config/ConfDisplay.java b/src/main/java/me/coley/recaf/config/ConfDisplay.java index 2bcc4e0b2..d33714cea 100644 --- a/src/main/java/me/coley/recaf/config/ConfDisplay.java +++ b/src/main/java/me/coley/recaf/config/ConfDisplay.java @@ -83,12 +83,6 @@ public class ConfDisplay extends Config { @Conf("display.maxtreedepth") public int maxTreeDepth = 30; - /** - * Displays access flags tooltip for class/field/method icons - */ - @Conf("display.accessflags") - public boolean accessFlagsTooltip = true; - ConfDisplay() { super("display"); } diff --git a/src/main/java/me/coley/recaf/ui/controls/node/ClassNodeEditorPane.java b/src/main/java/me/coley/recaf/ui/controls/node/ClassNodeEditorPane.java index 5c00b18aa..a4b1f0288 100644 --- a/src/main/java/me/coley/recaf/ui/controls/node/ClassNodeEditorPane.java +++ b/src/main/java/me/coley/recaf/ui/controls/node/ClassNodeEditorPane.java @@ -244,10 +244,6 @@ public void updateItem(Integer item, boolean empty) { setGraphic(null); } else { setGraphic(UiUtil.createFieldGraphic(item)); - setTooltip(new Tooltip(AccessFlag.getApplicableFlags(AccessFlag.Type.FIELD).stream() - .filter(flag -> (flag.getMask() & item) == flag.getMask()) - .map(AccessFlag::getName) - .collect(Collectors.joining(", ")))); } } }); @@ -316,10 +312,6 @@ public void updateItem(Integer item, boolean empty) { setGraphic(null); } else { setGraphic(UiUtil.createMethodGraphic(item)); - setTooltip(new Tooltip(AccessFlag.getApplicableFlags(AccessFlag.Type.METHOD).stream() - .filter(flag -> (flag.getMask() & item) == flag.getMask()) - .map(AccessFlag::getName) - .collect(Collectors.joining(", ")))); } } }); diff --git a/src/main/java/me/coley/recaf/util/UiUtil.java b/src/main/java/me/coley/recaf/util/UiUtil.java index 44a7e3c8e..5710e25f4 100644 --- a/src/main/java/me/coley/recaf/util/UiUtil.java +++ b/src/main/java/me/coley/recaf/util/UiUtil.java @@ -15,7 +15,6 @@ import javafx.scene.image.WritableImage; import javafx.scene.paint.Color; import javafx.util.Duration; -import me.coley.recaf.Recaf; import me.coley.recaf.ui.controls.IconView; import me.coley.recaf.workspace.*; @@ -192,14 +191,13 @@ private static void createAccessToolTips(Node node, AccessFlag.Type type, int ac Set accessFlags = AccessFlag.getApplicableFlags(type, access).stream() .map(AccessFlag::getName).collect(Collectors.toSet()); Tooltip tooltip = new Tooltip(String.join(", ", accessFlags)); + // Show tooltip instantly, Tooltip.install(node, tooltip) has a significant delay node.setOnMouseEntered(event -> { - if (!tooltip.getText().isEmpty() && Recaf.getController().config().display().accessFlagsTooltip) { - tooltip.show(node, event.getScreenX(), event.getScreenY() + 15); + if (!tooltip.getText().isEmpty()) { + tooltip.show(node, event.getScreenX() + 10, event.getScreenY() + 1); } }); node.setOnMouseExited(event -> tooltip.hide()); - // This has a weird delay - // Tooltip.install(node, tooltip); } /**