diff options
| author | 2022-09-13 03:28:25 +1000 | |
|---|---|---|
| committer | 2022-09-12 18:28:25 +0100 | |
| commit | 0a80622efae2fd54df3ed991eb856b3718d6820c (patch) | |
| tree | 260cc7e50b4b1fa6f51dba1da38c1516632a1765 /enigma | |
| parent | Ensure the root method is used when mapping specialized methods (#459) (diff) | |
| download | enigma-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.java | 29 |
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 | ||
| 12 | package cuchaz.enigma.translation.representation.entry; | 12 | package cuchaz.enigma.translation.representation.entry; |
| 13 | 13 | ||
| 14 | import java.util.List; | ||
| 15 | import java.util.Objects; | ||
| 16 | |||
| 17 | import javax.annotation.Nonnull; | ||
| 18 | import javax.annotation.Nullable; | ||
| 19 | |||
| 20 | import cuchaz.enigma.source.RenamableTokenType; | 14 | import cuchaz.enigma.source.RenamableTokenType; |
| 21 | import cuchaz.enigma.translation.TranslateResult; | 15 | import cuchaz.enigma.translation.TranslateResult; |
| 22 | import cuchaz.enigma.translation.Translator; | 16 | import cuchaz.enigma.translation.Translator; |
| @@ -25,6 +19,11 @@ import cuchaz.enigma.translation.mapping.IdentifierValidation; | |||
| 25 | import cuchaz.enigma.translation.representation.TypeDescriptor; | 19 | import cuchaz.enigma.translation.representation.TypeDescriptor; |
| 26 | import cuchaz.enigma.utils.validation.ValidationContext; | 20 | import cuchaz.enigma.utils.validation.ValidationContext; |
| 27 | 21 | ||
| 22 | import javax.annotation.Nonnull; | ||
| 23 | import javax.annotation.Nullable; | ||
| 24 | import java.util.List; | ||
| 25 | import java.util.Objects; | ||
| 26 | |||
| 28 | public class ClassEntry extends ParentedEntry<ClassEntry> implements Comparable<ClassEntry> { | 27 | public 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) == '[') { |