Example usage for org.eclipse.jdt.core.search TypeNameMatch getTypeContainerName

List of usage examples for org.eclipse.jdt.core.search TypeNameMatch getTypeContainerName

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.search TypeNameMatch getTypeContainerName.

Prototype

public String getTypeContainerName() 

Source Link

Document

Name of the type container using '.'

Usage

From source file:org.flowerplatform.editor.model.java.JavaTypeNameRequestor.java

License:Open Source License

@Override
public void acceptTypeNameMatch(TypeNameMatch match) {
    String fullyQualifiedName = match.getFullyQualifiedName();
    String simpleName = match.getSimpleTypeName();
    String pck = match.getPackageName();
    String containerType = match.getTypeContainerName();
    if (containerType.length() > 0) {
        pck = containerType;/*w  ww. j a va 2 s  . co  m*/
    }
    String iconUrl = getIconUrl(match.getType());
    ContentAssistItem item = new ContentAssistItem(fullyQualifiedName, simpleName, pck, iconUrl);
    matches.add(item);

    if (matches.size() == IContentAssist.MAX_TYPES_COUNT) {
        progressMonitor.setCanceled(true);
    }
}

From source file:org.jboss.tools.vscode.java.internal.handlers.WorkspaceSymbolHandler.java

License:Open Source License

private List<SymbolInformation> search(String query) {
    try {// w  ww  . ja  v a  2  s.c o  m
        ArrayList<SymbolInformation> symbols = new ArrayList<SymbolInformation>();

        new SearchEngine().searchAllTypeNames(null, SearchPattern.R_PATTERN_MATCH, query.toCharArray(),
                SearchPattern.R_PREFIX_MATCH, IJavaSearchConstants.TYPE, createSearchScope(),
                new TypeNameMatchRequestor() {

                    @Override
                    public void acceptTypeNameMatch(TypeNameMatch match) {
                        SymbolInformation symbolInformation = new SymbolInformation();
                        symbolInformation.setContainerName(match.getTypeContainerName());
                        symbolInformation.setName(match.getSimpleTypeName());
                        symbolInformation.setKind(new Double(DocumentSymbolHandler.mapKind(match.getType())));
                        Location location = new Location();
                        location.setUri(match.getType().getResource().getLocationURI().toString());
                        location.setRange(new Range()
                                .withEnd(new Position().withLine(Double.valueOf(0))
                                        .withCharacter(Double.valueOf(0)))
                                .withStart(new Position().withLine(Double.valueOf(0))
                                        .withCharacter(Double.valueOf(0))));
                        symbols.add(symbolInformation.withLocation(location));
                    }
                }, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, new NullProgressMonitor());

        return symbols;
    } catch (JavaModelException e) {
        JavaLanguageServerPlugin.logException("Problem getting search for" + query, e);
    }
    return Collections.emptyList();
}