The Meta-Environment API

nl.cwi.sen1.tide.tool.srcviewer
Class SourceFileViewer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JScrollPane
                  extended by nl.cwi.sen1.tide.tool.srcviewer.SourceFileViewer
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.PopupMenuListener, javax.swing.ScrollPaneConstants, PreferenceListener, DebugProcessListener

 class SourceFileViewer
extends javax.swing.JScrollPane
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, javax.swing.event.PopupMenuListener, java.awt.event.ActionListener, DebugProcessListener, PreferenceListener


Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JScrollPane
javax.swing.JScrollPane.AccessibleJScrollPane, javax.swing.JScrollPane.ScrollBar
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
(package private) static java.awt.Color COLOR_BREAK
           
(package private) static java.awt.Color COLOR_BREAKPOINT
           
(package private) static java.awt.Color COLOR_CPE
           
(package private) static java.awt.Color COLOR_LINEBG
           
(package private) static java.awt.Color COLOR_VARIABLE
           
(package private) static java.awt.Color COLOR_WATCH
           
(package private) static java.awt.Color COLOR_WATCHPOINT
           
private  java.lang.Object cpeHighlight
           
private  javax.swing.text.Highlighter.HighlightPainter cpePainter
           
private  ValuePopup draggedPopup
           
private  java.lang.String file
           
private  javax.swing.JPanel glass
           
private  javax.swing.text.DefaultHighlighter highlighter
           
private static java.lang.String ITEM_ADD_BREAKPOINT
           
private static java.lang.String ITEM_ADD_WATCHPOINT
           
private static java.lang.String ITEM_DELETE_RULE
           
private static java.lang.String ITEM_EDIT_RULE
           
private  int lastSelected
           
private  Rule lastSelectedRule
           
private  LineNumberCanvas lineNumbers
           
private  ToolManager manager
           
private  javax.swing.JPopupMenu menu
           
private  PreferenceSet prefs
           
private  DebugProcess process
           
private  java.lang.String tag_breakpoint
           
private static java.lang.String TAG_BREAKPOINT
           
private  java.lang.String tag_view_var
           
private  java.lang.String tag_watchpoint
           
private static java.lang.String TAG_WATCHPOINT
           
private  SourceBrowser text
           
private  java.util.Map<ValuePopup,java.lang.Object> variableHighlights
           
private  javax.swing.text.Highlighter.HighlightPainter variablePainter
           
 
Fields inherited from class javax.swing.JScrollPane
columnHeader, horizontalScrollBar, horizontalScrollBarPolicy, lowerLeft, lowerRight, rowHeader, upperLeft, upperRight, verticalScrollBar, verticalScrollBarPolicy, viewport
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.ScrollPaneConstants
COLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
SourceFileViewer(ToolManager manager, DebugProcess process, java.lang.String file, int id, java.lang.String tag_view_var)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
           
protected  java.lang.Object addHighlight(Expr location, javax.swing.text.Highlighter.HighlightPainter painter, boolean whole_line, boolean is_cpe)
           
private  void centerAround(Expr location)
           
protected  void cleanup()
           
 void evaluationResult(DebugProcess process, Expr expr, Expr value, java.lang.String tag)
           
 java.lang.String getFile()
           
private  void handleAddBreakpoint()
           
private  void handleAddWatchpoint()
           
protected  void highlightCpe()
           
private  void highlightRule(Rule rule)
           
protected  void highlightRules(java.util.Iterator<Rule> rules)
           
protected  void highlightVariable(int start, int length, ValuePopup varWindow)
           
 void mouseClicked(java.awt.event.MouseEvent event)
           
 void mouseDragged(java.awt.event.MouseEvent event)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent event)
           
 void mousePressed(java.awt.event.MouseEvent event)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void popupMenuCanceled(javax.swing.event.PopupMenuEvent event)
           
 void popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent event)
           
 void popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent event)
           
 void preferenceChanged(PreferenceSet prefs, java.lang.String name, java.lang.String oldValue, java.lang.String newValue)
           
 void preferencesChanged(PreferenceSet prefs)
           
 void preferencesStatusChanged(PreferenceSet set, boolean clean)
           
private  void prepareHighlightingStuff()
           
(package private)  void removeValuePopup(ValuePopup popup)
           
 void ruleCreated(DebugProcess process, Rule rule)
           
 void ruleDeleted(DebugProcess process, Rule rule)
           
 void ruleModified(DebugProcess process, Rule rule)
           
 void ruleTriggered(DebugProcess process, Rule rule, Expr value)
           
private  void showMenu(int x, int y)
           
private  void showVariable(int x, int y)
           
protected  void unhighlightCpe()
           
private  void unhighlightRule(Rule rule)
           
 
Methods inherited from class javax.swing.JScrollPane
createHorizontalScrollBar, createVerticalScrollBar, createViewport, getAccessibleContext, getColumnHeader, getCorner, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getRowHeader, getUI, getUIClassID, getVerticalScrollBar, getVerticalScrollBarPolicy, getViewport, getViewportBorder, getViewportBorderBounds, isValidateRoot, isWheelScrollingEnabled, paramString, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setUI, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setViewportView, setWheelScrollingEnabled, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ITEM_ADD_BREAKPOINT

private static final java.lang.String ITEM_ADD_BREAKPOINT
See Also:
Constant Field Values

ITEM_ADD_WATCHPOINT

