saving last selected trace replacement

This commit is contained in:
Jindra Petřík
2014-10-28 18:29:47 +01:00
parent 925dfc4622
commit cd2adfc3e3
5 changed files with 56 additions and 20 deletions

View File

@@ -193,7 +193,7 @@ public class Configuration {
public static final ConfigurationItem<Integer> decompilationTimeoutSingleMethod = null;
@ConfigurationDefaultInt(1)
public static final ConfigurationItem<Integer> lastRenameType = null;
@ConfigurationDefaultString(".")
public static final ConfigurationItem<String> lastSaveDir = null;
@@ -352,6 +352,9 @@ public class Configuration {
@ConfigurationDefaultBoolean(true)
public static final ConfigurationItem<Boolean> displayDebuggerInfo = null;
@ConfigurationDefaultString("debugConsole")
public static final ConfigurationItem<String> lastDebuggerReplaceFunction = null;
private enum OSId {
WINDOWS, OSX, UNIX

View File

@@ -699,11 +699,12 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener {
Main.debuggerShowLog();
break;
case ACTION_DEBUGGER_REPLACE_TRACE:
ReplaceTraceDialog rtd = new ReplaceTraceDialog(mainFrame);
ReplaceTraceDialog rtd = new ReplaceTraceDialog(mainFrame,Configuration.lastDebuggerReplaceFunction.get());
rtd.setVisible(true);
if(rtd.getResult()!=null){
Main.replaceTraceCalls(rtd.getResult());
if(rtd.getValue()!=null){
Main.replaceTraceCalls(rtd.getValue());
mainFrame.panel.refreshDecompiled();
Configuration.lastDebuggerReplaceFunction.set(rtd.getValue());
}
break;
case ACTION_RELOAD:

View File

@@ -22,6 +22,7 @@ import java.awt.FlowLayout;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Arrays;
import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
@@ -36,16 +37,34 @@ public class ReplaceTraceDialog extends AppDialog {
private JRadioButton debugAlertRadio;
private JRadioButton debugConsoleRadio;
private JRadioButton debugProxyRadio;
private JRadioButton debugSocketRadio;
private String result = null;
private String value = null;
public String getResult() {
return result;
private void setValue(String val){
if(val == null){
return;
}
switch(val){
case "debugAlert":
debugAlertRadio.setSelected(true);
break;
case "debugConsole":
debugConsoleRadio.setSelected(true);
break;
case "debugSocket":
debugSocketRadio.setSelected(true);
break;
}
}
public ReplaceTraceDialog(Window owner) {
super(owner);
public String getValue() {
return value;
}
public ReplaceTraceDialog(Window owner,String defaultVal) {
super(owner);
setTitle(translate("dialog.title"));
Container cnt=getContentPane();
cnt.setLayout(new BoxLayout(cnt, BoxLayout.Y_AXIS));
@@ -53,21 +72,21 @@ public class ReplaceTraceDialog extends AppDialog {
debugAlertRadio.setAlignmentX(0);
debugConsoleRadio = new JRadioButton(translate("function.debugConsole"));
debugConsoleRadio.setAlignmentX(0);
debugProxyRadio = new JRadioButton(translate("function.debugSocket"));
debugProxyRadio.setAlignmentX(0);
debugSocketRadio = new JRadioButton(translate("function.debugSocket"));
debugSocketRadio.setAlignmentX(0);
debugAlertRadio.setSelected(true);
ButtonGroup bg = new ButtonGroup();
bg.add(debugAlertRadio);
bg.add(debugConsoleRadio);
bg.add(debugProxyRadio);
bg.add(debugSocketRadio);
cnt.add(debugAlertRadio);
cnt.add(debugConsoleRadio);
cnt.add(debugProxyRadio);
cnt.add(debugSocketRadio);
JPanel buttonsPanel = new JPanel(new FlowLayout());
JButton okButton=new JButton(AppStrings.translate("button.ok"));
@@ -76,13 +95,13 @@ public class ReplaceTraceDialog extends AppDialog {
@Override
public void actionPerformed(ActionEvent e) {
if(debugAlertRadio.isSelected()){
result = "debugAlert";
value = "debugAlert";
}
if(debugConsoleRadio.isSelected()){
result = "debugConsole";
value = "debugConsole";
}
if(debugProxyRadio.isSelected()){
result = "debugSocket";
if(debugSocketRadio.isSelected()){
value = "debugSocket";
}
setVisible(false);
}
@@ -92,7 +111,7 @@ public class ReplaceTraceDialog extends AppDialog {
@Override
public void actionPerformed(ActionEvent e) {
result = null;
value = null;
setVisible(false);
}
});
@@ -104,6 +123,7 @@ public class ReplaceTraceDialog extends AppDialog {
pack();
View.setWindowIcon(this);
View.centerScreen(this);
setValue(defaultVal);
}
}

View File

@@ -280,4 +280,7 @@ config.name.displayDebuggerInfo = (Internal) Display debugger info
config.description.displayDebuggerInfo = Display info about debugger before switching it
config.name.randomDebuggerPackage = Use random package name for Debugger
config.description.randomDebuggerPackage = This renames Debugger package to random string which makes debugger presence harder to detect by ActionScript
config.description.randomDebuggerPackage = This renames Debugger package to random string which makes debugger presence harder to detect by ActionScript
config.name.lastDebuggerReplaceFunction = (Internal) Last selected trace replacement
config.description.lastDebuggerReplaceFunction = Function name which was last selected in replace trace function with debugger

View File

@@ -271,3 +271,12 @@ config.description.export.zoom = Naposledy pou\u017eit\u00e9 nastaven\u00ed p\u0
config.name.debuggerPort = Port Debuggeru
config.description.debuggerPort = Port pou\u017e\u00edvan\u00fd pro lad\u011bn\u00ed p\u0159es sockety
config.name.displayDebuggerInfo = (Internal) Zobrazit informace o debuggeru
config.description.displayDebuggerInfo = Zobraz\u00ed informace o debuggeru p\u0159edt\u00edm, ne\u017e je zapnut
config.name.randomDebuggerPackage = Pou\u017e\u00edt n\u00e1hodn\u00e9 jm\u00e9no bal\u00ed\u010dku pro Debugger
config.description.randomDebuggerPackage = Toto p\u0159ejmenuje bal\u00ed\u010dek debuggeru na n\u00e1hodn\u00fd \u0159et\u011bzec co\u017e zt\u00ed\u017e\u00ed detekci ActionScriptem
config.name.lastDebuggerReplaceFunction = (Internal) Last selected trace replacement
config.description.lastDebuggerReplaceFunction = Function name which was last selected in replace trace function with debugger