summaryrefslogtreecommitdiff
path: root/enigma
diff options
context:
space:
mode:
authorGravatar ramidzkh2022-09-13 03:28:25 +1000
committerGravatar GitHub2022-09-12 18:28:25 +0100
commit0a80622efae2fd54df3ed991eb856b3718d6820c (patch)
tree260cc7e50b4b1fa6f51dba1da38c1516632a1765 /enigma
parentEnsure the root method is used when mapping specialized methods (#459) (diff)
downloadenigma-fork-0a80622efae2fd54df3ed991eb856b3718d6820c.tar.gz
enigma-fork-0a80622efae2fd54df3ed991eb856b3718d6820c.tar.xz
enigma-fork-0a80622efae2fd54df3ed991eb856b3718d6820c.zip
Nested packages in Swing UI (#458)
* WIP nested packages * Fix deobfuscated panel package having obfuscated packages * Remove stream * Mass toggle classes obfuscation status from selector * Fix deobfuscated classes with the same name being hidden from class selectors * Open classes by pressing enter
Diffstat (limited to 'enigma')
-rw-r--r--enigma/src/main/java/cuchaz/enigma/translation/representation/entry/ClassEntry.java29
1 files changed, 21 insertions, 8 deletions
diff --git a/enigma/src/main/java/cuchaz/enigma/translation/representation/entry/ClassEntry.java b/enigma/src/main/java/cuchaz/enigma/translation/representation/entry/ClassEntry.java
index ec5294e..b0adb2c 100644
--- a/enigma/src/main/java/cuchaz/enigma/translation/representation/entry/ClassEntry.java
+++ b/enigma/src/main/java/cuchaz/enigma/translation/representation/entry/ClassEntry.java
@@ -11,12 +11,6 @@
11 11
12package cuchaz.enigma.translation.representation.entry; 12package cuchaz.enigma.translation.representation.entry;
13 13
14import java.util.List;
15import java.util.Objects;
16
17import javax.annotation.Nonnull;
18import javax.annotation.Nullable;
19
20import cuchaz.enigma.source.RenamableTokenType; 14import cuchaz.enigma.source.RenamableTokenType;
21import cuchaz.enigma.translation.TranslateResult; 15import cuchaz.enigma.translation.TranslateResult;
22import cuchaz.enigma.translation.Translator; 16import cuchaz.enigma.translation.Translator;
@@ -25,6 +19,11 @@ import cuchaz.enigma.translation.mapping.IdentifierValidation;
25import cuchaz.enigma.translation.representation.TypeDescriptor; 19import cuchaz.enigma.translation.representation.TypeDescriptor;
26import cuchaz.enigma.utils.validation.ValidationContext; 20import cuchaz.enigma.utils.validation.ValidationContext;
27 21
22import javax.annotation.Nonnull;
23import javax.annotation.Nullable;
24import java.util.List;
25import java.util.Objects;
26
28public class ClassEntry extends ParentedEntry<ClassEntry> implements Comparable<ClassEntry> { 27public class ClassEntry extends ParentedEntry<ClassEntry> implements Comparable<ClassEntry> {
29 private final String fullName; 28 private final String fullName;
30 29
@@ -141,7 +140,7 @@ public class ClassEntry extends ParentedEntry<ClassEntry> implements Comparable<
141 } 140 }
142 141
143 public String getPackageName() { 142 public String getPackageName() {
144 return getPackageName(fullName); 143 return getParentPackage(fullName);
145 } 144 }
146 145
147 /** 146 /**
@@ -187,7 +186,7 @@ public class ClassEntry extends ParentedEntry<ClassEntry> implements Comparable<
187 return packageName != null && (packageName.startsWith("java/") || packageName.startsWith("javax/")); 186 return packageName != null && (packageName.startsWith("java/") || packageName.startsWith("javax/"));
188 } 187 }
189 188
190 public static String getPackageName(String name) { 189 public static String getParentPackage(String name) {
191 int pos = name.lastIndexOf('/'); 190 int pos = name.lastIndexOf('/');
192 if (pos > 0) { 191 if (pos > 0) {
193 return name.substring(0, pos); 192 return name.substring(0, pos);
@@ -195,6 +194,20 @@ public class ClassEntry extends ParentedEntry<ClassEntry> implements Comparable<
195 return null; 194 return null;
196 } 195 }
197 196
197 public static String getNameInPackage(String name) {
198 int pos = name.lastIndexOf('/');
199
200 if (pos == name.length() - 1) {
201 return "(empty)";
202 }
203
204 if (pos > 0) {
205 return name.substring(pos + 1);
206 }
207
208 return name;
209 }
210
198 @Nullable 211 @Nullable
199 public static ClassEntry getOuterClass(String name) { 212 public static ClassEntry getOuterClass(String name) {
200 if (name.charAt(0) == '[') { 213 if (name.charAt(0) == '[') {