From 0e3894751b711720659be546bef04d6f87c2485d Mon Sep 17 00:00:00 2001 From: Konloch Date: Sun, 29 Sep 2024 09:56:05 -0600 Subject: [PATCH] Syntax Cleanup --- .../bytecodeviewer/bootloader/BootState.java | 4 +++- .../bootloader/resource/jar/JarType.java | 9 +++----- .../club/bytecodeviewer/cli/CLIAction.java | 2 +- .../components/DecompilerViewComponent.java | 6 ++++- .../gui/contextmenu/ContextMenuType.java | 6 ++++- .../gui/contextmenu/resourcelist/New.java | 4 +++- .../gui/hexviewer/GoToBinaryPositionMode.java | 4 +++- .../gui/hexviewer/ValuesPanel.java | 17 +++++++++++++- .../resources/exporting/Export.java | 5 ++++- .../resources/importing/Import.java | 22 +++++++++++-------- 10 files changed, 56 insertions(+), 23 deletions(-) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/BootState.java b/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/BootState.java index 1962c8be..d1c88342 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/BootState.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/BootState.java @@ -25,5 +25,7 @@ package the.bytecode.club.bytecodeviewer.bootloader; public enum BootState { - START_UP, SETTINGS_LOADED, GUI_SHOWING, + START_UP, + SETTINGS_LOADED, + GUI_SHOWING; } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/resource/jar/JarType.java b/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/resource/jar/JarType.java index edd19420..6a0873d0 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/resource/jar/JarType.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/resource/jar/JarType.java @@ -27,13 +27,10 @@ package the.bytecode.club.bytecodeviewer.bootloader.resource.jar; public enum JarType { - /** - * Local file - **/ + //Local file FILE("file:"), - /** - * External URL - **/ + + //External URL WEB(""); private final String prefix; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/cli/CLIAction.java b/src/main/java/the/bytecode/club/bytecodeviewer/cli/CLIAction.java index a470090b..9bc299af 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/cli/CLIAction.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/cli/CLIAction.java @@ -8,5 +8,5 @@ public enum CLIAction { STOP, GUI, - CLI + CLI; } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/DecompilerViewComponent.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/DecompilerViewComponent.java index bf01013e..f08289c0 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/DecompilerViewComponent.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/DecompilerViewComponent.java @@ -113,6 +113,10 @@ public class DecompilerViewComponent public enum DecompilerComponentType { - JAVA, JAVA_NON_EDITABLE, BYTECODE, BYTECODE_NON_EDITABLE, JAVA_AND_BYTECODE + JAVA, + JAVA_NON_EDITABLE, + BYTECODE, + BYTECODE_NON_EDITABLE, + JAVA_AND_BYTECODE; } } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/contextmenu/ContextMenuType.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/contextmenu/ContextMenuType.java index 69f6f0c0..5b22ad65 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/contextmenu/ContextMenuType.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/contextmenu/ContextMenuType.java @@ -24,5 +24,9 @@ package the.bytecode.club.bytecodeviewer.gui.contextmenu; */ public enum ContextMenuType { - RESOURCE_LIST, RESOURCE, DIRECTORY, CONTAINER, SEARCH_BOX_RESULT, + RESOURCE_LIST, + RESOURCE, + DIRECTORY, + CONTAINER, + SEARCH_BOX_RESULT; } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/contextmenu/resourcelist/New.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/contextmenu/resourcelist/New.java index 43184028..643fee89 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/contextmenu/resourcelist/New.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/contextmenu/resourcelist/New.java @@ -166,6 +166,8 @@ public class New extends ContextMenuItem public enum FileType { - CLASS, FILE, DIRECTORY, + CLASS, + FILE, + DIRECTORY; } } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/GoToBinaryPositionMode.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/GoToBinaryPositionMode.java index 3a17b6b7..063fb437 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/GoToBinaryPositionMode.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/GoToBinaryPositionMode.java @@ -27,12 +27,14 @@ public enum GoToBinaryPositionMode * Count from start of the document. */ FROM_START, + /** * Count from end of the document. */ FROM_END, + /** * Count from current position of the cursor in the document. */ - FROM_CURSOR + FROM_CURSOR; } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/ValuesPanel.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/ValuesPanel.java index 134dab01..a9f34f4d 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/ValuesPanel.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/ValuesPanel.java @@ -757,7 +757,22 @@ public class ValuesPanel extends javax.swing.JPanel public enum ValuesPanelField { - BINARY0, BINARY1, BINARY2, BINARY3, BINARY4, BINARY5, BINARY6, BINARY7, BYTE, WORD, INTEGER, LONG, FLOAT, DOUBLE, CHARACTER, STRING + BINARY0, + BINARY1, + BINARY2, + BINARY3, + BINARY4, + BINARY5, + BINARY6, + BINARY7, + BYTE, + WORD, + INTEGER, + LONG, + FLOAT, + DOUBLE, + CHARACTER, + STRING } @ParametersAreNonnullByDefault diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/resources/exporting/Export.java b/src/main/java/the/bytecode/club/bytecodeviewer/resources/exporting/Export.java index 75da9e3b..9dadf8dd 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/resources/exporting/Export.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/resources/exporting/Export.java @@ -29,7 +29,10 @@ import the.bytecode.club.bytecodeviewer.resources.exporting.impl.ZipExport; */ public enum Export { - RUNNABLE_JAR(new RunnableJarExporter()), ZIP(new ZipExport()), DEX(new DexExport()), APK(new APKExport()); + RUNNABLE_JAR(new RunnableJarExporter()), + ZIP(new ZipExport()), + DEX(new DexExport()), + APK(new APKExport()); private final Exporter exporter; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/resources/importing/Import.java b/src/main/java/the/bytecode/club/bytecodeviewer/resources/importing/Import.java index f774f95e..2de85240 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/resources/importing/Import.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/resources/importing/Import.java @@ -26,12 +26,18 @@ import java.util.HashMap; * @author Konloch * @since 6/26/2021 */ + public enum Import { - DIRECTORY(new DirectoryResourceImporter()), FILE(new FileResourceImporter()), //TODO ear needs to import the same as XAPK -//TODO war needs to add the /libs correctly similar to XAPK -ZIP(new ZipResourceImporter(), "zip", "jar", "war", "ear"), CLASS(new ClassResourceImporter(), "class"), XAPK(new XAPKResourceImporter(), "xapk"), APK(new APKResourceImporter(), "apk"), DEX(new DEXResourceImporter(), "dex"), - ; + DIRECTORY(new DirectoryResourceImporter()), + FILE(new FileResourceImporter()), + //TODO ear needs to import the same as XAPK + //TODO war needs to add the /libs correctly similar to XAPK + ZIP(new ZipResourceImporter(), "zip", "jar", "war", "ear"), + CLASS(new ClassResourceImporter(), "class"), + XAPK(new XAPKResourceImporter(), "xapk"), + APK(new APKResourceImporter(), "apk"), + DEX(new DEXResourceImporter(), "dex"); public static final HashMap extensionMap = new HashMap<>(); @@ -40,14 +46,12 @@ ZIP(new ZipResourceImporter(), "zip", "jar", "war", "ear"), CLASS(new ClassResou static { - for (Import i : values()) - for (String s : i.extensions) + for(Import i : values()) + for(String s : i.extensions) extensionMap.put(s, i); } - Import(Importer importer, String... extensions) - { - this.importer = importer; + Import(Importer importer, String... extensions) {this.importer = importer; this.extensions = extensions; }