use of org.eclipse.mylyn.context.core.IInteractionElement in project mylyn.docs by eclipse.
the class ActiveFoldingListener method updateFolding.
private void updateFolding(boolean elementsDeleted) {
if (!foldingStructure.isFoldingEnabled()) {
return;
}
if (!foldingEnabled || !ContextCore.getContextManager().isContextActive()) {
foldingStructure.expandAll();
} else {
OutlineItem outline = (OutlineItem) part.getAdapter(OutlineItem.class);
if (outline != null) {
final List<OutlineItem> toExpand = new ArrayList<OutlineItem>();
outline.accept(new Visitor() {
public boolean visit(OutlineItem item) {
String identifier = bridge.getHandleIdentifier(item);
IInteractionElement element = ContextCore.getContextManager().getElement(identifier);
if (element != null && element.getInterest().isInteresting()) {
toExpand.add(item);
}
return true;
}
});
if (toExpand.isEmpty()) {
foldingStructure.collapseAll(elementsDeleted);
} else {
foldingStructure.expandElementsExclusive(toExpand, elementsDeleted);
}
}
}
}
Aggregations