mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-26 22:12:05 +01:00
Modified debugger to be invokable.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2973 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
dd9731f1a9
commit
78becc3d73
1 changed files with 81 additions and 65 deletions
|
@ -20,27 +20,29 @@
|
||||||
|
|
||||||
package org.jivesoftware.smackx.debugger;
|
package org.jivesoftware.smackx.debugger;
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.event.*;
|
|
||||||
import java.net.*;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackConfiguration;
|
import org.jivesoftware.smack.SmackConfiguration;
|
||||||
import org.jivesoftware.smack.provider.ProviderManager;
|
import org.jivesoftware.smack.provider.ProviderManager;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.*;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The EnhancedDebuggerWindow is the main debug window that will show all the EnhancedDebuggers.
|
* The EnhancedDebuggerWindow is the main debug window that will show all the EnhancedDebuggers.
|
||||||
* For each connection to debug there will be an EnhancedDebugger that will be shown in the
|
* For each connection to debug there will be an EnhancedDebugger that will be shown in the
|
||||||
* EnhancedDebuggerWindow.<p>
|
* EnhancedDebuggerWindow.<p>
|
||||||
*
|
* <p/>
|
||||||
* This class also provides information about Smack like for example the Smack version and the
|
* This class also provides information about Smack like for example the Smack version and the
|
||||||
* installed providers.
|
* installed providers.
|
||||||
*
|
*
|
||||||
* @author Gaston Dombiak
|
* @author Gaston Dombiak
|
||||||
*/
|
*/
|
||||||
class EnhancedDebuggerWindow {
|
public class EnhancedDebuggerWindow {
|
||||||
|
|
||||||
private static EnhancedDebuggerWindow instance;
|
private static EnhancedDebuggerWindow instance;
|
||||||
|
|
||||||
|
@ -49,6 +51,8 @@ class EnhancedDebuggerWindow {
|
||||||
private static ImageIcon connectionClosedIcon;
|
private static ImageIcon connectionClosedIcon;
|
||||||
private static ImageIcon connectionClosedOnErrorIcon;
|
private static ImageIcon connectionClosedOnErrorIcon;
|
||||||
|
|
||||||
|
public static boolean PERSISTED_DEBUGGER = false;
|
||||||
|
|
||||||
{
|
{
|
||||||
URL url;
|
URL url;
|
||||||
|
|
||||||
|
@ -89,7 +93,7 @@ class EnhancedDebuggerWindow {
|
||||||
*
|
*
|
||||||
* @return the unique EnhancedDebuggerWindow instance
|
* @return the unique EnhancedDebuggerWindow instance
|
||||||
*/
|
*/
|
||||||
private static EnhancedDebuggerWindow getInstance() {
|
public static EnhancedDebuggerWindow getInstance() {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
instance = new EnhancedDebuggerWindow();
|
instance = new EnhancedDebuggerWindow();
|
||||||
}
|
}
|
||||||
|
@ -175,12 +179,14 @@ class EnhancedDebuggerWindow {
|
||||||
|
|
||||||
frame = new JFrame("Smack Debug Window");
|
frame = new JFrame("Smack Debug Window");
|
||||||
|
|
||||||
|
if (!PERSISTED_DEBUGGER) {
|
||||||
// Add listener for window closing event
|
// Add listener for window closing event
|
||||||
frame.addWindowListener(new WindowAdapter() {
|
frame.addWindowListener(new WindowAdapter() {
|
||||||
public void windowClosing(WindowEvent evt) {
|
public void windowClosing(WindowEvent evt) {
|
||||||
rootWindowClosing(evt);
|
rootWindowClosing(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// We'll arrange the UI into tabs. The last tab contains Smack's information.
|
// We'll arrange the UI into tabs. The last tab contains Smack's information.
|
||||||
// All the connection debugger tabs will be shown before the Smack info tab.
|
// All the connection debugger tabs will be shown before the Smack info tab.
|
||||||
|
@ -299,8 +305,10 @@ class EnhancedDebuggerWindow {
|
||||||
frame.getContentPane().add(tabbedPane);
|
frame.getContentPane().add(tabbedPane);
|
||||||
|
|
||||||
frame.setSize(650, 400);
|
frame.setSize(650, 400);
|
||||||
frame.setVisible(true);
|
|
||||||
|
|
||||||
|
if (!PERSISTED_DEBUGGER) {
|
||||||
|
frame.setVisible(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -325,6 +333,7 @@ class EnhancedDebuggerWindow {
|
||||||
* Listens for debug window popup dialog events.
|
* Listens for debug window popup dialog events.
|
||||||
*/
|
*/
|
||||||
private class PopupListener extends MouseAdapter {
|
private class PopupListener extends MouseAdapter {
|
||||||
|
|
||||||
JPopupMenu popup;
|
JPopupMenu popup;
|
||||||
|
|
||||||
PopupListener(JPopupMenu popupMenu) {
|
PopupListener(JPopupMenu popupMenu) {
|
||||||
|
@ -345,4 +354,11 @@ class EnhancedDebuggerWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setVisible(boolean visible) {
|
||||||
|
if (frame != null) {
|
||||||
|
frame.setVisible(visible);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue