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

GuardedSection (Editor Guarded Sections) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.editor.guards/0 0.1

org.netbeans.api.editor.guards
Class GuardedSection

java.lang.Object
  extended by org.netbeans.api.editor.guards.GuardedSection
Direct Known Subclasses:
InteriorSection, SimpleSection

public class GuardedSection
extends Object

Represents one guarded section.


Method Summary
 boolean contains(Position pos, boolean permitHoles)
          Assures that a position is not inside the guarded section.
 void deleteSection()
          Removes the section and the text of the section from the Document.
 Position getCaretPosition()
          Gets the begin of section.
 Position getEndPosition()
          Returns the end position of the whole guarded section.
 String getName()
          Get the name of the section.
 Position getStartPosition()
          Returns the start position of the whole guarded section.
 String getText()
          Gets the text contained in the section.
 boolean isValid()
          Tests if the section is still valid - it is not removed from the source.
 void removeSection()
          Removes the section from the Document, but retains the text contained within.
 void setName(String name)
          Set the name of the section.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getName

public String getName()
Get the name of the section.

Returns:
the name

setName

public void setName(String name)
             throws PropertyVetoException
Set the name of the section.

Parameters:
name - the new name
Throws:
PropertyVetoException - if the new name is already in use

deleteSection

public void deleteSection()
Removes the section and the text of the section from the Document. The section will then be invalid and it will be impossible to use its methods.


isValid

public boolean isValid()
Tests if the section is still valid - it is not removed from the source.


removeSection

public void removeSection()
Removes the section from the Document, but retains the text contained within. The method should be used to unprotect a region of code instead of calling NbDocument.


getCaretPosition

public Position getCaretPosition()
Gets the begin of section. To this position is set the caret when section is open in the editor.

Returns:
the position to place the caret.

getText

public String getText()
Gets the text contained in the section.

Returns:
The text contained in the section.

contains

public boolean contains(Position pos,
                        boolean permitHoles)
Assures that a position is not inside the guarded section. Complex guarded sections that contain portions of editable text can return true if the tested position is inside one of such portions provided that permitHoles is true.

Parameters:
pos - position in question
permitHoles - if false, guarded section is taken as a monolithic block without any holes in it regardless of its complexity.
Returns:
true if the position is inside section.

getEndPosition

public Position getEndPosition()
Returns the end position of the whole guarded section.

Returns:
the end position of the guarded section.

getStartPosition

public Position getStartPosition()
Returns the start position of the whole guarded section.

Returns:
the start position of the guarded section.

org.netbeans.modules.editor.guards/0 0.1

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