mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-12-23 13:07:59 +01:00
Adds a menu item that allows to close all the tabs that have their connections not active. SMACK-139
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2327 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
a4c49d5e04
commit
9a7ad5d3cb
1 changed files with 28 additions and 0 deletions
|
@ -265,6 +265,7 @@ class EnhancedDebuggerWindow {
|
|||
|
||||
// Add pop-up menu.
|
||||
JPopupMenu menu = new JPopupMenu();
|
||||
// Add a menu item that allows to close the current selected tab
|
||||
JMenuItem menuItem = new JMenuItem("Close");
|
||||
menuItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
@ -285,6 +286,33 @@ class EnhancedDebuggerWindow {
|
|||
}
|
||||
});
|
||||
menu.add(menuItem);
|
||||
// Add a menu item that allows to close all the tabs that have their connections closed
|
||||
menuItem = new JMenuItem("Close All Not Active");
|
||||
menuItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ArrayList debuggersToRemove = new ArrayList();
|
||||
// Remove all the debuggers of which their connections are no longer valid
|
||||
for (int index=0; index < tabbedPane.getComponentCount()-1; index++) {
|
||||
EnhancedDebugger debugger = (EnhancedDebugger)debuggers.get(index);
|
||||
if (!debugger.isConnectionActive()) {
|
||||
// Notify to the debugger to stop debugging
|
||||
debugger.cancel();
|
||||
debuggersToRemove.add(debugger);
|
||||
}
|
||||
}
|
||||
for (Iterator it=debuggersToRemove.iterator(); it.hasNext();) {
|
||||
EnhancedDebugger debugger = (EnhancedDebugger)it.next();
|
||||
// Remove the debugger from the root window
|
||||
tabbedPane.remove(debugger.tabbedPane);
|
||||
debuggers.remove(debugger);
|
||||
}
|
||||
// Update the root window title
|
||||
frame.setTitle(
|
||||
"Smack Debug Window -- Total connections: "
|
||||
+ (tabbedPane.getComponentCount() - 1));
|
||||
}
|
||||
});
|
||||
menu.add(menuItem);
|
||||
// Add listener to the text area so the popup menu can come up.
|
||||
tabbedPane.addMouseListener(new PopupListener(menu));
|
||||
|
||||
|
|
Loading…
Reference in a new issue