Quick Edit
This adds quick edit and fixes a bug with the quick decompile displaying as editable
This commit is contained in:
parent
2c57424674
commit
5f72bc435a
3 changed files with 68 additions and 1 deletions
|
@ -270,20 +270,34 @@ public class ResourceListPane extends TranslatedVisibleComponent implements File
|
||||||
}
|
}
|
||||||
|
|
||||||
public void quickDecompile(Decompiler decompiler, TreePath selPath)
|
public void quickDecompile(Decompiler decompiler, TreePath selPath)
|
||||||
|
{
|
||||||
|
quickDecompile(decompiler, selPath, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void quickDecompile(Decompiler decompiler, TreePath selPath, boolean quickEdit)
|
||||||
{
|
{
|
||||||
Decompiler tempDecompiler1 = BytecodeViewer.viewer.viewPane1.getSelectedDecompiler();
|
Decompiler tempDecompiler1 = BytecodeViewer.viewer.viewPane1.getSelectedDecompiler();
|
||||||
|
boolean editable1 = BytecodeViewer.viewer.viewPane1.isPaneEditable();
|
||||||
Decompiler tempDecompiler2 = BytecodeViewer.viewer.viewPane2.getSelectedDecompiler();
|
Decompiler tempDecompiler2 = BytecodeViewer.viewer.viewPane2.getSelectedDecompiler();
|
||||||
|
boolean editable2 = BytecodeViewer.viewer.viewPane2.isPaneEditable();
|
||||||
Decompiler tempDecompiler3 = BytecodeViewer.viewer.viewPane3.getSelectedDecompiler();
|
Decompiler tempDecompiler3 = BytecodeViewer.viewer.viewPane3.getSelectedDecompiler();
|
||||||
|
boolean editable3 = BytecodeViewer.viewer.viewPane3.isPaneEditable();
|
||||||
|
|
||||||
BytecodeViewer.viewer.viewPane1.setSelectedDecompiler(decompiler);
|
BytecodeViewer.viewer.viewPane1.setSelectedDecompiler(decompiler);
|
||||||
|
BytecodeViewer.viewer.viewPane1.setPaneEditable(quickEdit);
|
||||||
BytecodeViewer.viewer.viewPane2.setSelectedDecompiler(Decompiler.NONE);
|
BytecodeViewer.viewer.viewPane2.setSelectedDecompiler(Decompiler.NONE);
|
||||||
|
BytecodeViewer.viewer.viewPane2.setPaneEditable(false);
|
||||||
BytecodeViewer.viewer.viewPane3.setSelectedDecompiler(Decompiler.NONE);
|
BytecodeViewer.viewer.viewPane3.setSelectedDecompiler(Decompiler.NONE);
|
||||||
|
BytecodeViewer.viewer.viewPane3.setPaneEditable(false);
|
||||||
|
|
||||||
openPath(selPath);
|
openPath(selPath);
|
||||||
|
|
||||||
BytecodeViewer.viewer.viewPane1.setSelectedDecompiler(tempDecompiler1);
|
BytecodeViewer.viewer.viewPane1.setSelectedDecompiler(tempDecompiler1);
|
||||||
|
BytecodeViewer.viewer.viewPane1.setPaneEditable(editable1);
|
||||||
BytecodeViewer.viewer.viewPane2.setSelectedDecompiler(tempDecompiler2);
|
BytecodeViewer.viewer.viewPane2.setSelectedDecompiler(tempDecompiler2);
|
||||||
|
BytecodeViewer.viewer.viewPane2.setPaneEditable(editable2);
|
||||||
BytecodeViewer.viewer.viewPane3.setSelectedDecompiler(tempDecompiler3);
|
BytecodeViewer.viewer.viewPane3.setSelectedDecompiler(tempDecompiler3);
|
||||||
|
BytecodeViewer.viewer.viewPane3.setPaneEditable(editable3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openPath(TreePath path)
|
public void openPath(TreePath path)
|
||||||
|
|
|
@ -40,9 +40,10 @@ public class ContextMenu
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
addContext(new New());
|
addContext(new New());
|
||||||
addContext(new Remove());
|
addContext(new Remove()); //TODO rename to delete and add support for resources & whole parent nodes (directories)
|
||||||
addContext(new Open());
|
addContext(new Open());
|
||||||
addContext(new QuickOpen());
|
addContext(new QuickOpen());
|
||||||
|
addContext(new QuickEdit());
|
||||||
addContext(new Expand());
|
addContext(new Expand());
|
||||||
addContext(new Collapse());
|
addContext(new Collapse());
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
package the.bytecode.club.bytecodeviewer.gui.resourcelist.contextmenu.impl;
|
||||||
|
|
||||||
|
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||||
|
import the.bytecode.club.bytecodeviewer.decompilers.Decompiler;
|
||||||
|
import the.bytecode.club.bytecodeviewer.gui.resourcelist.contextmenu.ContextMenuItem;
|
||||||
|
import the.bytecode.club.bytecodeviewer.gui.resourcelist.contextmenu.ContextMenuType;
|
||||||
|
import the.bytecode.club.bytecodeviewer.translation.TranslatedStrings;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
|
||||||
|
* Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com *
|
||||||
|
* *
|
||||||
|
* This program is free software: you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Konloch
|
||||||
|
* @since 7/27/2021
|
||||||
|
*/
|
||||||
|
public class QuickEdit extends ContextMenuItem
|
||||||
|
{
|
||||||
|
public QuickEdit()
|
||||||
|
{
|
||||||
|
super(ContextMenuType.RESOURCE, ((tree, selPath, menu) ->
|
||||||
|
{
|
||||||
|
JMenu quickOpen = new JMenu("Quick Edit");
|
||||||
|
quickOpen.add(createMenu(TranslatedStrings.KRAKATAU.toString(), ()->
|
||||||
|
BytecodeViewer.viewer.resourcePane.quickDecompile(Decompiler.KRAKATAU_DISASSEMBLER, selPath, true)));
|
||||||
|
menu.add(quickOpen);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static JMenuItem createMenu(String name, Runnable onClick)
|
||||||
|
{
|
||||||
|
JMenuItem menu = new JMenuItem(name);
|
||||||
|
menu.addActionListener((e)->onClick.run());
|
||||||
|
return menu;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue