|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.bluemarsh.jswat.view.JSwatView | +--com.bluemarsh.jswat.view.BasicView | +--com.bluemarsh.jswat.view.SourceView
Defines the SourceView class which will be responsible for displaying the source file on the screen. This class displays a row header down the left side of the source view, indicating the line numbers. A popup menu is attached to the view for setting breakpoints.
Field Summary | |
protected SourceViewPopup |
headerPopup
Popup menu for managing breakpoints. |
protected Session |
owningSession
Session to which we belong. |
protected java.io.File |
sourceFile
Source file we read from. |
protected int |
tabSize
Width of tabs in characters. |
protected SourceViewPopup |
textPopup
Popup menu for managing breakpoints. |
protected com.bluemarsh.jswat.view.SourceViewHeader |
viewHeader
Row header that is usually on the left side of the source window. |
protected javax.swing.JScrollPane |
viewScroller
Scrollable component for text component. |
Fields inherited from class com.bluemarsh.jswat.view.BasicView |
highlightTag, logCategory, textComponent, textHighlightPainter, viewContent, viewTitle |
Constructor Summary | |
SourceView(java.io.File source)
Creates a SourceView object. |
Method Summary | |
void |
activate(Session session)
Called when the Session is about to begin an active debugging session. |
void |
breakpointAdded(BreakpointEvent be)
Invoked when a breakpoint has been added. |
void |
breakpointModified(BreakpointEvent be)
Invoked when a breakpoint has been modified. |
void |
breakpointRemoved(BreakpointEvent be)
Invoked when a breakpoint has been removed. |
void |
close(Session session)
Called when the Session is about to close down. |
void |
configurationChanged()
Called then the prefernces change. |
void |
contextChanged(ContextChangeEvent cce)
Invoked when the current context has changed. |
protected javax.swing.text.Document |
createDefaultDocument()
Creates a Document with all of the necessary styles. |
protected javax.swing.text.JTextComponent |
createTextComponent()
Create the text component with the default document. |
void |
deactivate(Session session)
Called when the Session is about to end an active debugging session. |
protected static java.awt.Color |
getBreakpointColor(Breakpoint bp)
Returns the color that best represents the state of this breakpoint. |
int |
getLineCount()
Returns the number of lines in this document. |
protected int |
getLineEndOffset(int line)
Get the offset of the end of the given line. |
protected int |
getLineOfOffset(int offset)
Find the line containing the given offset. |
protected int |
getLineStartOffset(int line)
Get the offset of the start of the given line. |
protected int |
getTabSize()
Gets the number of characters used to expand tabs. |
javax.swing.JComponent |
getUI()
Returns a reference to the UI component. |
void |
init(Session session)
Called after the Session has added this listener to the Session listener list. |
protected boolean |
matches(Breakpoint bp)
Check if the breakpoint is in the source we are displaying. |
protected boolean |
matches(com.sun.jdi.Location location)
Check if the Location is in the same source file as the file we are displaying. |
protected void |
parseClassDefs()
Reads the class definition information from the source file using the JavaParser class. |
boolean |
refresh(java.io.InputStream input,
int line)
Read the input stream text into the text component. |
boolean |
refresh(int line)
Read the input stream text into the text component. |
protected void |
setBreakpoint(Breakpoint bp)
Adds a line attribute to the source row header, appropriate for the given breakpoint. |
protected void |
setBreakpoints()
Iterate all existing breakpoints and create row header attributes as appropriate. |
protected void |
setPreferences()
Called to update this view's preferences, either when this object is constructed or when the preferences change. |
protected void |
setTabSize(int size)
Sets the tab width of the source document. |
protected void |
setTextContent()
Set the content of the text component using the String defined by viewContent . |
Methods inherited from class com.bluemarsh.jswat.view.BasicView |
findString, foundString, removeHighlight, scrollToLine, setTextComponent, showHighlight |
Methods inherited from class com.bluemarsh.jswat.view.JSwatView |
refresh |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.io.File sourceFile
protected javax.swing.JScrollPane viewScroller
protected com.bluemarsh.jswat.view.SourceViewHeader viewHeader
protected SourceViewPopup textPopup
protected SourceViewPopup headerPopup
protected Session owningSession
init()
.protected int tabSize
Constructor Detail |
public SourceView(java.io.File source)
source
- source code file to displayMethod Detail |
public void activate(Session session)
activate
in interface SessionListener
session
- Session being activated.public void breakpointAdded(BreakpointEvent be)
breakpointAdded
in interface BreakpointListener
be
- breakpoint event.public void breakpointModified(BreakpointEvent be)
breakpointModified
in interface BreakpointListener
be
- breakpoint event.public void breakpointRemoved(BreakpointEvent be)
breakpointRemoved
in interface BreakpointListener
be
- breakpoint event.public void close(Session session)
close
in interface SessionListener
session
- Session being closed.public void configurationChanged()
configurationChanged
in interface com.bluemarsh.config.ConfigureListener
public void contextChanged(ContextChangeEvent cce)
contextChanged
in interface ContextListener
cce
- context change eventprotected javax.swing.text.Document createDefaultDocument()
createTextComponent()
protected javax.swing.text.JTextComponent createTextComponent()
createDefaultDocument()
public void deactivate(Session session)
deactivate
in interface SessionListener
session
- Session being deactivated.protected static java.awt.Color getBreakpointColor(Breakpoint bp)
public int getLineCount()
protected int getLineEndOffset(int line) throws javax.swing.text.BadLocationException
getLineEndOffset
in class BasicView
line
- zero-based line for which to find the end.javax.swing.text.BadLocationException
- Thrown if line is invalid.protected int getLineOfOffset(int offset) throws javax.swing.text.BadLocationException
getLineOfOffset
in class BasicView
offset
- offset within document >= 0.javax.swing.text.BadLocationException
- Thrown if offset is invalid.protected int getLineStartOffset(int line) throws javax.swing.text.BadLocationException
getLineStartOffset
in class BasicView
line
- zero-based line for which to find the start.javax.swing.text.BadLocationException
- Thrown if line is invalid.protected int getTabSize()
public javax.swing.JComponent getUI()
getUI
in class JSwatView
public void init(Session session)
init
in interface SessionListener
session
- Session adding this listener.protected boolean matches(Breakpoint bp)
bp
- breakpoint to check against.protected boolean matches(com.sun.jdi.Location location)
location
- Location to check.protected void parseClassDefs()
public boolean refresh(int line)
line
- line to make visible.public boolean refresh(java.io.InputStream input, int line)
input
- input stream providing source.line
- line to make visible.protected void setBreakpoint(Breakpoint bp)
bp
- breakpoint.protected void setBreakpoints()
protected void setPreferences()
protected void setTabSize(int size)
size
- number of spaces for a tab character.protected void setTextContent()
viewContent
. This implementation applies styles
to the Java source to colorize it syntactically.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |