* TODO investigate using shouldScan and sourceRef.getContents()...
*
* @see com.cb.eclipse.folding.calculation.CalculationStrategy#shouldScan(org.eclipse.jdt.core.IJavaElement)
*/
public void postScan(int position, IJavaElement elem) throws JavaModelException {
ISourceRange range = getNaturalRange(elem);
IType type = (IType) elem;
boolean collapse;
boolean fold;
boolean negateLine = FoldingPlugin.getBoolean(PreferenceKeys.LAST_LINE_TYPES);
if (type.getDeclaringType() != null) { // inner class
collapse = FoldingPlugin.getBoolean(PreferenceKeys.COLLAPSE_INNER_TYPES);
fold = FoldingPlugin.getBoolean(PreferenceKeys.FOLD_INNER_TYPES);
}
else { // top level type
collapse = FoldingPlugin.getBoolean(PreferenceKeys.COLLAPSE_TOP_TYPES);
fold = FoldingPlugin.getBoolean(PreferenceKeys.FOLD_TOP_TYPES);
}
if (fold) {
addRegion(new EnhancedPosition(position, range.getOffset() + (range.getLength() - position), new JavaPositionMetadata(false, negateLine, collapse, false, null)));
}
}