mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-14 20:31:56 +00:00
ABC Explorer - Context menu on ABCContainer, ScriptPack
This commit is contained in:
@@ -142,6 +142,19 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
View.setWindowIcon(this);
|
||||
View.centerScreen(this);
|
||||
}
|
||||
|
||||
public void selectAbc(ABC abc) {
|
||||
if (abc == null && !abcContainers.isEmpty()) {
|
||||
abcComboBox.setSelectedIndex(0);
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < abcContainers.size(); i++) {
|
||||
if (abcContainers.get(i).getABC() == abc) {
|
||||
abcComboBox.setSelectedIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ABC getSelectedAbc() {
|
||||
return abcContainers.get(abcComboBox.getSelectedIndex()).getABC();
|
||||
@@ -202,6 +215,26 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
mainTabbedPane.addTab("si (" + abc.script_info.size() + ")", makeTreePanel(abc, TreeType.SCRIPT_INFO));
|
||||
mainTabbedPane.addTab("mb (" + abc.bodies.size() + ")", makeTreePanel(abc, TreeType.METHOD_BODY));
|
||||
}
|
||||
|
||||
public void selectScriptInfo(int scriptIndex) {
|
||||
if (mainTabbedPane.getTabCount() > 0) {
|
||||
mainTabbedPane.setSelectedIndex(5);
|
||||
JPanel pan = (JPanel) mainTabbedPane.getComponentAt(5);
|
||||
FasterScrollPane fasterScrollPane = (FasterScrollPane) pan.getComponent(0);
|
||||
JTree tree = (JTree)fasterScrollPane.getViewport().getView();
|
||||
TreeModel model = tree.getModel();
|
||||
if (scriptIndex >= model.getChildCount(model.getRoot())) {
|
||||
return;
|
||||
}
|
||||
Object scriptInfoNode = model.getChild(model.getRoot(), scriptIndex);
|
||||
TreePath path = new TreePath(new Object[]{
|
||||
model.getRoot(),
|
||||
scriptInfoNode
|
||||
});
|
||||
tree.setSelectionPath(path);
|
||||
tree.scrollPathToVisible(path);
|
||||
}
|
||||
}
|
||||
|
||||
private JPanel makeTreePanel(ABC abc, TreeType type) {
|
||||
JTree tree = new JTree(new ExplorerTreeModel(abc, type));
|
||||
|
||||
Reference in New Issue
Block a user