| 
org.netbeans.modules.editor.fold/1 1.6 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface FoldManager
Fold manager maintains folds in the hierarchy for which it is constructed.
 
 There can be multiple individually operating managers
 over a single fold hierarchy each managing its own set of folds.
 
 The only time when the fold managers can collide is when they
 attempt to add overlapping folds into fold hierarchy.
 
 In that case the fold from the manager with a higher priority
 (will be explained later) will be added to the hierarchy
 and the other one will remain outside of the hierarchy
 until the colliding fold will get removed from the hierarchy.
 
 The priority of the manager (and all its folds)
 in the list of the managers for the particular hierarchy
 is defined by the order of the fold manager's factories
 in the layer
 (see FoldManagerFactory for more information).
 
 The fold manager typically creates an initial set of folds
 during the initFolds(FoldHierarchyTransaction).
 Those folds typically mimic certain "primary data structure"
 e.g. java folds mimic certain AST nodes created by a java parser.
 
 Typically the fold manager attaches a listener
 to a primary data structure and once it gets
 notified about its change it should rebuild the folds accordingly.
 
 That set can later be modified upon notifications
 from primary data structure.
 
 Upon notification the folds can be updated synchronously
 but that can potentially lead to deadlocks in case the view
 hierarchy (which shares the same lock with fold hierarchy) would 
 access the primary data structure at the same time.
 
 A safer approach is to remember the changes during notification
 from the primary data structure
 and schedule the updates to the fold hierarchy to be done
 independently.
 
 Ideally the physical creation of folds should be done in EDT
 (Event Dispatch Thread) because there would be no risk
 of the document switching in the text component
 by JTextComponent.setDocument(javax.swing.text.Document).
| Method Summary | |
|---|---|
 void | 
changedUpdate(DocumentEvent evt,
              FoldHierarchyTransaction transaction)
Called by hierarchy upon the change in the underlying document.  | 
 void | 
expandNotify(Fold expandedFold)
Notify that the fold was expanded automatically by fold hierarchy infrastructure processing because its isExpandNecessary()
 return true. | 
 void | 
init(FoldOperation operation)
Initialize this manager.  | 
 void | 
initFolds(FoldHierarchyTransaction transaction)
Initialize the folds provided by this manager.  | 
 void | 
insertUpdate(DocumentEvent evt,
             FoldHierarchyTransaction transaction)
Called by hierarchy upon the insertion to the underlying document.  | 
 void | 
release()
Notification that this manager will no longer be used by the hierarchy.  | 
 void | 
removeDamagedNotify(Fold damagedFold)
Notify that the fold was removed from hierarchy automatically by fold hierarchy infrastructure processing because it was damaged by a document modification.  | 
 void | 
removeEmptyNotify(Fold epmtyFold)
Notify that the fold was removed from hierarchy automatically by fold hierarchy infrastructure processing because it became empty (by a document modification).  | 
 void | 
removeUpdate(DocumentEvent evt,
             FoldHierarchyTransaction transaction)
Called by hierarchy upon the removal in the underlying document.  | 
| Method Detail | 
|---|
void init(FoldOperation operation)
operation - fold hierarchy operation dedicated to the fold manager.void initFolds(FoldHierarchyTransaction transaction)
 Any listeners necessary for the maintenance of the folds
 can be attached here.
 
 Generally there should be just weak listeners used
 to not prevent the GC of the text component.
transaction - transaction in terms of which the intial
  fold changes can be performed.void insertUpdate(DocumentEvent evt, FoldHierarchyTransaction transaction)
evt - document event describing the document modification.transaction - open transaction to which the manager can add
  the fold changes.void removeUpdate(DocumentEvent evt, FoldHierarchyTransaction transaction)
evt - document event describing the document modification.transaction - open transaction to which the manager can add
  the fold changes.void changedUpdate(DocumentEvent evt, FoldHierarchyTransaction transaction)
evt - document event describing the document change.transaction - open transaction to which the manager can add
  the fold changes.void removeEmptyNotify(Fold epmtyFold)
void removeDamagedNotify(Fold damagedFold)
void expandNotify(Fold expandedFold)
isExpandNecessary()
 return true.
void release()
This method is not guaranteed to be called. Therefore the manager must only listen weekly on the related information providers so that it does not block the hierarchy from being garbage collected.
  | 
org.netbeans.modules.editor.fold/1 1.6 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||