feat(gui): add script log open button

This commit is contained in:
Skylot
2023-02-28 16:02:33 +00:00
parent 780b1a0d53
commit 7d69e5aaab
13 changed files with 25 additions and 4 deletions
+4
View File
@@ -46,6 +46,10 @@ dependencies {
testImplementation project(":jadx-core").sourceSets.test.output
}
test {
exclude '**/tmp/*'
}
application {
applicationName = 'jadx-gui'
mainClass.set('jadx.gui.JadxGUI')
@@ -108,6 +108,8 @@ public class ScriptContentPanel extends AbstractCodeContentPanel {
check.addActionListener(ev -> checkScript());
JButton format = new JButton(NLS.str("script.format"), Icons.FORMAT);
format.addActionListener(ev -> reformatCode());
JButton scriptLog = new JButton(NLS.str("script.log"), Icons.FORMAT);
scriptLog.addActionListener(ev -> showScriptLog());
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS));
@@ -122,6 +124,7 @@ public class ScriptContentPanel extends AbstractCodeContentPanel {
panel.add(Box.createRigidArea(new Dimension(30, 0)));
panel.add(resultLabel);
panel.add(Box.createHorizontalGlue());
panel.add(scriptLog);
return panel;
}
@@ -178,9 +181,11 @@ public class ScriptContentPanel extends AbstractCodeContentPanel {
errorService.apply();
if (!success) {
resultLabel.setText("Compiler issues: " + issues.size());
getTabbedPane().getMainWindow().showLogViewer(LogOptions.forScript(getNode().getName()));
showScriptLog();
} else if (!lintErrs.isEmpty()) {
resultLabel.setText("Lint issues: " + lintErrs.size());
} else {
resultLabel.setText("OK");
}
return success;
} catch (Throwable e) {
@@ -230,6 +235,10 @@ public class ScriptContentPanel extends AbstractCodeContentPanel {
scriptArea.loadSettings();
}
private void showScriptLog() {
getTabbedPane().getMainWindow().showLogViewer(LogOptions.forScript(getNode().getName()));
}
@Override
public AbstractCodeArea getCodeArea() {
return scriptArea;
@@ -1,5 +1,5 @@
/**
For script usage check https://github.com/skylot/jadx/blob/master/jadx-plugins/jadx-script/readme.md
* For script usage check https://github.com/skylot/jadx/blob/master/jadx-plugins/jadx-script/README.md
*/
val jadx = getJadxInstance()
@@ -259,6 +259,7 @@ popup.search_global=Globale Suche "%s"
#script.save=Save
#script.check=Check
#script.format=Reformat
#script.log=Show log
exclude_dialog.title=Paketauswahl
exclude_dialog.ok=OK
@@ -259,6 +259,7 @@ script.run=Run
script.save=Save
script.check=Check
script.format=Reformat
script.log=Show log
exclude_dialog.title=Package Selector
exclude_dialog.ok=OK
@@ -259,6 +259,7 @@ popup.rename=Nimeta ümber
#script.save=Save
#script.check=Check
#script.format=Reformat
#script.log=Show log
#exclude_dialog.title=Package Selector
#exclude_dialog.ok=OK
@@ -259,6 +259,7 @@ popup.search_global="%s" 전역 검색
#script.save=Save
#script.check=Check
#script.format=Reformat
#script.log=Show log
exclude_dialog.title=패키지 선택기
exclude_dialog.ok=확인
@@ -259,6 +259,7 @@ popup.search_global=Busca global "%s"
#script.save=Save
#script.check=Check
#script.format=Reformat
#script.log=Show log
exclude_dialog.title=Selecionar pacote
exclude_dialog.ok=OK
@@ -259,6 +259,7 @@ popup.search_global=Глобальный поиск "%s"
#script.save=Save
#script.check=Check
#script.format=Reformat
#script.log=Show log
exclude_dialog.title=Выбор пакетов
exclude_dialog.ok=OK
@@ -259,6 +259,7 @@ popup.search_global=全局搜索 “%s”
#script.save=Save
#script.check=Check
#script.format=Reformat
#script.log=Show log
exclude_dialog.title=选择要排除的包
exclude_dialog.ok=确定
@@ -259,6 +259,7 @@ popup.search_global=全域搜尋 "%s"
#script.save=Save
#script.check=Check
#script.format=Reformat
#script.log=Show log
exclude_dialog.title=套件選擇
exclude_dialog.ok=OK
@@ -16,7 +16,7 @@ jadx.gui.ifAvailable {
"Custom Frida snippet (g)",
enabled = ::isActionEnabled,
keyBinding = "G",
action = ::runAction
action = ::runAction,
)
}
@@ -69,7 +69,7 @@ class ScriptEval {
Severity.FATAL, Severity.ERROR -> log.error(r.exception) { "Script execution error: $msg" }
Severity.WARNING -> log.warn { "Script execution issue: $msg" }
Severity.INFO -> log.info { "Script report: $msg" }
Severity.DEBUG -> log.debug { "Script report: $msg" }
Severity.DEBUG -> {} /* ignore, too verbose */
}
}
when (res) {