org.openide.text
Class Line

java.lang.Object
  |
  +--org.openide.text.Line
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
DocumentLine

public abstract class Line
extends Object
implements Serializable

Represents one line in a text document. The line number may change when the text is modified, but the identity of the line is retained. It is designed to allow line-dependent modules of the IDE (such as the compiler and debugger) to make use of a line consistently even as the text is modified.

See Also:
Serialized Form

Inner Class Summary
static class Line.Set
          Object that represents a snapshot of lines at the time it was created.
 
Field Summary
static int SHOW_GOTO
          Opens the editor if necessary, shows the line, and takes the focus.
static int SHOW_SHOW
          Opens the editor if necessary and shows the line.
static int SHOW_TRY_SHOW
          Shows the line only if the editor is open.
 
Constructor Summary
Line(DataObject obj)
          Create a new line object based on a given data object.
 
Method Summary
 boolean canBeMarkedCurrent(int action, Line previousLine)
          Method that should allow the debugger to communicate with lines that wants to have a control over the current line of debugger.
 DataObject getDataObject()
          Get the data object this line is a part of.
 String getDisplayName()
          Composes a human presentable name for the line.
abstract  int getLineNumber()
          Get the line number.
abstract  boolean isBreakpoint()
          Test if there is a breakpoint set at this line.
abstract  void markCurrentLine()
          Mark this line as current.
abstract  void markError()
          Mark an error at this line.
abstract  void setBreakpoint(boolean b)
          Set or clear a (debugger) breakpoint at this line.
 void show(int kind)
          Shows the line (at the first column).
abstract  void show(int kind, int column)
          Show the line.
abstract  void unmarkCurrentLine()
          Unmark this line as current.
abstract  void unmarkError()
          Unmark error at this line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SHOW_TRY_SHOW

public static final int SHOW_TRY_SHOW
Shows the line only if the editor is open.
See Also:
show

SHOW_SHOW

public static final int SHOW_SHOW
Opens the editor if necessary and shows the line.
See Also:
show

SHOW_GOTO

public static final int SHOW_GOTO
Opens the editor if necessary, shows the line, and takes the focus.
See Also:
show
Constructor Detail

Line

public Line(DataObject obj)
Create a new line object based on a given data object. This implementation is abstract, so the specific line number is not used here. Subclasses should somehow specify the position.
Parameters:
obj - the data object this line is a part of
Method Detail

getDisplayName

public String getDisplayName()
Composes a human presentable name for the line. The default implementation uses the name of data object and the line number to create the display name.
Returns:
human presentable name that should identify the line

getDataObject

public final DataObject getDataObject()
Get the data object this line is a part of.
Returns:
data object

getLineNumber

public abstract int getLineNumber()
Get the line number. The last condition in following should always be true:
   Line.Set lineSet = 
   Line l = 
   
   l.equals (lineSet.getCurrent (l.getLineNumber ())) 
 
Returns:
current line number (may change as text is edited)

show

public abstract void show(int kind,
                          int column)
Show the line.
Parameters:
kind - one of SHOW_TRY_SHOW, SHOW_SHOW, or SHOW_GOTO
column - the column of this line which should be selected

show

public void show(int kind)
Shows the line (at the first column).
Parameters:
kind - one of SHOW_TRY_SHOW, SHOW_SHOW, or SHOW_GOTO
See Also:
show(int, int)

setBreakpoint

public abstract void setBreakpoint(boolean b)
Set or clear a (debugger) breakpoint at this line.
Parameters:
b - true to turn on

isBreakpoint

public abstract boolean isBreakpoint()
Test if there is a breakpoint set at this line.
Returns:
true is there is

markError

public abstract void markError()
Mark an error at this line.

unmarkError

public abstract void unmarkError()
Unmark error at this line.

markCurrentLine

public abstract void markCurrentLine()
Mark this line as current.

unmarkCurrentLine

public abstract void unmarkCurrentLine()
Unmark this line as current.

canBeMarkedCurrent

public boolean canBeMarkedCurrent(int action,
                                  Line previousLine)
Method that should allow the debugger to communicate with lines that wants to have a control over the current line of debugger. It allows the line to refuse the current status and force the debugger to continue over this line.

The default implementation simply returns true.

Parameters:
action - type of action that is trying to mark this line as current one of constants (Debugger.ACTION_BREAKPOINT_HIT, Debugger.ACTION_TRACE_OVER, etc.)
previousLine - previous line (if any) or null
Returns:
true if this line accepts the "current" state or false if the line wants the debugger to proceed with next instruction


Built on February 22 2001.  |  Portions Copyright 1997-2000 Sun Microsystems, Inc. All rights reserved.