/* (non-Javadoc) * @see com.cb.eclipse.folding.calculation.RegionCalculationStrategy#handle(int, int, int, org.eclipse.jdt.core.IJavaElement) */ public void handle(int nextToken, int start, int end, IJavaElement owner) throws JavaModelException { if (settings.isDefaultEnabled()) { if (nextToken == ITerminalSymbols.TokenNameCOMMENT_LINE) { if (helper.isOpeningSentinel(start, end, owner)) { trackers.push(new RegionTracker(null, start)); } else if (helper.isClosingSentinel(start, end, owner)) { int matchedStart; if (!trackers.isEmpty()) { RegionTracker tracker = (RegionTracker) trackers.pop(); matchedStart = tracker.start; boolean doCollapse = settings.isDefaultCollapsed(); EnhancedPosition newPos = new EnhancedPosition( matchedStart, end - matchedStart, new JavaPositionMetadata(true, true, doCollapse, true, null)); super.addRegion(newPos); } } } } if (keepProcessingChild) { super.handle(nextToken, start, end, owner); } }
public UserDefinedStrategy(RegionCalculationStrategy wrapped) { super(wrapped); helper = new UserDefinedRegionHelper(); settings = FoldingPlugin.getJavaDomain().getUserDefinedSettings(); matchingTags = settings.getNames(); trackers = new Stack(); }