Fixed New Class Inserting

Visually it's still missing the class icon but now you can edit and use the new class
This commit is contained in:
Konloch 2021-07-29 11:41:04 -07:00
parent d4652f1d1e
commit 1a9c4c9062
1 changed files with 5 additions and 3 deletions

View File

@ -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: