Bug 112586 [api] add support for toggling folding for IJavaElement's
For tools that want to use the IJavaFoldingStructureProviderExtension, but want finer-grained control of what to collapse, it would be useful to have the following methods: - collapseElements(List<IJavaElement> elements) - expandElements(List<IJavaElement> elements) My use case is Mylar, which currently needs to set it's own folding structure provider, but with this could simply use the default one and drive the folding based on selections. Note that for selections this would only be getting called with a single element, but when a file is opened it would need to be called with a list, hance the suggest to take lists (or arrays if JDT is not moving to Java 5).
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/folding/DefaultJavaFoldingStructureProvider.java
newDeletions.add(match.annotation);
			}
		}
		deletions.addAll(newDeletions);
		changes.addAll(newChanges);
	}
	/**
	 * Finds a match for <code>tuple</code> in a collection of
	 * annotations. The positions for the
	 * <code>JavaProjectionAnnotation</code> instances in
	 * <code>annotations</code> can be found in the passed
	 * <code>positionMap</code> or <code>fCachedModel</code> if
	 * <code>positionMap</code> is <code>null</code>.
	 * <p>
	 * A tuple is said to match another if their annotations have the
	 * same comment flag and their position offsets are equal.
	 * </p>
	 * <p>
	 * If a match is found, the annotation gets removed from
	 * <code>annotations</code>.
	 * </p>
	 * 
	 * @param tuple the tuple for which we want to find a match
	 * @param annotations collection of
	 *        <code>JavaProjectionAnnotation</code>
	 * @param positionMap a <code>Map&lt;Annotation, Position&gt;</code>
	 *        or <code>null</code>
	 * @return a matching tuple or <code>null</code> for no match
	 */
	private Tuple findMatch(Tuple tuple, Collection annotations, Map positionMap) {