jlahoda commented on a change in pull request #2324:
URL: https://github.com/apache/netbeans/pull/2324#discussion_r489165811



##########
File path: 
java/java.sourceui/src/org/netbeans/modules/java/source/ui/JavaSymbolProvider.java
##########
@@ -117,145 +119,187 @@ public void computeSymbolNames(final Context context, 
final Result result) {
             final Cache cache = scanInProgress ?
                 Cache.create(textToSearch, st) :
                 null;
-            String prefix = null;
-            final int dotIndex = textToSearch.lastIndexOf('.'); //NOI18N
-            if (dotIndex > 0 && dotIndex != textToSearch.length()-1) {
-                prefix = textToSearch.substring(0, dotIndex);
-                textToSearch = textToSearch.substring(dotIndex+1);
-            }
-            final String textToHighLight = textToSearch;
-            ClassIndex.NameKind _kind;
-            boolean _caseSensitive;
-            switch (st) {
-                case PREFIX:
-                    _kind = ClassIndex.NameKind.PREFIX;
-                    _caseSensitive = true;
-                    break;
-                case REGEXP:
-                    _kind = ClassIndex.NameKind.REGEXP;
-                    textToSearch = NameMatcherFactory.wildcardsToRegexp(
-                            removeNonJavaChars(textToSearch),
-                            true);
-                    _caseSensitive = true;
-                    break;
-                case CAMEL_CASE:
-                    _kind = ClassIndex.NameKind.CAMEL_CASE;
-                    _caseSensitive = true;
-                    break;
-                case CASE_INSENSITIVE_CAMEL_CASE:
-                    _kind = ClassIndex.NameKind.CAMEL_CASE_INSENSITIVE;
-                    _caseSensitive = false;
-                    break;
-                case EXACT_NAME:
-                    _kind = ClassIndex.NameKind.SIMPLE_NAME;
-                    _caseSensitive = true;
-                    break;
-                case CASE_INSENSITIVE_PREFIX:
-                    _kind = ClassIndex.NameKind.CASE_INSENSITIVE_PREFIX;
-                    _caseSensitive = false;
-                    break;
-                case CASE_INSENSITIVE_EXACT_NAME:
-                    _kind = ClassIndex.NameKind.CASE_INSENSITIVE_REGEXP;
-                    _caseSensitive = false;
-                    break;
-                case CASE_INSENSITIVE_REGEXP:
-                    _kind = ClassIndex.NameKind.CASE_INSENSITIVE_REGEXP;
-                    textToSearch = NameMatcherFactory.wildcardsToRegexp(
-                            removeNonJavaChars(textToSearch),
-                            true);
-                    _caseSensitive = false;
-                    break;
-                default:
-                    throw new IllegalArgumentException();
-            }
-            final String ident = textToSearch;
-            final ClassIndex.NameKind kind = _kind;
-            final boolean caseSensitive = _caseSensitive;
-            final Pair<NameMatcher,Boolean> restriction;
-            if (prefix != null) {
-                restriction = compileName(prefix,caseSensitive);
-                result.setHighlightText(textToHighLight);
-            } else {
-                restriction = null;
-            }
-            try {
-                final ClassIndexManager manager = 
ClassIndexManager.getDefault();
-
-                Collection<FileObject> roots = QuerySupport.findRoots(
-                        (Project)null,
-                        Collections.singleton(ClassPath.SOURCE),
-                        Collections.<String>emptySet(),
-                        Collections.<String>emptySet());
-
-                final Set<URL> rootUrls = new HashSet<>();
-                for(FileObject root : roots) {
-                    if (canceled) {
-                        return;
+            doComputeSymbols(st, textToSearch, new ResultHandler() {
+                private FileObject root;
+                private ProjectInformation projectInfo;
+                private ClassIndexImpl ci;
+                @Override
+                public void setHighlightText(String text) {
+                    result.setHighlightText(text);
+                }
+
+                @Override
+                public void runRoot(FileObject root, ClassIndexImpl ci, Exec 
exec) throws IOException, InterruptedException {
+                    try {
+                        Project project = FileOwnerQuery.getOwner(root);
+
+                        this.root = root;
+                        this.projectInfo = project == null ?
+                                null :
+                                
project.getLookup().lookup(ProjectInformation.class);   //Intentionally does 
not use ProjectUtils.getInformation() it does project icon annotation which is 
expensive

Review comment:
       Intentionally not using ProjectUtils at this place.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to