Cleanup TabComponent Close Pane
This commit is contained in:
parent
68da280933
commit
88ae27a94a
|
@ -70,10 +70,7 @@ public class TabComponent extends JPanel {
|
||||||
if (e.getButton() != MouseEvent.BUTTON1) // left-click
|
if (e.getButton() != MouseEvent.BUTTON1) // left-click
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pane.indexOfTabComponent(TabComponent.this) != -1) {
|
closePane();
|
||||||
int i = pane.indexOfTabComponent(TabComponent.this);
|
|
||||||
removeTab(i);
|
|
||||||
}
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
closeTab.addActionListener(e ->
|
closeTab.addActionListener(e ->
|
||||||
|
@ -86,7 +83,6 @@ public class TabComponent extends JPanel {
|
||||||
|
|
||||||
closeAllTabs.addActionListener(e ->
|
closeAllTabs.addActionListener(e ->
|
||||||
{
|
{
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (pane.getTabCount() <= 1)
|
if (pane.getTabCount() <= 1)
|
||||||
return;
|
return;
|
||||||
|
@ -101,7 +97,16 @@ public class TabComponent extends JPanel {
|
||||||
|
|
||||||
setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
|
setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void closePane()
|
||||||
|
{
|
||||||
|
if (pane.indexOfTabComponent(TabComponent.this) != -1)
|
||||||
|
{
|
||||||
|
int i = pane.indexOfTabComponent(TabComponent.this);
|
||||||
|
removeTab(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void removeTab(int index) {
|
private void removeTab(int index) {
|
||||||
ResourceViewer resourceViewer = (ResourceViewer) BytecodeViewer.viewer.workPane.tabs.getComponentAt(index);
|
ResourceViewer resourceViewer = (ResourceViewer) BytecodeViewer.viewer.workPane.tabs.getComponentAt(index);
|
||||||
BytecodeViewer.viewer.workPane.openedTabs.remove(resourceViewer.resource.workingName);
|
BytecodeViewer.viewer.workPane.openedTabs.remove(resourceViewer.resource.workingName);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user