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)
{
updateThread = new PaneUpdaterThread(panelIndex, decompilerViewIndex) {
updateThread = new PaneUpdaterThread(panelIndex, decompilerViewIndex)
{
@Override
public void doShit() {
try {
public void doShit()
{
try
{
BytecodeViewer.viewer.updateBusyStatus(true);
if(ResourceViewPanel.this.decompilerViewIndex > 0)
@ -70,9 +73,11 @@ public class ResourceViewPanel
updateUpdaterTextArea = (SearchableRSyntaxTextArea) Configuration.rstaTheme.apply(new SearchableRSyntaxTextArea());
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(() ->
{
panel.add(updateUpdaterTextArea.getScrollPane());

View File

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

View File

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

View File

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