本文整理汇总了Java中org.eclipse.jdt.core.search.TypeNameRequestor类的典型用法代码示例。如果您正苦于以下问题:Java TypeNameRequestor类的具体用法?Java TypeNameRequestor怎么用?Java TypeNameRequestor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TypeNameRequestor类属于org.eclipse.jdt.core.search包,在下文中一共展示了TypeNameRequestor类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: refreshSearchIndices
import org.eclipse.jdt.core.search.TypeNameRequestor; //导入依赖的package包/类
private void refreshSearchIndices(IProgressMonitor monitor) throws InvocationTargetException {
try {
new SearchEngine().searchAllTypeNames(
null,
0,
// make sure we search a concrete name. This is faster according to Kent
"_______________".toCharArray(), //$NON-NLS-1$
SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE,
IJavaSearchConstants.ENUM,
SearchEngine.createWorkspaceScope(),
new TypeNameRequestor() { /* dummy */},
IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
monitor);
} catch (JavaModelException e) {
throw new InvocationTargetException(e);
}
}
示例2: refreshSearchIndices
import org.eclipse.jdt.core.search.TypeNameRequestor; //导入依赖的package包/类
private void refreshSearchIndices(IProgressMonitor monitor) throws InvocationTargetException {
try {
new SearchEngine().searchAllTypeNames(
null,
0,
// make sure we search a concrete name. This is faster according to Kent
"_______________".toCharArray(), //$NON-NLS-1$
SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE,
IJavaSearchConstants.ENUM,
SearchEngine.createWorkspaceScope(),
new TypeNameRequestor() {},
IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
monitor);
} catch (JavaModelException e) {
throw new InvocationTargetException(e);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:18,代码来源:FilteredTypesSelectionDialog.java
示例3: waitUntilIndexesReady
import org.eclipse.jdt.core.search.TypeNameRequestor; //导入依赖的package包/类
public static void waitUntilIndexesReady() {
// dummy query for waiting until the indexes are ready
SearchEngine engine = new SearchEngine();
IJavaSearchScope scope = SearchEngine.createWorkspaceScope();
try {
engine.searchAllTypeNames(
null,
SearchPattern.R_EXACT_MATCH,
"[email protected]$#[email protected]".toCharArray(),
SearchPattern.R_PATTERN_MATCH | SearchPattern.R_CASE_SENSITIVE,
IJavaSearchConstants.CLASS,
scope,
new TypeNameRequestor() {
public void acceptType(
int modifiers,
char[] packageName,
char[] simpleTypeName,
char[][] enclosingTypeNames,
String path) {}
},
IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
null);
} catch (CoreException e) {
}
}
示例4: waitUntilIndexesReady
import org.eclipse.jdt.core.search.TypeNameRequestor; //导入依赖的package包/类
public static void waitUntilIndexesReady() {
// dummy query for waiting until the indexes are ready
SearchEngine engine = new SearchEngine();
IJavaSearchScope scope = SearchEngine.createWorkspaceScope();
try {
engine.searchAllTypeNames(null, SearchPattern.R_EXACT_MATCH, "[email protected]$#[email protected]".toCharArray(), SearchPattern.R_PATTERN_MATCH | SearchPattern.R_CASE_SENSITIVE,
IJavaSearchConstants.CLASS, scope, new TypeNameRequestor() {
public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path) {
}
}, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, null);
} catch (CoreException e) {
}
}
示例5: searchJavaType
import org.eclipse.jdt.core.search.TypeNameRequestor; //导入依赖的package包/类
public static void searchJavaType(String matchString, IJavaSearchScope scope,
TypeNameRequestor requestor) throws JavaModelException
{
char[] searchPkg = null;
char[] searchType = null;
if (matchString != null && matchString.length() > 0)
{
char[] match = matchString.toCharArray();
int lastDotPos = matchString.lastIndexOf('.');
if (lastDotPos == -1)
{
searchType = match;
}
else
{
if (lastDotPos + 1 < match.length)
{
searchType = CharOperation.lastSegment(match, '.');
}
searchPkg = Arrays.copyOfRange(match, 0, lastDotPos);
}
}
SearchEngine searchEngine = new SearchEngine();
searchEngine.searchAllTypeNames(searchPkg, SearchPattern.R_PREFIX_MATCH, searchType,
SearchPattern.R_CAMELCASE_MATCH, IJavaSearchConstants.CLASS, scope, requestor,
IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, null);
}
示例6: internalGetAllElements
import org.eclipse.jdt.core.search.TypeNameRequestor; //导入依赖的package包/类
/**
* Returns an appropriate scope consisting of allowed Java class types
* {@link Boolean}, {@link Double}, {@link Integer} and {@link String}.
*/
@Override
protected Iterable<IEObjectDescription> internalGetAllElements() {
IJavaProject javaProject = getTypeProvider().getJavaProject();
if (javaProject == null)
return Collections.emptyList();
final List<IEObjectDescription> allScopedElements = Lists.newArrayListWithExpectedSize(25000);
try {
IJavaSearchScope searchScope = SearchEngine.createJavaSearchScope(new IJavaElement[] { javaProject });
// don't add primitives, we handle them as keywords
TypeNameRequestor nameMatchRequestor = new TypeNameRequestor() {
@Override
public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName,
char[][] enclosingTypeNames, String path) {
StringBuilder fqName = new StringBuilder(packageName.length + simpleTypeName.length + 1);
if (packageName.length != 0) {
fqName.append(packageName);
fqName.append('.');
}
for (char[] enclosingType : enclosingTypeNames) {
fqName.append(enclosingType);
fqName.append('.');
}
fqName.append(simpleTypeName);
String fullyQualifiedName = fqName.toString();
InternalEObject proxy = createProxy(fullyQualifiedName);
Map<String, String> userData = null;
if (enclosingTypeNames.length == 0) {
userData = ImmutableMap.of("flags", String.valueOf(modifiers));
} else {
userData = ImmutableMap.of("flags", String.valueOf(modifiers), "inner", "true");
}
IEObjectDescription eObjectDescription = EObjectDescription
.create(getQualifiedNameConverter().toQualifiedName(fullyQualifiedName), proxy, userData);
if (eObjectDescription != null)
allScopedElements.add(eObjectDescription);
}
};
// start of modified code
for (String allowedType : allowedJavaClassTypes) {
new SearchEngine().searchAllTypeNames("java.lang".toCharArray(), SearchPattern.R_EXACT_MATCH,
allowedType.toCharArray(), SearchPattern.R_EXACT_MATCH, IJavaSearchConstants.CLASS, searchScope,
nameMatchRequestor, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, new NullProgressMonitor());
}
// end of modified code
} catch (JavaModelException e) {
// ignore
}
return allScopedElements;
}
示例7: TypeNameRequestorWrapper
import org.eclipse.jdt.core.search.TypeNameRequestor; //导入依赖的package包/类
public TypeNameRequestorWrapper(TypeNameRequestor requestor) {
this.requestor = requestor;
}
示例8: proposeJavaType
import org.eclipse.jdt.core.search.TypeNameRequestor; //导入依赖的package包/类
public static List<ICompletionProposal> proposeJavaType(IJavaProject project, final int start,
final int length, boolean includeAlias, String matchString)
{
final List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
if (includeAlias)
{
Map<String, String> aliasMap = TypeAliasCache.getInstance().searchTypeAliases(project,
matchString);
for (Entry<String, String> entry : aliasMap.entrySet())
{
String qualifiedName = entry.getKey();
String alias = entry.getValue();
proposals.add(new JavaCompletionProposal(alias, start, length, alias.length(),
Activator.getIcon("/icons/mybatis-alias.png"), alias + " - " + qualifiedName, null,
null, 200));
}
}
int includeMask = IJavaSearchScope.SOURCES | IJavaSearchScope.REFERENCED_PROJECTS;
// Include application libraries only when package is specified (for better performance).
boolean pkgSpecified = matchString != null && matchString.indexOf('.') > 0;
if (pkgSpecified)
includeMask |= IJavaSearchScope.APPLICATION_LIBRARIES;
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaProject[]{
project
}, includeMask);
TypeNameRequestor requestor = new JavaTypeNameRequestor()
{
@Override
public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName,
char[][] enclosingTypeNames, String path)
{
if (Flags.isAbstract(modifiers) || Flags.isInterface(modifiers))
return;
addJavaTypeProposal(proposals, start, length, packageName, simpleTypeName,
enclosingTypeNames);
}
};
try
{
searchJavaType(matchString, scope, requestor);
}
catch (JavaModelException e)
{
Activator.log(Status.ERROR, e.getMessage(), e);
}
return proposals;
}
示例9: proposeImplementation
import org.eclipse.jdt.core.search.TypeNameRequestor; //导入依赖的package包/类
private static List<ICompletionProposal> proposeImplementation(IJavaProject project,
final int start, final int length, String matchString, String interfaceFqn)
{
final List<ICompletionProposal> results = new ArrayList<ICompletionProposal>();
IType interfaceType;
IJavaSearchScope scope;
try
{
interfaceType = project.findType(interfaceFqn);
if (interfaceType == null)
return results;
scope = SearchEngine.createHierarchyScope(interfaceType);
final Map<String, String> aliasMap = TypeAliasCache.getInstance()
.searchTypeAliases(project, matchString);
TypeNameRequestor requestor = new JavaTypeNameRequestor()
{
@Override
public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName,
char[][] enclosingTypeNames, String path)
{
// Ignore abstract classes.
if (Flags.isAbstract(modifiers) || Arrays.equals(JAVA_LANG, packageName))
return;
addJavaTypeProposal(results, start, length, packageName, simpleTypeName,
enclosingTypeNames);
String qualifiedName = NameUtil.buildQualifiedName(packageName, simpleTypeName,
enclosingTypeNames, true);
String alias = aliasMap.get(qualifiedName);
if (alias != null)
{
results.add(new JavaCompletionProposal(alias, start, length, alias.length(),
Activator.getIcon("/icons/mybatis-alias.png"), alias + " - " + qualifiedName,
null, null, 200));
}
}
};
searchJavaType(matchString, scope, requestor);
}
catch (JavaModelException e)
{
Activator.log(Status.ERROR, e.getMessage(), e);
}
return results;
}