Lines 15-20
Link Here
|
15 |
|
15 |
|
16 |
import org.eclipse.jdt.core.*; |
16 |
import org.eclipse.jdt.core.*; |
17 |
import org.eclipse.jdt.core.compiler.CharOperation; |
17 |
import org.eclipse.jdt.core.compiler.CharOperation; |
|
|
18 |
import org.eclipse.jdt.core.compiler.IScanner; |
19 |
import org.eclipse.jdt.core.compiler.ITerminalSymbols; |
20 |
import org.eclipse.jdt.core.compiler.InvalidInputException; |
18 |
import org.eclipse.jdt.internal.compiler.impl.Constant; |
21 |
import org.eclipse.jdt.internal.compiler.impl.Constant; |
19 |
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; |
22 |
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; |
20 |
import org.eclipse.jdt.internal.core.util.MementoTokenizer; |
23 |
import org.eclipse.jdt.internal.core.util.MementoTokenizer; |
Lines 247-252
Link Here
|
247 |
} |
250 |
} |
248 |
return lastLocalContext; |
251 |
return lastLocalContext; |
249 |
} |
252 |
} |
|
|
253 |
public ISourceRange getJavadocRange() throws JavaModelException { |
254 |
ISourceRange range= this.getSourceRange(); |
255 |
if (range == null) return null; |
256 |
IBuffer buf= this.isBinary() ? this.getClassFile().getBuffer() : this.getCompilationUnit().getBuffer(); |
257 |
final int start= range.getOffset(); |
258 |
final int length= range.getLength(); |
259 |
if (length > 0 && buf.getChar(start) == '/') { |
260 |
IScanner scanner= ToolFactory.createScanner(true, false, false, false); |
261 |
scanner.setSource(buf.getText(start, length).toCharArray()); |
262 |
try { |
263 |
int docOffset= -1; |
264 |
int docEnd= -1; |
265 |
|
266 |
int terminal= scanner.getNextToken(); |
267 |
loop: while (true) { |
268 |
switch(terminal) { |
269 |
case ITerminalSymbols.TokenNameCOMMENT_JAVADOC : |
270 |
docOffset= scanner.getCurrentTokenStartPosition(); |
271 |
docEnd= scanner.getCurrentTokenEndPosition() + 1; |
272 |
terminal= scanner.getNextToken(); |
273 |
break; |
274 |
case ITerminalSymbols.TokenNameCOMMENT_LINE : |
275 |
case ITerminalSymbols.TokenNameCOMMENT_BLOCK : |
276 |
terminal= scanner.getNextToken(); |
277 |
continue loop; |
278 |
default : |
279 |
break loop; |
280 |
} |
281 |
} |
282 |
if (docOffset != -1) { |
283 |
return new SourceRange(docOffset + start, docEnd - docOffset + 1); |
284 |
} |
285 |
} catch (InvalidInputException ex) { |
286 |
// try if there is inherited Javadoc |
287 |
} |
288 |
} |
289 |
return null; |
290 |
} |
250 |
/** |
291 |
/** |
251 |
* @see IMember |
292 |
* @see IMember |
252 |
*/ |
293 |
*/ |