Renamed TabExitButton

This commit is contained in:
Konloch 2021-06-25 19:11:43 -07:00
parent a0f7acdbeb
commit 476e53def5
4 changed files with 24 additions and 19 deletions

View file

@ -45,10 +45,13 @@ public class ResourceViewPanel
public void updatePane(ClassViewer cv, byte[] b, JButton button, boolean isPanelEditable) public void updatePane(ClassViewer cv, byte[] b, JButton button, boolean isPanelEditable)
{ {
updateThread = new PaneUpdaterThread(panelIndex, decompilerViewIndex) { updateThread = new PaneUpdaterThread(panelIndex, decompilerViewIndex)
{
@Override @Override
public void doShit() { public void doShit()
try { {
try
{
BytecodeViewer.viewer.updateBusyStatus(true); BytecodeViewer.viewer.updateBusyStatus(true);
if(ResourceViewPanel.this.decompilerViewIndex > 0) if(ResourceViewPanel.this.decompilerViewIndex > 0)
@ -70,9 +73,11 @@ public class ResourceViewPanel
updateUpdaterTextArea = (SearchableRSyntaxTextArea) Configuration.rstaTheme.apply(new SearchableRSyntaxTextArea()); updateUpdaterTextArea = (SearchableRSyntaxTextArea) Configuration.rstaTheme.apply(new SearchableRSyntaxTextArea());
final Decompiler decompiler = Decompiler.decompilersByIndex.get(ResourceViewPanel.this.decompilerViewIndex); final Decompiler decompiler = Decompiler.decompilersByIndex.get(ResourceViewPanel.this.decompilerViewIndex);
final String decompiledSource = decompiler.getDecompiler().decompileClassNode(cv.cn, b);
//decompilerUpdate.update(decompiler.getDecompilerName(), cv.cn, b, decompiler.getDecompiler(), updateUpdaterTextArea);
//perform decompiling inside of this thread
final String decompiledSource = decompiler.getDecompiler().decompileClassNode(cv.cn, b);
//set the swing components on the swing thread
SwingUtilities.invokeLater(() -> SwingUtilities.invokeLater(() ->
{ {
panel.add(updateUpdaterTextArea.getScrollPane()); panel.add(updateUpdaterTextArea.getScrollPane());

View file

@ -10,13 +10,13 @@ import java.awt.event.ActionListener;
* @author Konloch * @author Konloch
* @since 6/25/2021 * @since 6/25/2021
*/ */
public class TabButton extends JButton implements ActionListener public class TabExitButton extends JButton implements ActionListener
{ {
private final TabbedPane tabbedPane; private final TabbedPane tabbedPane;
private final int tabIndex; private final int tabIndex;
private final String tabWorkingName; private final String tabWorkingName;
public TabButton(TabbedPane tabbedPane, int tabIndex, String tabWorkingName) public TabExitButton(TabbedPane tabbedPane, int tabIndex, String tabWorkingName)
{ {
this.tabbedPane = tabbedPane; this.tabbedPane = tabbedPane;
this.tabIndex = tabIndex; this.tabIndex = tabIndex;

View file

@ -73,8 +73,8 @@ public class TabbedPane extends JPanel
// add more space between the label and the button // add more space between the label and the button
label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
// tab button // tab button
JButton button = new TabButton(this, tabIndex, tabWorkingName); JButton exitButton = new TabExitButton(this, tabIndex, tabWorkingName);
this.add(button); this.add(exitButton);
// add more space to the top of the component // add more space to the top of the component
setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0)); setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
@ -87,8 +87,8 @@ public class TabbedPane extends JPanel
rightClickMenu.add(closeTab); rightClickMenu.add(closeTab);
//setComponentPopupMenu(rightClickMenu); //setComponentPopupMenu(rightClickMenu);
button.setComponentPopupMenu(rightClickMenu); exitButton.setComponentPopupMenu(rightClickMenu);
button.addMouseListener(new MouseClickedListener(e -> exitButton.addMouseListener(new MouseClickedListener(e ->
{ {
if (e.getModifiers() != InputEvent.ALT_MASK || System.currentTimeMillis() - lastMouseClick < 100) if (e.getModifiers() != InputEvent.ALT_MASK || System.currentTimeMillis() - lastMouseClick < 100)
return; return;
@ -101,16 +101,16 @@ public class TabbedPane extends JPanel
closeTab.addActionListener(e -> closeTab.addActionListener(e ->
{ {
TabButton tabButton = (TabButton) ((JPopupMenu)((JMenuItem) e.getSource()).getParent()).getInvoker(); TabExitButton tabExitButton = (TabExitButton) ((JPopupMenu)((JMenuItem) e.getSource()).getParent()).getInvoker();
final int index = tabButton.getTabIndex(); final int index = tabExitButton.getTabIndex();
if (index != -1) if (index != -1)
existingTabs.remove(index); existingTabs.remove(index);
}); });
closeAllTabs.addActionListener(e -> closeAllTabs.addActionListener(e ->
{ {
TabButton tabButton = (TabButton) ((JPopupMenu)((JMenuItem) e.getSource()).getParent()).getInvoker(); TabExitButton tabExitButton = (TabExitButton) ((JPopupMenu)((JMenuItem) e.getSource()).getParent()).getInvoker();
final int index = tabButton.getTabIndex(); final int index = tabExitButton.getTabIndex();
while (true) while (true)
{ {

View file

@ -67,16 +67,16 @@ public class WorkPaneMainComponent extends VisibleComponent
JMenuItem closeTab = new JMenuItem("Close Tab"); JMenuItem closeTab = new JMenuItem("Close Tab");
closeTab.addActionListener(e -> closeTab.addActionListener(e ->
{ {
TabButton tabButton = (TabButton) ((JPopupMenu)((JMenuItem) e.getSource()).getParent()).getInvoker(); TabExitButton tabExitButton = (TabExitButton) ((JPopupMenu)((JMenuItem) e.getSource()).getParent()).getInvoker();
final int index = tabButton.getTabIndex(); final int index = tabExitButton.getTabIndex();
if (index != -1) if (index != -1)
tabs.remove(index); tabs.remove(index);
}); });
closeAllTabs.addActionListener(e -> closeAllTabs.addActionListener(e ->
{ {
TabButton tabButton = (TabButton) ((JPopupMenu)((JMenuItem) e.getSource()).getParent()).getInvoker(); TabExitButton tabExitButton = (TabExitButton) ((JPopupMenu)((JMenuItem) e.getSource()).getParent()).getInvoker();
final int index = tabButton.getTabIndex(); final int index = tabExitButton.getTabIndex();
while (true) while (true)
{ {