|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.netbeans.spi.editor.fold.FoldOperation
Fold operation represents services
provided to an individual fold manager.
Each manager has its own dedicated instance
of fold operation.
There are three main services - creation of a new fold
and adding or removing it from the hierarchy.
Adding and removing of the folds requires a valid transaction
that can be obtained by openTransaction()
.
Method Summary | |
Fold |
addToHierarchy(FoldType type,
String description,
boolean collapsed,
int startOffset,
int endOffset,
int startGuardedLength,
int endGuardedLength,
Object extraInfo,
FoldHierarchyTransaction transaction)
Create new fold instance and add it to the hierarchy. |
Object |
getExtraInfo(Fold fold)
Return extra info object passed to fold at time of its creation. |
FoldHierarchy |
getHierarchy()
Get the hierarchy for which this fold operations works. |
boolean |
isAddedOrBlocked(Fold fold)
Check whether the fold is currently present in the hierarchy or blocked. |
boolean |
isBlocked(Fold fold)
Is the given fold blocked by another fold? |
static boolean |
isBoundsValid(int startOffset,
int endOffset,
int startGuardedLength,
int endGuardedLength)
This static method can be used to check whether the bounds of the fold that is planned to be added are valid. |
boolean |
isEndDamaged(Fold fold)
Check whether the ending guarded area of the fold is damaged by a document modification. |
boolean |
isReleased()
|
boolean |
isStartDamaged(Fold fold)
Check whether the starting guarded area of the fold is damaged by a document modification. |
FoldHierarchyTransaction |
openTransaction()
Open a new transaction over the fold hierarchy. |
void |
removeFromHierarchy(Fold fold,
FoldHierarchyTransaction transaction)
Remove the fold that is either present in the hierarchy or blocked by another fold. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public Fold addToHierarchy(FoldType type, String description, boolean collapsed, int startOffset, int endOffset, int startGuardedLength, int endGuardedLength, Object extraInfo, FoldHierarchyTransaction transaction) throws BadLocationException
The fold is logically bound to the fold manager that uses this fold operation.
The fold can only be removed by this fold operation.
type
- type of the fold to be assigned to the fold.description
- textual description of the fold that will be displayed
once the fold becomes collapsed.collapsed
- whether the fold should initially be collapsed or expanded.startOffset
- starting offset of the fold. The fold creates swing position
for the offset.endOffset
- ending offset of the fold. The fold creates swing position
for the offset.startGuardedLength
- >=0 initial guarded area of the fold (starting at the start offset).
If the guarded area is modified the fold will be removed automatically.endGuardedLength
- >=0 ending guarded area of the fold (ending at the end offset).
If the guarded area is modified the fold will be removed automatically.extraInfo
- arbitrary extra information specific for the fold being created.
It's not touched or used by the folding infrastructure in any way.
null can be passed if there is no extra information.
The extra info of the existing fold can be obtained by
getExtraInfo(org.netbeans.api.editor.fold.Fold)
.
- Returns:
- new fold instance that was added to the hierarchy.
- Throws:
BadLocationException
public static boolean isBoundsValid(int startOffset, int endOffset, int startGuardedLength, int endGuardedLength)
startOffset < endOffset
startGuardedLength >= 0
endGuardedLength >= 0
startOffset + startGuardedLength <= endOffset - endGuardedLength
public void removeFromHierarchy(Fold fold, FoldHierarchyTransaction transaction)
fold
- fold to be removedtransaction
- non-null transaction under which the fold should be removed.public Object getExtraInfo(Fold fold)
public boolean isStartDamaged(Fold fold)
fold
- fold to check. The fold must be managed by this fold operation.
public boolean isEndDamaged(Fold fold)
fold
- fold to check. The fold must be managed by this fold operation.
public FoldHierarchyTransaction openTransaction()
FoldHierarchyTransaction transaction = operation.openTransaction(); try { ... } finally { transaction.commit(); }
public boolean isAddedOrBlocked(Fold fold)
public boolean isBlocked(Fold fold)
public FoldHierarchy getHierarchy()
public boolean isReleased()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |