| org.netbeans.modules.visualweb.insync.Unit
All known Subclasses: org.netbeans.modules.visualweb.insync.SourceUnit, org.netbeans.modules.visualweb.insync.live.LiveUnitWrapper, org.netbeans.modules.visualweb.insync.beans.BeansUnit, org.netbeans.modules.visualweb.insync.live.LiveUnit,
Unit | public interface Unit (Code) | | An abstract representation of a logical compilation unit. The implementation may be directly
associated with a source file/buffer, or may be an abstraction on top of one or more other units.
author: Carl Quinn |
Inner Class :public static class State | |
Method Summary | |
abstract public void | destroy() Destroy this unit & cleanup any resources or registrations that this unit may have. | abstract public void | dumpTo(PrintWriter w) | abstract public ParserAnnotation[] | getErrors() Return the list of errors if this unit does not compile. | abstract public State | getState() Get the current state of this unit. | abstract public boolean | isWriteLocked() | abstract public void | readLock() Acquires a lock to begin reading some state from the unit. | abstract public void | readUnlock() Does a read unlock. | abstract public boolean | sync() Sync this unit's contents to its document or underlying unit, reading changes as needed and
updating flags. | abstract public void | writeLock(UndoEvent event) Acquires a lock to begin mutating the unit this lock protects. | abstract public boolean | writeUnlock(UndoEvent event) Releases a write lock previously obtained via writeLock . |
destroy | abstract public void destroy()(Code) | | Destroy this unit & cleanup any resources or registrations that this unit may have.
|
dumpTo | abstract public void dumpTo(PrintWriter w)(Code) | | Debug method to dump diagnostic info of this unit to a PrintWriter
Parameters: w - The PrintWriter to dump debug info to |
getErrors | abstract public ParserAnnotation[] getErrors()(Code) | | Return the list of errors if this unit does not compile. If there are no errors it returns an
empty array - never null.
An array of ParserAnnotations. |
getState | abstract public State getState()(Code) | | Get the current state of this unit.
This unit's current state. |
isWriteLocked | abstract public boolean isWriteLocked()(Code) | | Return true if and only if the unit is currently locked by a write lock
See Also: Unit.writeLock |
readLock | abstract public void readLock()(Code) | | Acquires a lock to begin reading some state from the unit. There can be multiple readers at
the same time. Writing blocks the readers until notification of the change to the listeners
has been completed. This method should be used very carefully to avoid unintended compromise
of the unit. It should always be balanced with a readUnlock .
See Also: Unit.readUnlock |
readUnlock | abstract public void readUnlock()(Code) | | Does a read unlock. This signals that one of the readers is done. If there are no more
readers then writing can begin again. This should be balanced with a readLock, and should
occur in a finally statement so that the balance is guaranteed. The following is an example.
readLock();
try { // do something }
finally { readUnlock(); }
See Also: Unit.readLock |
sync | abstract public boolean sync()(Code) | | Sync this unit's contents to its document or underlying unit, reading changes as needed and
updating flags.
See Also: Unit.writeLock true iff the model was modified by the operation |
writeLock | abstract public void writeLock(UndoEvent event)(Code) | | Acquires a lock to begin mutating the unit this lock protects. There can be no writing,
notification of changes, or reading going on in order to gain the lock. Additionally a thread
is allowed to gain more than one writeLock , as long as it doesn't attempt to
gain additional writeLock s from within unit notification. Attempting to gain
a *writeLock from within a UnitListener notification will result in an
IllegalStateException . The ability to obtain more than one
writeLock per thread allows subclasses to gain a writeLock, perform a number
of operations, then release the lock.
Calls to writeLock must be balanced with calls to writeUnlock ,
else the Unit will be left in a locked state so that no reading or writing can
be done.
exception: IllegalStateException - thrown on illegal lock attempt. If the unit is implementedproperly, this can only happen if a unit listener attempts to mutate the unit.This situation violates the bean event model where order of delivery is notguaranteed and all listeners should be notified before further mutations areallowed. |
writeUnlock | abstract public boolean writeUnlock(UndoEvent event)(Code) | | Releases a write lock previously obtained via writeLock . After decrementing
the lock count if there are no oustanding locks this will allow a new writer, or readers.
true iff the last pending write lock was completely release. See Also: Unit.writeLock |
|
|