edu.rice.cs.drjava.ui
Class DrJavaErrorWindow

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Dialog
                  extended by javax.swing.JDialog
                      extended by edu.rice.cs.drjava.ui.DrJavaErrorWindow
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class DrJavaErrorWindow
extends JDialog

Displays uncaught exceptions and logged conditions. This window is not automatically updated when new errors occur. In the case of errors, we want to minimize the effects on the GUI. If we want to see an updated dialog, we can click on the "DrJava Errors" button again.

Version:
$Id: DrJavaErrorWindow.java 5232 2010-04-24 00:14:05Z mgricken $
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JDialog
JDialog.AccessibleJDialog
 
Nested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityType
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private  JPanel _bottomPanel
          compresses the buttonPanel into the east
private  JPanel _buttonPanel
          contains the butons
private  Action _copyAction
          Copy currently selected error to clip board.
private  JButton _copyButton
          the button that copies the stack trace to the clipboard
private  Action _dismissAction
          Dismiss all errors and close the window.
private  JButton _dismissButton
          the button that clears all errors and closes the window
private  Throwable _error
          the currently selected error
private  int _errorCount
          the number of errors that had occurred
private  int _errorIndex
          the currently selected error index
private  JEditorPane _errorInfo
          information about the error
private  JLabel _indexLabel
          label with index
private  Action _nextAction
          Go to the next error.
private  JButton _nextButton
          the button that moves to the next error
private  Action _okAction
           
private  JButton _okButton
          the button that closes this window
private static boolean _parentChanged
          true if parent changed since last singleton() call
private static JFrame _parentFrame
          the parent frame
private  Action _prevAction
           
private  JButton _prevButton
          the button that moves to the previous error
private static DrJavaErrorWindow _singletonInstance
          The singleton instance of this dialog.
private  JTextArea _stackTrace
          contains the stack trace
private  JScrollPane _stackTraceScroll
          scroll pane for _stackTrace
protected  WindowAdapter _windowListener
           
protected  Runnable1<WindowEvent> CANCEL
          Lambda that calls _cancel.
private static String ERRORS_FOOTER_HTML
           
private static String HEADER_HTML
          Canned message for the user.
private static String NO_ERRORS_HTML
           
static String SF_ADD_BUG_URL
          Sourceforge add bug URL
static String SF_LINK_NAME
          Sourceforge URL
 
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Dialog
DEFAULT_MODALITY_TYPE
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
private DrJavaErrorWindow()
          Creates a window to graphically display the errors that have occurred in the code of DrJava.
 
Method Summary
static JFrame getFrame()
          Gets the parent frame.
static String getSystemAndDrJavaInfo()
          Return a string with the system properties, the DrJava configuration file contents, and information about memory.
private  void init()
          Initialize the dialog.
private static String replaceString(String text, String orig, String repl)
          Replaces all occurrences of orig in text with repl.
static void setFrame(JFrame f)
          Sets the parent frame.
 void setVisible(boolean vis)
          Validates before changing visibility.
static DrJavaErrorWindow singleton()
          Returns the singleton instance.
private  void updateErrorInfo()
          Update the buttons and text area after next or previous.
 
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setModalityType, setResizable, setTitle, setUndecorated, show, toBack
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SF_ADD_BUG_URL

public static final String SF_ADD_BUG_URL
Sourceforge add bug URL

See Also:
Constant Field Values

SF_LINK_NAME

public static final String SF_LINK_NAME
Sourceforge URL

See Also:
Constant Field Values

_errorInfo

private volatile JEditorPane _errorInfo
information about the error


_stackTrace

private final JTextArea _stackTrace
contains the stack trace


_indexLabel

private final JLabel _indexLabel
label with index


_stackTraceScroll

private final JScrollPane _stackTraceScroll
scroll pane for _stackTrace


_bottomPanel

private final JPanel _bottomPanel
compresses the buttonPanel into the east


_buttonPanel

private final JPanel _buttonPanel
contains the butons


_copyButton

private final JButton _copyButton
the button that copies the stack trace to the clipboard


_okButton

private final JButton _okButton
the button that closes this window


_nextButton

private final JButton _nextButton
the button that moves to the next error


_prevButton

private final JButton _prevButton
the button that moves to the previous error


_dismissButton

private final JButton _dismissButton
the button that clears all errors and closes the window


_errorCount

private volatile int _errorCount
the number of errors that had occurred


_error

private volatile Throwable _error
the currently selected error


_errorIndex

private volatile int _errorIndex
the currently selected error index


_parentFrame

private static volatile JFrame _parentFrame
the parent frame


_parentChanged

private static volatile boolean _parentChanged
true if parent changed since last singleton() call


_singletonInstance

private static volatile DrJavaErrorWindow _singletonInstance
The singleton instance of this dialog.


_windowListener

protected WindowAdapter _windowListener

CANCEL

protected final Runnable1<WindowEvent> CANCEL
Lambda that calls _cancel.


_okAction

private final Action _okAction

_prevAction

private final Action _prevAction

_nextAction

private final Action _nextAction
Go to the next error.


_dismissAction

private Action _dismissAction
Dismiss all errors and close the window.


_copyAction

private Action _copyAction
Copy currently selected error to clip board.


HEADER_HTML

private static final String HEADER_HTML
Canned message for the user.

See Also:
Constant Field Values

ERRORS_FOOTER_HTML

private static final String ERRORS_FOOTER_HTML
See Also:
Constant Field Values

NO_ERRORS_HTML

private static final String NO_ERRORS_HTML
See Also:
Constant Field Values
Constructor Detail

DrJavaErrorWindow

private DrJavaErrorWindow()
Creates a window to graphically display the errors that have occurred in the code of DrJava.

Method Detail

setFrame

public static void setFrame(JFrame f)
Sets the parent frame.


getFrame

public static JFrame getFrame()
Gets the parent frame.


singleton

public static DrJavaErrorWindow singleton()
Returns the singleton instance. Recreates it if necessary.


setVisible

public void setVisible(boolean vis)
Validates before changing visibility. Only runs in the event thread.

Overrides:
setVisible in class Dialog
Parameters:
vis - true if frame should be shown, false if it should be hidden.

init

private void init()
Initialize the dialog.


updateErrorInfo

private void updateErrorInfo()
Update the buttons and text area after next or previous.


getSystemAndDrJavaInfo

public static String getSystemAndDrJavaInfo()
Return a string with the system properties, the DrJava configuration file contents, and information about memory. The data is anonymized.

Returns:
information string

replaceString

private static String replaceString(String text,
                                    String orig,
                                    String repl)
Replaces all occurrences of orig in text with repl.