|
| 1 | +package the.bytecode.club.bytecodeviewer.gui.resourcelist.contextmenu.impl; |
| 2 | + |
| 3 | +import the.bytecode.club.bytecodeviewer.BytecodeViewer; |
| 4 | +import the.bytecode.club.bytecodeviewer.decompilers.Decompiler; |
| 5 | +import the.bytecode.club.bytecodeviewer.gui.resourcelist.contextmenu.ContextMenuItem; |
| 6 | +import the.bytecode.club.bytecodeviewer.gui.resourcelist.contextmenu.ContextMenuType; |
| 7 | +import the.bytecode.club.bytecodeviewer.translation.TranslatedStrings; |
| 8 | + |
| 9 | +import javax.swing.*; |
| 10 | + |
| 11 | +/*************************************************************************** |
| 12 | + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * |
| 13 | + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * |
| 14 | + * * |
| 15 | + * This program is free software: you can redistribute it and/or modify * |
| 16 | + * it under the terms of the GNU General Public License as published by * |
| 17 | + * the Free Software Foundation, either version 3 of the License, or * |
| 18 | + * (at your option) any later version. * |
| 19 | + * * |
| 20 | + * This program is distributed in the hope that it will be useful, * |
| 21 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 22 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 23 | + * GNU General Public License for more details. * |
| 24 | + * * |
| 25 | + * You should have received a copy of the GNU General Public License * |
| 26 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. * |
| 27 | + ***************************************************************************/ |
| 28 | + |
| 29 | +/** |
| 30 | + * @author Konloch |
| 31 | + * @since 7/27/2021 |
| 32 | + */ |
| 33 | +public class QuickEdit extends ContextMenuItem |
| 34 | +{ |
| 35 | + public QuickEdit() |
| 36 | + { |
| 37 | + super(ContextMenuType.RESOURCE, ((tree, selPath, menu) -> |
| 38 | + { |
| 39 | + JMenu quickOpen = new JMenu("Quick Edit"); |
| 40 | + quickOpen.add(createMenu(TranslatedStrings.KRAKATAU.toString(), ()-> |
| 41 | + BytecodeViewer.viewer.resourcePane.quickDecompile(Decompiler.KRAKATAU_DISASSEMBLER, selPath, true))); |
| 42 | + menu.add(quickOpen); |
| 43 | + })); |
| 44 | + } |
| 45 | + |
| 46 | + private static JMenuItem createMenu(String name, Runnable onClick) |
| 47 | + { |
| 48 | + JMenuItem menu = new JMenuItem(name); |
| 49 | + menu.addActionListener((e)->onClick.run()); |
| 50 | + return menu; |
| 51 | + } |
| 52 | +} |
0 commit comments