diff --git a/platform/core-api/src/com/intellij/lang/folding/FoldingDescriptor.java b/platform/core-api/src/com/intellij/lang/folding/FoldingDescriptor.java
index 6c3694d85847..bc81d6034209 100644
--- a/platform/core-api/src/com/intellij/lang/folding/FoldingDescriptor.java
+++ b/platform/core-api/src/com/intellij/lang/folding/FoldingDescriptor.java
@@ -30,6 +30,12 @@ import java.util.Set;
/**
* Defines a single folding region in the code.
*
+ *
+ * Dependencies are objects (in particular, instances of {@link com.intellij.openapi.util.ModificationTracker}),
+ * which can be tracked for changes, that should trigger folding regions recalculation for an editor (initiating code folding pass).
+ * Changed dependency for a specific region causes its regeneration according to potentially updated folding rules,
+ * e.g. with regard to 'collapsed by default' state.
+ *
* @author max
* @see FoldingBuilder
*/
@@ -47,14 +53,17 @@ public class FoldingDescriptor {
* Creates a folding region related to the specified AST node and covering the specified
* text range.
* @param node The node to which the folding region is related. The node is then passed to
- * {@link FoldingBuilder#getPlaceholderText(com.intellij.lang.ASTNode)} and
- * {@link FoldingBuilder#isCollapsedByDefault(com.intellij.lang.ASTNode)}.
+ * {@link FoldingBuilder#getPlaceholderText(ASTNode)} and
+ * {@link FoldingBuilder#isCollapsedByDefault(ASTNode)}.
* @param range The folded text range.
*/
public FoldingDescriptor(@NotNull ASTNode node, @NotNull TextRange range) {
this(node, range, null);
}
+ /**
+ * @param dependency see Dependencies
+ */
public FoldingDescriptor(@NotNull ASTNode node, @NotNull TextRange range, @Nullable Object dependency) {
this(node, range, null, dependency);
}
@@ -63,38 +72,44 @@ public class FoldingDescriptor {
this(ObjectUtils.assertNotNull(element.getNode()), range, null);
}
+ /**
+ * @param dependency see Dependencies
+ */
public FoldingDescriptor(@NotNull PsiElement element, @NotNull TextRange range, @Nullable Object dependency) {
this(ObjectUtils.assertNotNull(element.getNode()), range, null,
- dependency == null ? Collections.