Skip to content

Commit 1a9c4c9

Browse files
committed
Fixed New Class Inserting
Visually it's still missing the class icon but now you can edit and use the new class
1 parent d4652f1 commit 1a9c4c9

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

  • src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/contextmenu/impl

src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/contextmenu/impl/New.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,14 @@ private static JMenuItem createMenu(String name, FileType fileType, TreePath sel
9090

9191
//TODO santize newPath and remove extension if added
9292
cn.name = newPath;
93-
resourcePath = resourcePath.replace(".", "/") + ".class";
93+
String oldResourcePath = resourcePath.replace(".", "/");
94+
String newResourcePath = oldResourcePath + ".class";
9495

9596
contents = ASMUtil.nodeToBytes(cn);
9697

97-
BytecodeViewer.resourceContainers.get(containerName).resourceFiles.put(resourcePath, contents);
98-
searchAndInsert(firstPath + "/" + resourcePath, BytecodeViewer.resourceContainers.get(containerName).treeNode, "/");
98+
BytecodeViewer.resourceContainers.get(containerName).resourceClasses.put(oldResourcePath, cn);
99+
BytecodeViewer.resourceContainers.get(containerName).resourceClassBytes.put(newResourcePath, contents);
100+
searchAndInsert(firstPath + "/" + newResourcePath, BytecodeViewer.resourceContainers.get(containerName).treeNode, "/");
99101

100102
break;
101103
case FILE:

0 commit comments

Comments
 (0)