protected final boolean isValidPackage(ClasspathInfo pathInfo, String pkg) { assert pathInfo != null : "ClasspathInfo can not be null"; // the following statement gives us all the packages *starting* with the // first parameter. We have to check for exact matches ourselves. See # 142372 Set<String> pkgSet = pathInfo.getClassIndex().getPackageNames(pkg, true, EnumSet.allOf(ClassIndex.SearchScope.class)); if (pkgSet.size() > 0) { LOG.log(Level.FINEST, "Packages with prefix : {0}", pkg); LOG.log(Level.FINEST, " found : {0}", pkgSet); for (String singlePkg : pkgSet) { if (singlePkg.equals(pkg)){ LOG.log(Level.FINEST, "Exact match found."); return true; } } return false; } else { return false; } }
private void addPackages(ClassIndex ci, String typedPrefix, int substitutionOffset, int queryType) { Set<SearchScope> scope = (queryType == CompletionProvider.COMPLETION_ALL_QUERY_TYPE) ? ALL : LOCAL; Set<String> packages = ci.getPackageNames(typedPrefix, true, scope); for (String pkg : packages) { if (pkg.length() > 0) { SpringXMLConfigCompletionItem item = SpringXMLConfigCompletionItem.createPackageItem(substitutionOffset, pkg, false); addCacheItem(item); } } } }
private void addPackages(ClassIndex ci, String typedPrefix, int substitutionOffset, int queryType) { Set<SearchScope> scope = (queryType == CompletionProvider.COMPLETION_ALL_QUERY_TYPE) ? ALL : LOCAL; Set<String> packages = ci.getPackageNames(typedPrefix, true, scope); for (String pkg : packages) { if (pkg.length() > 0) { SpringXMLConfigCompletionItem item = SpringXMLConfigCompletionItem.createPackageItem(substitutionOffset, pkg, false); addCacheItem(item); } } }
@Override protected List<PackageNode> getContainedPackages() { ClassIndex index = cpInfo.getClassIndex(); List<PackageNode> nodes = new ArrayList<PackageNode>(); for (String pkgName : index.getPackageNames(getNodeName() + ".", true, scope)) { // NOI18N nodes.add(new JavaPackageNode(cpInfo, pkgName, this, scope)); } return nodes; }
protected List<SelectorNode> prepareChildren(ContainerNode parent) { List<SelectorNode> pkgs = new ArrayList<SelectorNode>(); Project project = parent.getLookup().lookup(Project.class); ClasspathInfo cpInfo = ProjectUtilities.getClasspathInfo(project, subprojects, scope.contains(SearchScope.SOURCE), scope.contains(SearchScope.DEPENDENCIES)); // #170201: A misconfigured(?) project can have no source roots defined, returning NULL as its ClasspathInfo // ignore such a project if (cpInfo != null) { ClassIndex index = cpInfo.getClassIndex(); for (String pkgName : index.getPackageNames("", true, scope)) { // NOI18N pkgs.add(new JavaPackageNode(cpInfo, pkgName, parent, scope)); } Collections.sort(pkgs, PackageNode.COMPARATOR); } return pkgs; } }
Set<String> pkgSet = pathInfo.getClassIndex().getPackageNames(packageRequest.fullString, true, EnumSet.allOf(ClassIndex.SearchScope.class));
private void addPackages(Env env, String fqnPrefix, boolean inPkgStmt) { if (fqnPrefix == null) { fqnPrefix = EMPTY; } String prefix = env.getPrefix() != null ? fqnPrefix + env.getPrefix() : null; for (String pkgName : env.getController().getClasspathInfo().getClassIndex().getPackageNames(fqnPrefix, true, EnumSet.allOf(ClassIndex.SearchScope.class))) { if (startsWith(env, pkgName, prefix) && !Utilities.isExcluded(pkgName + ".")) //NOI18N { results.add(itemFactory.createPackageItem(pkgName, anchorOffset, inPkgStmt)); } } }
if (el.getEnclosedElements().isEmpty() && ci.getPackageNames(el.getSimpleName() + ".", true, EnumSet.allOf(ClassIndex.SearchScope.class)).isEmpty()) { Trees trees = controller.getTrees(); Scope scope = env.getScope();