changes, FoldingStructureComputationContext ctx) {
if (deletions.isEmpty() || (additions.isEmpty() && changes.isEmpty()))
return;
@@ -936,7 +1105,7 @@ public class DefaultCFoldingStructureProvider implements ICFoldingStructureProvi
while (deletionIterator.hasNext()) {
CProjectionAnnotation deleted= (CProjectionAnnotation) deletionIterator.next();
Position deletedPosition= ctx.getModel().getPosition(deleted);
- if (deletedPosition == null)
+ if (deletedPosition == null || deletedPosition.length < 5)
continue;
Tuple deletedTuple= new Tuple(deleted, deletedPosition);
@@ -977,11 +1146,11 @@ public class DefaultCFoldingStructureProvider implements ICFoldingStructureProvi
* annotations. The positions for the
* CProjectionAnnotation
instances in
* annotations
can be found in the passed
- * positionMap
or fCachedModel
if
+ * positionMap
or in the model if
* positionMap
is null
.
*
* A tuple is said to match another if their annotations have the
- * same comment flag and their position offsets are equal.
+ * same category and their position offsets are equal.
*
*
* If a match is found, the annotation gets removed from
@@ -995,12 +1164,12 @@ public class DefaultCFoldingStructureProvider implements ICFoldingStructureProvi
* or null
* @return a matching tuple or null
for no match
*/
- private Tuple findMatch(Tuple tuple, Collection annotations, Map positionMap, FoldingStructureComputationContext ctx) {
- Iterator it= annotations.iterator();
+ private Tuple findMatch(Tuple tuple, Collection annotations, Map positionMap, FoldingStructureComputationContext ctx) {
+ Iterator it= annotations.iterator();
while (it.hasNext()) {
- CProjectionAnnotation annotation= (CProjectionAnnotation) it.next();
- if (tuple.annotation.isComment() == annotation.isComment()) {
- Position position= positionMap == null ? ctx.getModel().getPosition(annotation) : (Position) positionMap.get(annotation);
+ CProjectionAnnotation annotation= it.next();
+ if (tuple.annotation.getCategory() == annotation.getCategory()) {
+ Position position= positionMap == null ? ctx.getModel().getPosition(annotation) : positionMap.get(annotation);
if (position == null)
continue;
@@ -1014,8 +1183,10 @@ public class DefaultCFoldingStructureProvider implements ICFoldingStructureProvi
return null;
}
- private Map computeCurrentStructure(FoldingStructureComputationContext ctx) {
+ private Map