站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 5.5.0

Line (NetBeans Text API) - NetBeans API Javadoc 5.5.0

org.openide.text 6.9.22

org.openide.text
Class Line

java.lang.Object
  extended by org.openide.text.Annotatable
      extended by org.openide.text.Line
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
DocumentLine

public abstract class Line
extends Annotatable
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

Nested Class Summary
static class Line.Part
          Representation of the part of the Line's text.
static class Line.Set
          Object that represents a snapshot of lines at the time it was created.
 
Field Summary
static String PROP_LINE_NUMBER
          Property name of the line number
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_TOFRONT
          Same as SHOW_GOTO except that the Window Manager attempts to front the editor window (i.e.
static int SHOW_TRY_SHOW
          Shows the line only if the editor is open.
 
Fields inherited from class org.openide.text.Annotatable
PROP_ANNOTATION_COUNT, PROP_DELETED, PROP_TEXT
 
Constructor Summary
Line(Lookup context)
          Create a new line object based on a given data object.
Line(Object source)
          Create a new line object based on a given data object.
 
Method Summary
 boolean canBeMarkedCurrent(int action, Line previousLine)
          Deprecated. Deprecated since 1.20, as markCurrentLine() is deprecated by Annotation.attach(org.openide.text.Annotatable).
 Line.Part createPart(int column, int length)
          Create object which represent part of the text on the line.
 String getDisplayName()
          Composes a human presentable name for the line.
abstract  int getLineNumber()
          Get the line number.
 Lookup getLookup()
          Provides access to the context passed into the line constructor.
 String getText()
          Get content of the annotatable.
abstract  boolean isBreakpoint()
          Deprecated. Deprecated since 1.20. Use Annotation instead.
abstract  void markCurrentLine()
          Deprecated. Deprecated since 1.20. Use Annotation.attach(org.openide.text.Annotatable) instead.
abstract  void markError()
          Deprecated. Deprecated since 1.20. Use Annotation.attach(org.openide.text.Annotatable) instead.
abstract  void setBreakpoint(boolean b)
          Deprecated. Deprecated since 1.20. Use Annotation.attach(org.openide.text.Annotatable) instead.
 void show(int kind)
          Shows the line (at the first column).
abstract  void show(int kind, int column)
          Show the line.
abstract  void unmarkCurrentLine()
          Deprecated. Deprecated since 1.20. Use Annotation.detach() instead.
abstract  void unmarkError()
          Deprecated. Deprecated since 1.20. Use Annotation.detach() instead.
 
Methods inherited from class org.openide.text.Annotatable
addAnnotation, addPropertyChangeListener, firePropertyChange, getAnnotationCount, isDeleted, removeAnnotation, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_LINE_NUMBER

public static final String PROP_LINE_NUMBER
Property name of the line number

See Also:
Constant Field Values

SHOW_TRY_SHOW

public static final int SHOW_TRY_SHOW
Shows the line only if the editor is open.

See Also:
show, Constant Field Values

SHOW_SHOW

public static final int SHOW_SHOW
Opens the editor if necessary and shows the line.

See Also:
show, Constant Field Values

SHOW_GOTO

public static final int SHOW_GOTO
Opens the editor if necessary, shows the line, and takes the focus.

See Also:
show, Constant Field Values

SHOW_TOFRONT

public static final int SHOW_TOFRONT
Same as SHOW_GOTO except that the Window Manager attempts to front the editor window (i.e. make it the top most window).

Since:
5.8
See Also:
show, TopComponent.toFront(), Constant Field Values
Constructor Detail

Line

public Line(Lookup context)
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.

The context argument shall contain information about the producer of the Line, that can be then extracted by getLookup() call.

Parameters:
context - the context for this line

Line

public Line(Object source)
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:
source - the object that is producing the Line
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

getLookup

public final Lookup getLookup()
Provides access to the context passed into the line constructor. For example lines produced by DataEditorSupport provide DataObject as the content of the lookup. One can use:
   dataObjectOrNull = (DataObject)line.getLookup ().lookup (DataObject.class);
 
to get the access.

Returns:
context associated with the line
Since:
4.3

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)
Deprecated. Deprecated since 1.20. Use Annotation.attach(org.openide.text.Annotatable) instead.

Set or clear a (debugger) breakpoint at this line.

Parameters:
b - true to turn on

isBreakpoint

public abstract boolean isBreakpoint()
Deprecated. Deprecated since 1.20. Use Annotation instead.

Test if there is a breakpoint set at this line.

Returns:
true is there is

markError

public abstract void markError()
Deprecated. Deprecated since 1.20. Use Annotation.attach(org.openide.text.Annotatable) instead.

Mark an error at this line.


unmarkError

public abstract void unmarkError()
Deprecated. Deprecated since 1.20. Use Annotation.detach() instead.

Unmark error at this line.


markCurrentLine

public abstract void markCurrentLine()
Deprecated. Deprecated since 1.20. Use Annotation.attach(org.openide.text.Annotatable) instead.

Mark this line as current.


unmarkCurrentLine

public abstract void unmarkCurrentLine()
Deprecated. Deprecated since 1.20. Use Annotation.detach() instead.

Unmark this line as current.


canBeMarkedCurrent

public boolean canBeMarkedCurrent(int action,
                                  Line previousLine)
Deprecated. Deprecated since 1.20, as markCurrentLine() is deprecated by Annotation.attach(org.openide.text.Annotatable).

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

createPart

public Line.Part createPart(int column,
                            int length)
Create object which represent part of the text on the line. This part of the line can be used for attaching of annotations.

Parameters:
column - starting column of the part of the text
length - length of the part of the text
Returns:
instance of the Line.Part which represent the part of the text
Since:
1.20

getText

public String getText()
Description copied from class: Annotatable
Get content of the annotatable. The listeners can listen on changes of PROP_TEXT property to learn that content of Annotatable is changing.

Specified by:
getText in class Annotatable
Returns:
text representing the content of annotatable. The return value can be null, what means that document is closed.

org.openide.text 6.9.22

Built on May 28 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.