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

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

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

org.netbeans.api.editor.guards
Class GuardedSectionManager

java.lang.Object
  extended by org.netbeans.api.editor.guards.GuardedSectionManager

public final class GuardedSectionManager
extends Object

This is the entry point for clients to manipulate guarded sections of the given document.


Method Summary
 InteriorSection createInteriorSection(Position pos, String name)
          Creates an empty interior section at the given position.
 SimpleSection createSimpleSection(Position pos, String name)
          Creates an empty simple section at the given position.
 InteriorSection findInteriorSection(String name)
          Tries to find the interior section of the given name.
 SimpleSection findSimpleSection(String name)
          Tries to find the simple section of the given name.
 Iterable<GuardedSection> getGuardedSections()
          Gets all sections.
static GuardedSectionManager getInstance(StyledDocument doc)
          Gets the manager instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static GuardedSectionManager getInstance(StyledDocument doc)
Gets the manager instance.

Parameters:
doc - a document containing guarded sections
Returns:
the manager instance or null.

findSimpleSection

public SimpleSection findSimpleSection(String name)
Tries to find the simple section of the given name.

Parameters:
name - the name of the requested section
Returns:
the found guarded section or null if there is no section of the given name

findInteriorSection

public InteriorSection findInteriorSection(String name)
Tries to find the interior section of the given name.

Parameters:
name - the name of the looked-for section
Returns:
the found guarded section or null if there is no section of the given name

createSimpleSection

public SimpleSection createSimpleSection(Position pos,
                                         String name)
                                  throws IllegalArgumentException,
                                         BadLocationException
Creates an empty simple section at the given position. The position must not be within any existing guarded section and the passed name must not be registered for other already existing section. The created section will initially contain one space and a newline.

Returns:
SimpleSection instance that can be used for generating text into the protected region
Throws:
IllegalArgumentException - if either the name has been already used, or the position is inside another section or Java Element.
BadLocationException - if pos is outside of document's scope, or the document does not permit creating the guarded section.

createInteriorSection

public InteriorSection createInteriorSection(Position pos,
                                             String name)
                                      throws IllegalArgumentException,
                                             BadLocationException
Creates an empty interior section at the given position. The position must not be within any existing guarded section and the passed name must not be registered to other already existing section. The created section will initially contain one space and a newline in all its parts (header, body and footer).

Returns:
InteriorSection instance that can be used for generating text into the protected region
Throws:
IllegalArgumentException - if either the name has been already used, or the position is inside another section or Java Element.
BadLocationException - if pos is outside of document's scope, or the document does not permit creating the guarded section.

getGuardedSections

public Iterable<GuardedSection> getGuardedSections()
Gets all sections.

Returns:
an iterable over GuardedSections

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

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