();
ModifiableRegion commentRange = new ModifiableRegion();
for (ITypedRegion partition : partitions) {
boolean singleLine= false;
+ boolean collapse = collapseNonDoc;
+ if (ICPartitions.C_MULTI_LINE_DOC_COMMENT.equals(partition.getType())
+ || ICPartitions.C_SINGLE_LINE_DOC_COMMENT.equals(partition.getType())) {
+ collapse = collapseDoc;
+ }
if (ICPartitions.C_MULTI_LINE_COMMENT.equals(partition.getType())
|| ICPartitions.C_MULTI_LINE_DOC_COMMENT.equals(partition.getType())) {
Position position= createCommentPosition(alignRegion(partition, ctx, true));
@@ -1521,7 +1550,8 @@ public class DefaultCFoldingStructureProvider implements ICFoldingStructureProvi
if (startLine >= 0 && endLine - startLine >= fMinCommentLines) {
Position projection = createCommentPosition(alignRegion(commentRange, ctx, true));
if (projection != null) {
- comments.add(new Tuple(new CProjectionAnnotation(collapse, doc.get(projection.offset, Math.min(16, projection.length)), true), projection));
+ boolean collapseLast = startLineIsDocComment ? collapseDoc : collapseNonDoc;
+ comments.add(new Tuple(new CProjectionAnnotation(collapseLast, doc.get(projection.offset, Math.min(16, projection.length)), true), projection));
}
startLine= -1;
}
@@ -1547,11 +1577,14 @@ public class DefaultCFoldingStructureProvider implements ICFoldingStructureProvi
if (startLine >= 0 && endLine - startLine >= fMinCommentLines) {
Position projection = createCommentPosition(alignRegion(commentRange, ctx, true));
if (projection != null) {
- comments.add(new Tuple(new CProjectionAnnotation(collapse, doc.get(projection.offset, Math.min(16, projection.length)), true), projection));
+ boolean collapseLast = startLineIsDocComment ? collapseDoc : collapseNonDoc;
+ comments.add(new Tuple(new CProjectionAnnotation(collapseLast, doc.get(projection.offset, Math.min(16, projection.length)), true), projection));
}
}
startLine = lineNr;
endLine = lineNr;
+ startLineIsDocComment = ICPartitions.C_MULTI_LINE_DOC_COMMENT.equals(partition.getType())
+ || ICPartitions.C_SINGLE_LINE_DOC_COMMENT.equals(partition.getType());
commentRange.offset = lineRegion.getOffset();
commentRange.length = lineRegion.getLength();
} else {
@@ -1564,7 +1597,8 @@ public class DefaultCFoldingStructureProvider implements ICFoldingStructureProvi
if (startLine >= 0 && endLine - startLine >= fMinCommentLines) {
Position projection = createCommentPosition(alignRegion(commentRange, ctx, true));
if (projection != null) {
- comments.add(new Tuple(new CProjectionAnnotation(collapse, doc.get(projection.offset, Math.min(16, projection.length)), true), projection));
+ boolean collapseLast = startLineIsDocComment ? collapseDoc : collapseNonDoc;
+ comments.add(new Tuple(new CProjectionAnnotation(collapseLast, doc.get(projection.offset, Math.min(16, projection.length)), true), projection));
}
}
if (!comments.isEmpty()) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/folding/FoldingMessages.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/folding/FoldingMessages.java
index 103c5912446..ae920586ac3 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/folding/FoldingMessages.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/folding/FoldingMessages.java
@@ -27,6 +27,8 @@ public final class FoldingMessages extends NLS {
public static String DefaultCFoldingPreferenceBlock_methods;
public static String DefaultCFoldingPreferenceBlock_structures;
public static String DefaultCFoldingPreferenceBlock_comments;
+ public static String DefaultCFoldingPreferenceBlock_doc_comments;
+ public static String DefaultCFoldingPreferenceBlock_non_doc_comments;
public static String DefaultCFoldingPreferenceBlock_headers;
public static String DefaultCFoldingPreferenceBlock_inactive_code;
public static String DefaultCFoldingPreferenceBlock_preprocessor_enabled;
@@ -36,4 +38,4 @@ public final class FoldingMessages extends NLS {
static {
NLS.initializeMessages(BUNDLE_NAME, FoldingMessages.class);
}
-}
\ No newline at end of file
+}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/folding/FoldingMessages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/folding/FoldingMessages.properties
index 3a6a8fd81ae..5b41567a3ba 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/folding/FoldingMessages.properties
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/folding/FoldingMessages.properties
@@ -18,6 +18,8 @@ DefaultCFoldingPreferenceBlock_functions= &Functions
DefaultCFoldingPreferenceBlock_methods= Mðods
DefaultCFoldingPreferenceBlock_structures= &Structures
DefaultCFoldingPreferenceBlock_comments= &Comments
+DefaultCFoldingPreferenceBlock_doc_comments= &Documentation Tool Comments
+DefaultCFoldingPreferenceBlock_non_doc_comments= &Non-Documentation Tool Comments
DefaultCFoldingPreferenceBlock_headers= &Header Comments
DefaultCFoldingPreferenceBlock_inactive_code= &Inactive Preprocessor Branches
DefaultCFoldingPreferenceBlock_preprocessor_enabled= Enable folding of preprocessor branches (#if/#endif)
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/PreferenceConstants.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/PreferenceConstants.java
index e7396f3e7de..d8ed62426d3 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/PreferenceConstants.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/PreferenceConstants.java
@@ -885,6 +885,26 @@ public class PreferenceConstants {
*/
public static final String EDITOR_FOLDING_COMMENTS= "editor_folding_default_comments"; //$NON-NLS-1$
+ /**
+ * A named preference that stores the value for document comment folding for the default folding provider.
+ *
+ * Value is of type Boolean
.
+ *
+ *
+ * @since 6.2
+ */
+ public static final String EDITOR_FOLDING_DOC_COMMENTS= "editor_folding_default_doc_comments"; //$NON-NLS-1$
+
+ /**
+ * A named preference that stores the value for non-document comment folding for the default folding provider.
+ *
+ * Value is of type Boolean
.
+ *
+ *
+ * @since 6.2
+ */
+ public static final String EDITOR_FOLDING_NON_DOC_COMMENTS= "editor_folding_default_non_doc_comments"; //$NON-NLS-1$
+
/**
* A named preference that stores the value for header comment folding for the default folding provider.
*
@@ -2211,6 +2231,8 @@ public class PreferenceConstants {
store.setDefault(EDITOR_FOLDING_METHODS, false);
store.setDefault(EDITOR_FOLDING_MACROS, false);
store.setDefault(EDITOR_FOLDING_COMMENTS, false);
+ store.setDefault(EDITOR_FOLDING_DOC_COMMENTS, false);
+ store.setDefault(EDITOR_FOLDING_NON_DOC_COMMENTS, false);
store.setDefault(EDITOR_FOLDING_HEADERS, true);
store.setDefault(EDITOR_FOLDING_INACTIVE_CODE, false);
store.setDefault(EDITOR_FOLDING_PREPROCESSOR_BRANCHES_ENABLED, false);