From 1a9c4c9062be2e6b2a5e513db6d469a7887c9a32 Mon Sep 17 00:00:00 2001 From: Konloch Date: Thu, 29 Jul 2021 11:41:04 -0700 Subject: [PATCH] Fixed New Class Inserting Visually it's still missing the class icon but now you can edit and use the new class --- .../gui/resourcelist/contextmenu/impl/New.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/contextmenu/impl/New.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/contextmenu/impl/New.java index e5f140c1..61ef26ac 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/contextmenu/impl/New.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/contextmenu/impl/New.java @@ -90,12 +90,14 @@ public class New extends ContextMenuItem //TODO santize newPath and remove extension if added cn.name = newPath; - resourcePath = resourcePath.replace(".", "/") + ".class"; + String oldResourcePath = resourcePath.replace(".", "/"); + String newResourcePath = oldResourcePath + ".class"; contents = ASMUtil.nodeToBytes(cn); - BytecodeViewer.resourceContainers.get(containerName).resourceFiles.put(resourcePath, contents); - searchAndInsert(firstPath + "/" + resourcePath, BytecodeViewer.resourceContainers.get(containerName).treeNode, "/"); + BytecodeViewer.resourceContainers.get(containerName).resourceClasses.put(oldResourcePath, cn); + BytecodeViewer.resourceContainers.get(containerName).resourceClassBytes.put(newResourcePath, contents); + searchAndInsert(firstPath + "/" + newResourcePath, BytecodeViewer.resourceContainers.get(containerName).treeNode, "/"); break; case FILE: