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

SourceElement.Impl (NetBeans Java Hierarchy API) - NetBeans API Javadoc 4.1.0

 

org.openide.src
Interface SourceElement.Impl

All Superinterfaces:
Element.Impl, Serializable
Enclosing interface:
SourceElement

public static interface SourceElement.Impl
extends Element.Impl

Pluggable behaviour for source elements.

See Also:
SourceElement

Field Summary
static int ADD
          Add some top-level classes.
static int REMOVE
          Remove some top-level classes.
static long serialVersionUID
          Deprecated. Only public by accident.
static int SET
          Set the top-classes.
 
Method Summary
 void changeClasses(ClassElement[] elems, int action)
          Change the set of top-level classes.
 void changeImports(Import[] elems, int action)
          Change the set of imports.
 ClassElement[] getAllClasses()
          Get all classes recursively, both top-level and inner.
 ClassElement getClass(Identifier name)
          Find a top-level class by name.
 ClassElement[] getClasses()
          Get all top-level classes.
 Import[] getImports()
          Get all imports.
 Identifier getPackage()
          Get the package of this source file.
 int getStatus()
          Get the parsing status of the element.
 Task prepare()
          Begin parsing this source element.
 void runAtomic(Runnable run)
          Lock the underlaing document to have exclusive access to it and could make changes on this SourceElement.
 void runAtomicAsUser(Runnable run)
          Executes given runnable in "user mode" does not allowing any modifications to parts of text marked as guarded.
 void setPackage(Identifier id)
          Set the package of this source file.
 
Methods inherited from interface org.openide.src.Element.Impl
addPropertyChangeListener, attachedToElement, getCookie, markCurrent, readResolve, removePropertyChangeListener
 

Field Detail

ADD

public static final int ADD
Add some top-level classes.

See Also:
Constant Field Values

REMOVE

public static final int REMOVE
Remove some top-level classes.

See Also:
Constant Field Values

SET

public static final int SET
Set the top-classes.

See Also:
Constant Field Values

serialVersionUID

public static final long serialVersionUID
Deprecated. Only public by accident.

See Also:
Constant Field Values
Method Detail

getStatus

public int getStatus()
Get the parsing status of the element. This is a non-blocking operation.

Returns:
one of SourceElement.STATUS_NOT, SourceElement.STATUS_ERROR, SourceElement.STATUS_PARTIAL, or SourceElement.STATUS_OK

prepare

public Task prepare()
Begin parsing this source element. This method is non-blocking; it only returns a task that can be used to control the ongoing parse. Initially the getStatus() should be SourceElement.STATUS_NOT, and change to one of the other three when parsing is complete, according to whether or not errors were encountered, and their severity.

Returns:
a task to control the preparation of the element

setPackage

public void setPackage(Identifier id)
                throws SourceException
Set the package of this source file.

Parameters:
id - the package name, or null to use the default package
Throws:
SourceException - if the operation cannot proceed

getPackage

public Identifier getPackage()
Get the package of this source file.

Returns:
the package name, or null if this source file is in the default package

getImports

public Import[] getImports()
Get all imports.

Returns:
the imports

changeImports

public void changeImports(Import[] elems,
                          int action)
                   throws SourceException
Change the set of imports.

Parameters:
elems - the imports to change
action - one of ADD, REMOVE, or SET
Throws:
SourceException - if the action cannot be handled

changeClasses

public void changeClasses(ClassElement[] elems,
                          int action)
                   throws SourceException
Change the set of top-level classes.

Parameters:
elems - the classes to change
action - one of ADD, REMOVE, or SET
Throws:
SourceException - if the action cannot be handled

getClasses

public ClassElement[] getClasses()
Get all top-level classes.

Returns:
the classes

getClass

public ClassElement getClass(Identifier name)
Find a top-level class by name.

Parameters:
name - the name to look for
Returns:
the class, or null if it does not exist

getAllClasses

public ClassElement[] getAllClasses()
Get all classes recursively, both top-level and inner.

Returns:
all classes

runAtomic

public void runAtomic(Runnable run)
Lock the underlaing document to have exclusive access to it and could make changes on this SourceElement.

Parameters:
run - the action to run

runAtomicAsUser

public void runAtomicAsUser(Runnable run)
                     throws SourceException
Executes given runnable in "user mode" does not allowing any modifications to parts of text marked as guarded. The actions should be run as "atomic" so either happen all at once or none at all (if a guarded block should be modified).

Parameters:
run - the action to run
Throws:
SourceException - if a modification of guarded text occured and that is why no changes to the document has been done.

 

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