From 57b9f0e2b392645d604684280c785c5a29a845df Mon Sep 17 00:00:00 2001 From: Nico Mexis Date: Tue, 20 Jul 2021 17:03:30 +0200 Subject: [PATCH] Warn user if no decompiler is selected --- .../gui/resourceviewer/viewer/ClassViewer.java | 11 ++++++++++- .../bytecodeviewer/translation/TranslatedStrings.java | 1 + .../club/bytecodeviewer/translation/Translation.java | 1 + src/main/resources/translations/english.json | 1 + src/main/resources/translations/german.json | 1 + 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/ClassViewer.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/ClassViewer.java index c94e44b4..7c4fbdfe 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/ClassViewer.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/ClassViewer.java @@ -26,6 +26,8 @@ import the.bytecode.club.bytecodeviewer.Configuration; import the.bytecode.club.bytecodeviewer.SettingsSerializer; import the.bytecode.club.bytecodeviewer.resources.Resource; import the.bytecode.club.bytecodeviewer.resources.ResourceContainer; +import the.bytecode.club.bytecodeviewer.translation.TranslatedStrings; +import the.bytecode.club.bytecodeviewer.translation.Translation; import the.bytecode.club.bytecodeviewer.util.MethodParser; import static the.bytecode.club.bytecodeviewer.util.MethodParser.Method; @@ -89,7 +91,14 @@ public class ClassViewer extends ResourceViewer { setPanes(); refreshTitle(); - + + // Warn user if no Decompiler is selected + if (bytecodeViewPanel1.decompiler == Decompiler.NONE + && bytecodeViewPanel2.decompiler == Decompiler.NONE + && bytecodeViewPanel3.decompiler == Decompiler.NONE) { + BytecodeViewer.showMessage(TranslatedStrings.SUGGESTED_FIX_NO_DECOMPILER_WARNING.getText()); + } + bytecodeViewPanel1.createPane(this); bytecodeViewPanel2.createPane(this); bytecodeViewPanel3.createPane(this); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/translation/TranslatedStrings.java b/src/main/java/the/bytecode/club/bytecodeviewer/translation/TranslatedStrings.java index ba363618..e9b90fe2 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/translation/TranslatedStrings.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/translation/TranslatedStrings.java @@ -84,6 +84,7 @@ public enum TranslatedStrings FIRST_OPEN_A_RESOURCE, FIRST_OPEN_A_CLASS, FIRST_VIEW_A_CLASS, + SUGGESTED_FIX_NO_DECOMPILER_WARNING, DRAG_CLASS_JAR, ; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/translation/Translation.java b/src/main/java/the/bytecode/club/bytecodeviewer/translation/Translation.java index e09f3706..93e888bc 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/translation/Translation.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/translation/Translation.java @@ -226,6 +226,7 @@ public enum Translation ERROR, SUGGESTED_FIX_DECOMPILER_ERROR, SUGGESTED_FIX_COMPILER_ERROR, + SUGGESTED_FIX_NO_DECOMPILER_WARNING, PROCYON_DECOMPILER, CFR_DECOMPILER, FERNFLOWER_DECOMPILER, diff --git a/src/main/resources/translations/english.json b/src/main/resources/translations/english.json index 9d01042a..8a740971 100644 --- a/src/main/resources/translations/english.json +++ b/src/main/resources/translations/english.json @@ -126,6 +126,7 @@ "NEW_JAVASCRIPT_PLUGIN": "New Javascript Plugin", "SUGGESTED_FIX_DECOMPILER_ERROR": "Suggested Fix: Click refresh class, if it fails again try another decompiler.", "SUGGESTED_FIX_COMPILER_ERROR": "Suggested Fix: Try View>Pane>Krakatau>Bytecode and enable Editable.", + "SUGGESTED_FIX_NO_DECOMPILER_WARNING": "WARNING: No decompiler is currently selected. Try View>Pane and choose a decompiler.", "COMPILER_TIP": "Keep in mind most decompilers cannot produce compilable classes", "FIRST_OPEN_A_RESOURCE": "First open a resource inside of BCV (class, jar, zip or apk file)", "FIRST_OPEN_A_CLASS": "First open a classfile resource inside of BCV (jar, zip, apk, dex)", diff --git a/src/main/resources/translations/german.json b/src/main/resources/translations/german.json index 6ad9e5bf..d97d79f7 100644 --- a/src/main/resources/translations/german.json +++ b/src/main/resources/translations/german.json @@ -93,6 +93,7 @@ "ERROR": "Fehler", "SUGGESTED_FIX_DECOMPILER_ERROR": "Vorgeschlagene Lösung: Klicken Sie auf Klasse aktualisieren und wenn es wieder fehlschlägt, versuchen Sie einen anderen Dekompilierer.", "SUGGESTED_FIX_COMPILER_ERROR": "Vorgeschlagene Lösung: Aktivieren Sie unter Ansicht>Fenster>Krakatau>Bytecode Editierbar.", + "SUGGESTED_FIX_NO_DECOMPILER_WARNING": "ACHTUNG: Derzeit ist kein Dekompilierer ausgewählt. Versuchen Sie unter Ansicht>Fenster einen Dekompilierer auszuwählen.", "FILES": "Dateien", "QUICK_FILE_SEARCH_NO_FILE_EXTENSION": "Dateien-Schnellsuche öffnen (ohne Dateiendungen)", "WORK_SPACE": "Arbeitsbereich",