本文整理了Java中org.eclipse.jdt.core.ToolFactory.createScanner()
方法的一些代码示例,展示了ToolFactory.createScanner()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ToolFactory.createScanner()
方法的具体详情如下:
包路径:org.eclipse.jdt.core.ToolFactory
类名称:ToolFactory
方法名:createScanner
[英]Create a scanner, indicating the level of detail requested for tokenizing. The scanner can then be used to tokenize some source in a Java aware way. Here is a typical scanning loop: <<$0$>>
By default the compliance used to create the scanner is the workspace's compliance when running inside the IDE or 1.4 if running from outside of a headless eclipse.
[中]创建一个扫描器,指示标记化所需的详细程度。然后可以使用扫描器以Java感知的方式标记某些源代码。这是一个典型的扫描循环:<<$0$>>
默认情况下,当在IDE内部运行时,用于创建扫描仪的符合性是工作区的符合性,如果从无头eclipse外部运行,则为1.4。
代码示例来源:origin: eclipse/eclipse.jdt.ls
public Collector(IPackageFragment source, ReferencesInBinaryContext binaryRefs) {
super(binaryRefs);
fSource= source;
fScanner= ToolFactory.createScanner(false, false, false, false);
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
public Collector(IPackageFragment source, ReferencesInBinaryContext binaryRefs) {
super(binaryRefs);
fSource= source;
fScanner= ToolFactory.createScanner(false, false, false, false);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
private IScanner getScanner() {
if (fScanner == null)
fScanner= ToolFactory.createScanner(true, false, false, false);
return fScanner;
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
private IScanner getScanner() {
if (fScanner == null)
fScanner= ToolFactory.createScanner(true, false, false, false);
return fScanner;
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
private IScanner getScanner() {
if (fScanner == null)
fScanner= ToolFactory.createScanner(true, false, false, false);
return fScanner;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
public Collector(IPackageFragment source, ReferencesInBinaryContext binaryRefs) {
super(binaryRefs);
fSource= source;
fScanner= ToolFactory.createScanner(false, false, false, false);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
public static NLSLine[] scan(String s) throws InvalidInputException, BadLocationException {
IScanner scanner= ToolFactory.createScanner(true, true, false, true);
return scan(scanner, s.toCharArray());
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
/** only for testing */
public void scan(String text) {
char[] chars= text.toCharArray();
fMatches= new HashSet();
fScanner= ToolFactory.createScanner(true, true, false, true);
fScanner.setSource(chars);
doScan();
fScanner= null;
}
代码示例来源:origin: eclipse/eclipse.jdt.ls
protected IScanner getScanner(ICompilationUnit unit) {
IJavaProject project= unit.getJavaProject();
if (project.equals(fProjectCache)) {
return fScannerCache;
}
fProjectCache= project;
String sourceLevel= project.getOption(JavaCore.COMPILER_SOURCE, true);
String complianceLevel= project.getOption(JavaCore.COMPILER_COMPLIANCE, true);
fScannerCache= ToolFactory.createScanner(false, false, false, sourceLevel, complianceLevel);
return fScannerCache;
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
protected IScanner getScanner(ICompilationUnit unit) {
if (unit.equals(fCuCache))
return fScannerCache;
fCuCache= unit;
IJavaProject project= unit.getJavaProject();
String sourceLevel= project.getOption(JavaCore.COMPILER_SOURCE, true);
String complianceLevel= project.getOption(JavaCore.COMPILER_COMPLIANCE, true);
fScannerCache= ToolFactory.createScanner(false, false, false, sourceLevel, complianceLevel);
return fScannerCache;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
protected IScanner getScanner(ICompilationUnit unit) {
IJavaProject project= unit.getJavaProject();
if (project.equals(fProjectCache))
return fScannerCache;
fProjectCache= project;
String sourceLevel= project.getOption(JavaCore.COMPILER_SOURCE, true);
String complianceLevel= project.getOption(JavaCore.COMPILER_COMPLIANCE, true);
fScannerCache= ToolFactory.createScanner(false, false, false, sourceLevel, complianceLevel);
return fScannerCache;
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
protected IScanner getScanner(ICompilationUnit unit) {
IJavaProject project= unit.getJavaProject();
if (project.equals(fProjectCache))
return fScannerCache;
fProjectCache= project;
String sourceLevel= project.getOption(JavaCore.COMPILER_SOURCE, true);
String complianceLevel= project.getOption(JavaCore.COMPILER_COMPLIANCE, true);
fScannerCache= ToolFactory.createScanner(false, false, false, sourceLevel, complianceLevel);
return fScannerCache;
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
private int getLengthOfFirstTokenOf(ASTNode node) throws InvalidInputException {
IScanner scanner= ToolFactory.createScanner(true, true, false, true);
scanner.setSource(getSource(node).toCharArray());
scanner.getNextToken();
return scanner.getRawTokenSource().length;
}
代码示例来源:origin: eclipse/eclipse.jdt.ls
public static NLSLine[] scan(ICompilationUnit cu) throws JavaModelException, BadLocationException, InvalidInputException {
IJavaProject javaProject= cu.getJavaProject();
IScanner scanner= null;
if (javaProject != null) {
String complianceLevel= javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
String sourceLevel= javaProject.getOption(JavaCore.COMPILER_SOURCE, true);
scanner= ToolFactory.createScanner(true, true, true, sourceLevel, complianceLevel);
} else {
scanner= ToolFactory.createScanner(true, true, false, true);
}
return scan(scanner, cu.getBuffer().getCharacters());
}
代码示例来源:origin: eclipse/eclipse.jdt.ls
public void scan(ICompilationUnit cu) throws JavaModelException {
char[] chars= cu.getBuffer().getCharacters();
fMatches= new HashSet<>();
fScanner= ToolFactory.createScanner(true, true, false, true);
fScanner.setSource(chars);
// IImportContainer importContainer= cu.getImportContainer();
// if (importContainer.exists())
// fNoFlyZone= importContainer.getSourceRange();
// else
// fNoFlyZone= null;
doScan();
fScanner= null;
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
public static NLSLine[] scan(ICompilationUnit cu) throws JavaModelException, BadLocationException, InvalidInputException {
IJavaProject javaProject= cu.getJavaProject();
IScanner scanner= null;
if (javaProject != null) {
String complianceLevel= javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
String sourceLevel= javaProject.getOption(JavaCore.COMPILER_SOURCE, true);
scanner= ToolFactory.createScanner(true, true, true, sourceLevel, complianceLevel);
} else {
scanner= ToolFactory.createScanner(true, true, false, true);
}
return scan(scanner, cu.getBuffer().getCharacters());
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
public void scan(ICompilationUnit cu) throws JavaModelException {
char[] chars= cu.getBuffer().getCharacters();
fMatches= new HashSet<>();
fScanner= ToolFactory.createScanner(true, true, false, true);
fScanner.setSource(chars);
// IImportContainer importContainer= cu.getImportContainer();
// if (importContainer.exists())
// fNoFlyZone= importContainer.getSourceRange();
// else
// fNoFlyZone= null;
doScan();
fScanner= null;
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core.manipulation
private boolean isValidComment(String template) {
IScanner scanner= ToolFactory.createScanner(true, false, false, false);
scanner.setSource(template.toCharArray());
try {
int next= scanner.getNextToken();
while (TokenScanner.isComment(next)) {
next= scanner.getNextToken();
}
return next == ITerminalSymbols.TokenNameEOF;
} catch (InvalidInputException e) {
}
return false;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
public static NLSLine[] scan(ICompilationUnit cu) throws JavaModelException, BadLocationException, InvalidInputException {
IJavaProject javaProject= cu.getJavaProject();
IScanner scanner= null;
if (javaProject != null) {
String complianceLevel= javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
String sourceLevel= javaProject.getOption(JavaCore.COMPILER_SOURCE, true);
scanner= ToolFactory.createScanner(true, true, true, sourceLevel, complianceLevel);
} else {
scanner= ToolFactory.createScanner(true, true, false, true);
}
return scan(scanner, cu.getBuffer().getCharacters());
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
/**
* Creates a TokenScanner
* @param document The textbuffer to create the scanner on
*/
public TokenScanner(IDocument document, IJavaProject project) {
String sourceLevel= project.getOption(JavaCore.COMPILER_SOURCE, true);
String complianceLevel= project.getOption(JavaCore.COMPILER_COMPLIANCE, true);
fScanner= ToolFactory.createScanner(true, false, false, sourceLevel, complianceLevel); // no line info required
fScanner.setSource(document.get().toCharArray());
fDocument= document;
fEndPosition= fScanner.getSource().length - 1;
}
内容来源于网络,如有侵权,请联系作者删除!