List of usage examples for org.eclipse.jdt.core.compiler ITerminalSymbols TokenNameLBRACE
int TokenNameLBRACE
To view the source code for org.eclipse.jdt.core.compiler ITerminalSymbols TokenNameLBRACE.
Click Source Link
From source file:com.cb.eclipse.folding.java.calculation.AbstractBlockStrategy.java
License:Open Source License
/** * Push left braces, pop right braces and calculate the distance in between * as a region.// ww w .j av a 2s . c o m * * @see com.cb.eclipse.folding.java.calculation.RegionCalculationStrategy#handle(int, * int, int, org.eclipse.jdt.core.IJavaElement) */ public void handle(int token, int start, int end, IJavaElement owner) throws JavaModelException { boolean collapseComments = FoldingPlugin.getPrefs().getBoolean(PreferenceKeys.COLLAPSE_COMMENT_BLOCKS); boolean collapseJavadoc = FoldingPlugin.getPrefs().getBoolean(PreferenceKeys.COLLAPSE_JAVADOCS); switch (token) { case ITerminalSymbols.TokenNameLBRACE: { pushBrace(start); helper.end(); break; } case ITerminalSymbols.TokenNameRBRACE: { if (hasUsablePeer()) { int oldStart = popBrace(); helper.end(); if (shouldFold(owner, token)) { boolean doCollapse = shouldCollapse(owner, token); boolean shouldNegate = shouldFilterLastLine(owner, token); addRegion(new EnhancedPosition(oldStart, end - oldStart, new JavaPositionMetadata(false, shouldNegate, doCollapse, true, getClass().getName()))); } } else { System.out.println("Bad brace found... omitting!"); } break; } default: { if (digestComments) helper.handle(token, start, end, owner); } } }