private static final java.lang.String ITEM_ADD_WATCHPOINT
See Also:
Constant Field Values

ITEM_EDIT_RULE

private static final java.lang.String ITEM_EDIT_RULE
See Also:
Constant Field Values

ITEM_DELETE_RULE

private static final java.lang.String ITEM_DELETE_RULE
See Also:
Constant Field Values

COLOR_CPE

static final java.awt.Color COLOR_CPE

COLOR_VARIABLE

static final java.awt.Color COLOR_VARIABLE

COLOR_BREAK

static final java.awt.Color COLOR_BREAK

COLOR_BREAKPOINT

static final java.awt.Color COLOR_BREAKPOINT

COLOR_WATCH

static final java.awt.Color COLOR_WATCH

COLOR_WATCHPOINT

static final java.awt.Color COLOR_WATCHPOINT

COLOR_LINEBG

static final java.awt.Color COLOR_LINEBG

TAG_BREAKPOINT

private static final java.lang.String TAG_BREAKPOINT
See Also:
Constant Field Values

TAG_WATCHPOINT

private static final java.lang.String TAG_WATCHPOINT
See Also:
Constant Field Values

manager

private ToolManager manager

prefs

private PreferenceSet prefs

process

private DebugProcess process

file

private java.lang.String file

tag_view_var

private java.lang.String tag_view_var

menu

private javax.swing.JPopupMenu menu

tag_breakpoint

private java.lang.String tag_breakpoint

tag_watchpoint

private java.lang.String tag_watchpoint

lineNumbers

private LineNumberCanvas lineNumbers

text

private SourceBrowser text

glass

private javax.swing.JPanel glass

highlighter

private javax.swing.text.DefaultHighlighter highlighter

cpePainter

private javax.swing.text.Highlighter.HighlightPainter cpePainter

cpeHighlight

private java.lang.Object cpeHighlight

variablePainter

private javax.swing.text.Highlighter.HighlightPainter variablePainter

variableHighlights

private java.util.Map<ValuePopup,java.lang.Object> variableHighlights

lastSelected

private int lastSelected

lastSelectedRule

private Rule lastSelectedRule

draggedPopup

private ValuePopup draggedPopup
Constructor Detail

SourceFileViewer

public SourceFileViewer(ToolManager manager,
                        DebugProcess process,
                        java.lang.String file,
                        int id,
                        java.lang.String tag_view_var)
Method Detail

prepareHighlightingStuff

private void prepareHighlightingStuff()

getFile

public java.lang.String getFile()

cleanup

protected void cleanup()

highlightRules

protected void highlightRules(java.util.Iterator<Rule> rules)

highlightRule

private void highlightRule(Rule rule)

unhighlightRule

private void unhighlightRule(Rule rule)

highlightCpe

protected void highlightCpe()

unhighlightCpe

protected void unhighlightCpe()

showVariable

private void showVariable(int x,
                          int y)

removeValuePopup

void removeValuePopup(ValuePopup popup)

centerAround

private void centerAround(Expr location)

addHighlight

protected java.lang.Object addHighlight(Expr location,
                                        javax.swing.text.Highlighter.HighlightPainter painter,
                                        boolean whole_line,
                                        boolean is_cpe)

highlightVariable

protected void highlightVariable(int start,
                                 int length,
                                 ValuePopup varWindow)

showMenu

private void showMenu(int x,
                      int y)

popupMenuWillBecomeVisible

public void popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent event)
Specified by:
popupMenuWillBecomeVisible in interface javax.swing.event.PopupMenuListener

popupMenuWillBecomeInvisible

public void popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent event)
Specified by:
popupMenuWillBecomeInvisible in interface javax.swing.event.PopupMenuListener

popupMenuCanceled

public void popupMenuCanceled(javax.swing.event.PopupMenuEvent event)
Specified by:
popupMenuCanceled in interface javax.swing.event.PopupMenuListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent event)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent event)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent event)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent event)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

handleAddWatchpoint

private void handleAddWatchpoint()

handleAddBreakpoint

private void handleAddBreakpoint()

ruleCreated

public void ruleCreated(DebugProcess process,
                        Rule rule)
Specified by:
ruleCreated in interface DebugProcessListener

ruleDeleted

public void ruleDeleted(DebugProcess process,
                        Rule rule)
Specified by:
ruleDeleted in interface DebugProcessListener

ruleModified

public void ruleModified(DebugProcess process,
                         Rule rule)
Specified by:
ruleModified in interface DebugProcessListener

ruleTriggered

public void ruleTriggered(DebugProcess process,
                          Rule rule,
                          Expr value)
Specified by:
ruleTriggered in interface DebugProcessListener

evaluationResult

public void evaluationResult(DebugProcess process,
                             Expr expr,
                             Expr value,
                             java.lang.String tag)
Specified by:
evaluationResult in interface DebugProcessListener

preferencesChanged

public void preferencesChanged(PreferenceSet prefs)
Specified by:
preferencesChanged in interface PreferenceListener

preferenceChanged

public void preferenceChanged(PreferenceSet prefs,
                              java.lang.String name,
                              java.lang.String oldValue,
                              java.lang.String newValue)
Specified by:
preferenceChanged in interface PreferenceListener

preferencesStatusChanged

public void preferencesStatusChanged(PreferenceSet set,
                                     boolean clean)
Specified by:
preferencesStatusChanged in interface PreferenceListener

The Meta-Environment API