Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 114971 Details for
Bug 250685
[assist] Code assist can bot be canceled when search indexes are not ready
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
250685_001.txt (text/plain), 6.74 KB, created by
David Audel
on 2008-10-13 15:56:54 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
David Audel
Created:
2008-10-13 15:56:54 EDT
Size:
6.74 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/CancelableNameEnvironment.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CancelableNameEnvironment.java,v >retrieving revision 1.8 >diff -u -r1.8 CancelableNameEnvironment.java >--- model/org/eclipse/jdt/internal/core/CancelableNameEnvironment.java 6 Sep 2006 14:50:08 -0000 1.8 >+++ model/org/eclipse/jdt/internal/core/CancelableNameEnvironment.java 13 Oct 2008 19:56:11 -0000 >@@ -50,8 +50,8 @@ > return super.findType(compoundTypeName); > } > >- public void findTypes(char[] prefix, boolean findMembers, boolean camelCaseMatch, int searchFor, ISearchRequestor storage) { >+ public void findTypes(char[] prefix, boolean findMembers, boolean camelCaseMatch, int searchFor, ISearchRequestor storage, IProgressMonitor progressMonitor) { > checkCanceled(); >- super.findTypes(prefix, findMembers, camelCaseMatch, searchFor, storage); >+ super.findTypes(prefix, findMembers, camelCaseMatch, searchFor, storage, progressMonitor); > } > } >Index: model/org/eclipse/jdt/internal/core/SearchableEnvironment.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SearchableEnvironment.java,v >retrieving revision 1.73 >diff -u -r1.73 SearchableEnvironment.java >--- model/org/eclipse/jdt/internal/core/SearchableEnvironment.java 27 Jun 2008 16:03:50 -0000 1.73 >+++ model/org/eclipse/jdt/internal/core/SearchableEnvironment.java 13 Oct 2008 19:56:11 -0000 >@@ -293,7 +293,28 @@ > * types are found relative to their enclosing type. > */ > public void findTypes(char[] prefix, final boolean findMembers, boolean camelCaseMatch, int searchFor, final ISearchRequestor storage) { >- >+ findTypes(prefix, findMembers, camelCaseMatch, searchFor, storage, null); >+ } >+ /** >+ * Must be used only by CompletionEngine. >+ * The progress monitor is used to be able to cancel completion operations >+ * >+ * Find the top-level types that are defined >+ * in the current environment and whose name starts with the >+ * given prefix. The prefix is a qualified name separated by periods >+ * or a simple name (ex. java.util.V or V). >+ * >+ * The types found are passed to one of the following methods (if additional >+ * information is known about the types): >+ * ISearchRequestor.acceptType(char[][] packageName, char[] typeName) >+ * ISearchRequestor.acceptClass(char[][] packageName, char[] typeName, int modifiers) >+ * ISearchRequestor.acceptInterface(char[][] packageName, char[] typeName, int modifiers) >+ * >+ * This method can not be used to find member types... member >+ * types are found relative to their enclosing type. >+ */ >+ public void findTypes(char[] prefix, final boolean findMembers, boolean camelCaseMatch, int searchFor, final ISearchRequestor storage, IProgressMonitor monitor) { >+ > /* > if (true){ > findTypes(new String(prefix), storage, NameLookup.ACCEPT_CLASSES | NameLookup.ACCEPT_INTERFACES); >@@ -371,24 +392,53 @@ > storage.acceptType(packageName, simpleTypeName, enclosingTypeNames, modifiers, access); > } > }; >- try { >- int matchRule = SearchPattern.R_PREFIX_MATCH; >- if (camelCaseMatch) matchRule |= SearchPattern.R_CAMELCASE_MATCH; >- new BasicSearchEngine(this.workingCopies).searchAllTypeNames( >- qualification, >- SearchPattern.R_EXACT_MATCH, >- simpleName, >- matchRule, // not case sensitive >- searchFor, >- getSearchScope(), >- typeRequestor, >- CANCEL_IF_NOT_READY_TO_SEARCH, >- progressMonitor); >- } catch (OperationCanceledException e) { >- findTypes( >- new String(prefix), >- storage, >- convertSearchFilterToModelFilter(searchFor)); >+ >+ int matchRule = SearchPattern.R_PREFIX_MATCH; >+ if (camelCaseMatch) matchRule |= SearchPattern.R_CAMELCASE_MATCH; >+ if (monitor != null) { >+ found : while (true) { //the loop will finish if the search request ends or is cancelled >+ try { >+ new BasicSearchEngine(this.workingCopies).searchAllTypeNames( >+ qualification, >+ SearchPattern.R_EXACT_MATCH, >+ simpleName, >+ matchRule, // not case sensitive >+ searchFor, >+ getSearchScope(), >+ typeRequestor, >+ CANCEL_IF_NOT_READY_TO_SEARCH, >+ progressMonitor); >+ break found; >+ } catch (OperationCanceledException e) { >+ if (monitor.isCanceled()) { >+ throw e; >+ } else { >+ try { >+ Thread.sleep(50); // indexes are not ready. sleep 50ms and retry the search request >+ } catch (InterruptedException e1) { >+ // Do nothing >+ } >+ } >+ } >+ } >+ } else { >+ try { >+ new BasicSearchEngine(this.workingCopies).searchAllTypeNames( >+ qualification, >+ SearchPattern.R_EXACT_MATCH, >+ simpleName, >+ matchRule, // not case sensitive >+ searchFor, >+ getSearchScope(), >+ typeRequestor, >+ CANCEL_IF_NOT_READY_TO_SEARCH, >+ progressMonitor); >+ } catch (OperationCanceledException e) { >+ findTypes( >+ new String(prefix), >+ storage, >+ convertSearchFilterToModelFilter(searchFor)); >+ } > } > } catch (JavaModelException e) { > findTypes( >Index: codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java,v >retrieving revision 1.378 >diff -u -r1.378 CompletionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 10 Oct 2008 07:28:58 -0000 1.378 >+++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 13 Oct 2008 19:56:11 -0000 >@@ -619,6 +619,8 @@ > } > > private void acceptTypes(Scope scope) { >+ this.checkCancel(); >+ > if(this.acceptedTypes == null) return; > > int length = this.acceptedTypes.size(); >@@ -6263,7 +6265,8 @@ > findMembers, > this.options.camelCaseMatch, > IJavaSearchConstants.TYPE, >- this); >+ this, >+ this.monitor); > acceptTypes(null); > } > } >@@ -9199,7 +9202,8 @@ > proposeAllMemberTypes, > this.options.camelCaseMatch, > searchFor, >- this); >+ this, >+ this.monitor); > acceptTypes(scope); > } > if(!isEmptyPrefix && !this.requestor.isIgnored(CompletionProposal.PACKAGE_REF)) { >@@ -9337,7 +9341,8 @@ > false, > this.options.camelCaseMatch, > searchFor, >- this); >+ this, >+ this.monitor); > acceptTypes(scope); > } > if(!this.requestor.isIgnored(CompletionProposal.PACKAGE_REF)) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 250685
: 114971