Add Print Line Numbers Setting To Disassembler
Resolves https://github.com/Konloch/bytecode-viewer/pull/398#discussion_r826274523
This commit is contained in:
parent
cb6acf6c82
commit
498ea1d82b
5 changed files with 13 additions and 3 deletions
|
@ -200,6 +200,7 @@ public class SettingsSerializer
|
||||||
save(Configuration.python2Extra);
|
save(Configuration.python2Extra);
|
||||||
save(Configuration.python3Extra);
|
save(Configuration.python3Extra);
|
||||||
save(BytecodeViewer.viewer.getMinSdkVersion());
|
save(BytecodeViewer.viewer.getMinSdkVersion());
|
||||||
|
save(BytecodeViewer.viewer.printLineNumbers.isSelected());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
BytecodeViewer.handleException(e);
|
BytecodeViewer.handleException(e);
|
||||||
}
|
}
|
||||||
|
@ -397,6 +398,7 @@ public class SettingsSerializer
|
||||||
Configuration.python2Extra = asBoolean(139);
|
Configuration.python2Extra = asBoolean(139);
|
||||||
Configuration.python3Extra = asBoolean(140);
|
Configuration.python3Extra = asBoolean(140);
|
||||||
BytecodeViewer.viewer.minSdkVersionSpinner.setValue(asInt(141));
|
BytecodeViewer.viewer.minSdkVersionSpinner.setValue(asInt(141));
|
||||||
|
BytecodeViewer.viewer.printLineNumbers.setSelected(asBoolean(142));
|
||||||
}
|
}
|
||||||
catch (IndexOutOfBoundsException e)
|
catch (IndexOutOfBoundsException e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -227,7 +227,10 @@ public class InstructionPrinter implements Opcodes {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String printLineNumberNode(LineNumberNode lnn) {
|
protected String printLineNumberNode(LineNumberNode lnn) {
|
||||||
return "// line " + lnn.line;
|
if(BytecodeViewer.viewer.printLineNumbers.isSelected())
|
||||||
|
return "// line " + lnn.line;
|
||||||
|
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String printLabelNode(LabelNode label) {
|
protected String printLabelNode(LabelNode label) {
|
||||||
|
|
|
@ -212,6 +212,7 @@ public class MainViewerGUI extends JFrame
|
||||||
public SettingsDialog bytecodeDecompilerSettingsDialog;
|
public SettingsDialog bytecodeDecompilerSettingsDialog;
|
||||||
public final JCheckBoxMenuItem appendBracketsToLabels = new TranslatedJCheckBoxMenuItem("Append Brackets To Labels", TranslatedComponents.APPEND_BRACKETS_TO_LABEL);
|
public final JCheckBoxMenuItem appendBracketsToLabels = new TranslatedJCheckBoxMenuItem("Append Brackets To Labels", TranslatedComponents.APPEND_BRACKETS_TO_LABEL);
|
||||||
public JCheckBoxMenuItem debugHelpers = new TranslatedJCheckBoxMenuItem("Debug Helpers", TranslatedComponents.DEBUG_HELPERS);
|
public JCheckBoxMenuItem debugHelpers = new TranslatedJCheckBoxMenuItem("Debug Helpers", TranslatedComponents.DEBUG_HELPERS);
|
||||||
|
public final JCheckBoxMenuItem printLineNumbers = new TranslatedJCheckBoxMenuItem("Print Line Numbers", TranslatedComponents.PRINT_LINE_NUMBERS);
|
||||||
|
|
||||||
//FernFlower settings
|
//FernFlower settings
|
||||||
public final JMenu fernFlowerSettingsSecondaryMenu = new TranslatedJMenu("FernFlower Settings", TranslatedComponents.FERNFLOWER_SETTINGS);
|
public final JMenu fernFlowerSettingsSecondaryMenu = new TranslatedJMenu("FernFlower Settings", TranslatedComponents.FERNFLOWER_SETTINGS);
|
||||||
|
@ -658,6 +659,7 @@ public class MainViewerGUI extends JFrame
|
||||||
settingsMainMenu.add(useNewSettingsDialog ? bytecodeDecompilerSettings : bytecodeDecompilerSettingsSecondaryMenu);
|
settingsMainMenu.add(useNewSettingsDialog ? bytecodeDecompilerSettings : bytecodeDecompilerSettingsSecondaryMenu);
|
||||||
bytecodeDecompilerSettingsSecondaryMenu.add(debugHelpers);
|
bytecodeDecompilerSettingsSecondaryMenu.add(debugHelpers);
|
||||||
bytecodeDecompilerSettingsSecondaryMenu.add(appendBracketsToLabels);
|
bytecodeDecompilerSettingsSecondaryMenu.add(appendBracketsToLabels);
|
||||||
|
bytecodeDecompilerSettingsSecondaryMenu.add(printLineNumbers);
|
||||||
bytecodeDecompilerSettingsDialog = new SettingsDialog(bytecodeDecompilerSettingsSecondaryMenu, new JPanel());
|
bytecodeDecompilerSettingsDialog = new SettingsDialog(bytecodeDecompilerSettingsSecondaryMenu, new JPanel());
|
||||||
bytecodeDecompilerSettings.addActionListener((e)-> bytecodeDecompilerSettingsDialog.showDialog());
|
bytecodeDecompilerSettings.addActionListener((e)-> bytecodeDecompilerSettingsDialog.showDialog());
|
||||||
|
|
||||||
|
@ -837,6 +839,7 @@ public class MainViewerGUI extends JFrame
|
||||||
//CFIDE
|
//CFIDE
|
||||||
debugHelpers.setSelected(true);
|
debugHelpers.setSelected(true);
|
||||||
appendBracketsToLabels.setSelected(true);
|
appendBracketsToLabels.setSelected(true);
|
||||||
|
printLineNumbers.setSelected(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void calledAfterLoad() {
|
public void calledAfterLoad() {
|
||||||
|
|
|
@ -253,7 +253,8 @@ public enum TranslatedComponents
|
||||||
MIN_SDK_VERSION,
|
MIN_SDK_VERSION,
|
||||||
ANNOTATION_NAME,
|
ANNOTATION_NAME,
|
||||||
MATCH_CASE,
|
MATCH_CASE,
|
||||||
EXACT_PATH;
|
EXACT_PATH, PRINT_LINE_NUMBERS,
|
||||||
|
;
|
||||||
|
|
||||||
private final TranslatedComponentReference componentReference;
|
private final TranslatedComponentReference componentReference;
|
||||||
|
|
||||||
|
|
|
@ -284,5 +284,6 @@
|
||||||
"ANNOTATION_NAME": "Annotation Name",
|
"ANNOTATION_NAME": "Annotation Name",
|
||||||
"MATCH_CASE": "Match Case",
|
"MATCH_CASE": "Match Case",
|
||||||
"EXACT_PATH": "Exact Path",
|
"EXACT_PATH": "Exact Path",
|
||||||
"MIN_SDK_VERSION": "Minimum SDK version"
|
"MIN_SDK_VERSION": "Minimum SDK version",
|
||||||
|
"PRINT_LINE_NUMBERS": "Print Line Numbers"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue