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 75775 Details for
Bug 138184
[search] Type Dialog (Could not uniquely map the name to a type)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
v00.txt (text/plain), 11.67 KB, created by
Frederic Fusier
on 2007-08-09 12:43:45 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2007-08-09 12:43:45 EDT
Size:
11.67 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: search/org/eclipse/jdt/internal/core/search/matching/IntersectingPattern.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/IntersectingPattern.java,v >retrieving revision 1.1 >diff -u -r1.1 IntersectingPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/IntersectingPattern.java 4 Jul 2007 13:59:58 -0000 1.1 >+++ search/org/eclipse/jdt/internal/core/search/matching/IntersectingPattern.java 9 Aug 2007 16:44:18 -0000 >@@ -67,10 +67,11 @@ > } > > String containerPath = index.containerPath; >+ String separator = index.separator; > Object[] names = intersectedNames.values; > for (int i = 0, l = names.length; i < l; i++) > if (names[i] != null) >- ((InternalSearchPattern) this).acceptMatch((String) names[i], containerPath, null/*no pattern*/, requestor, participant, scope); // AndPatterns cannot provide the decoded result >+ ((InternalSearchPattern) this).acceptMatch((String) names[i], containerPath, separator, null/*no pattern*/, requestor, participant, scope); // AndPatterns cannot provide the decoded result > } > /** > * Returns whether another query must be done. >Index: search/org/eclipse/jdt/internal/core/search/matching/InternalSearchPattern.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/InternalSearchPattern.java,v >retrieving revision 1.11 >diff -u -r1.11 InternalSearchPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/InternalSearchPattern.java 12 Apr 2005 20:40:24 -0000 1.11 >+++ search/org/eclipse/jdt/internal/core/search/matching/InternalSearchPattern.java 9 Aug 2007 16:44:18 -0000 >@@ -33,7 +33,7 @@ > int kind; > boolean mustResolve = true; > >- void acceptMatch(String relativePath, String containerPath, SearchPattern pattern, IndexQueryRequestor requestor, SearchParticipant participant, IJavaSearchScope scope) { >+ void acceptMatch(String relativePath, String containerPath, String separator, SearchPattern pattern, IndexQueryRequestor requestor, SearchParticipant participant, IJavaSearchScope scope) { > > if (scope instanceof JavaSearchScope) { > JavaSearchScope javaSearchScope = (JavaSearchScope) scope; >@@ -41,12 +41,19 @@ > // Note that requestor has to verify if needed whether the document violates the access restriction or not > AccessRuleSet access = javaSearchScope.getAccessRuleSet(relativePath, containerPath); > if (access != JavaSearchScope.NOT_ENCLOSED) { // scope encloses the document path >- String documentPath = documentPath(containerPath, relativePath); >- if (!requestor.acceptIndexMatch(documentPath, pattern, participant, access)) >+ StringBuffer documentPath = new StringBuffer(containerPath.length() + separator.length() + relativePath.length()); >+ documentPath.append(containerPath); >+ documentPath.append(separator); >+ documentPath.append(relativePath); >+ if (!requestor.acceptIndexMatch(documentPath.toString(), pattern, participant, access)) > throw new OperationCanceledException(); > } > } else { >- String documentPath = documentPath(containerPath, relativePath); >+ StringBuffer buffer = new StringBuffer(containerPath.length() + separator.length() + relativePath.length()); >+ buffer.append(containerPath); >+ buffer.append(separator); >+ buffer.append(relativePath); >+ String documentPath = buffer.toString(); > if (scope.encloses(documentPath)) > if (!requestor.acceptIndexMatch(documentPath, pattern, participant, null)) > throw new OperationCanceledException(); >@@ -56,14 +63,6 @@ > SearchPattern currentPattern() { > return (SearchPattern) this; > } >- String documentPath(String containerPath, String relativePath) { >- String separator = Util.isArchiveFileName(containerPath) ? IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR : "/"; //$NON-NLS-1$ >- StringBuffer buffer = new StringBuffer(containerPath.length() + separator.length() + relativePath.length()); >- buffer.append(containerPath); >- buffer.append(separator); >- buffer.append(relativePath); >- return buffer.toString(); >- } > /** > * Query a given index for matching entries. Assumes the sender has opened the index and will close when finished. > */ >@@ -77,6 +76,7 @@ > > SearchPattern decodedResult = pattern.getBlankPattern(); > String containerPath = index.containerPath; >+ String separator = index.separator; > for (int i = 0, l = entries.length; i < l; i++) { > if (monitor != null && monitor.isCanceled()) throw new OperationCanceledException(); > >@@ -86,7 +86,7 @@ > // TODO (kent) some clients may not need the document names > String[] names = entry.getDocumentNames(index); > for (int j = 0, n = names.length; j < n; j++) >- acceptMatch(names[j], containerPath, decodedResult, requestor, participant, scope); >+ acceptMatch(names[j], containerPath, separator, decodedResult, requestor, participant, scope); > } > } > } finally { >Index: search/org/eclipse/jdt/internal/core/index/DiskIndex.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/DiskIndex.java,v >retrieving revision 1.62 >diff -u -r1.62 DiskIndex.java >--- search/org/eclipse/jdt/internal/core/index/DiskIndex.java 3 Jul 2007 16:43:01 -0000 1.62 >+++ search/org/eclipse/jdt/internal/core/index/DiskIndex.java 9 Aug 2007 16:44:18 -0000 >@@ -45,7 +45,7 @@ > private int bufferIndex, bufferEnd; // used when reading from the file into the streamBuffer > private int streamEnd; // used when writing data from the streamBuffer to the file > >-public static final String SIGNATURE= "INDEX VERSION 1.121"; //$NON-NLS-1$ >+public static final String SIGNATURE= "INDEX VERSION 1.122"; //$NON-NLS-1$ > private static final char[] SIGNATURE_CHARS = SIGNATURE.toCharArray(); > public static boolean DEBUG = false; > >Index: search/org/eclipse/jdt/internal/core/index/Index.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/Index.java,v >retrieving revision 1.25 >diff -u -r1.25 Index.java >--- search/org/eclipse/jdt/internal/core/index/Index.java 25 Jan 2007 16:05:55 -0000 1.25 >+++ search/org/eclipse/jdt/internal/core/index/Index.java 9 Aug 2007 16:44:18 -0000 >@@ -30,6 +30,7 @@ > > public String containerPath; > public ReadWriteMonitor monitor; >+public String separator = "/"; //$NON-NLS-1$ > > protected DiskIndex diskIndex; > protected MemoryIndex memoryIndex; >Index: search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java,v >retrieving revision 1.71 >diff -u -r1.71 AddJarFileToIndex.java >--- search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java 29 Mar 2006 03:13:59 -0000 1.71 >+++ search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java 9 Aug 2007 16:44:18 -0000 >@@ -22,6 +22,7 @@ > import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.Path; >+import org.eclipse.jdt.core.search.IJavaSearchScope; > import org.eclipse.jdt.core.search.SearchEngine; > import org.eclipse.jdt.core.search.SearchParticipant; > import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable; >@@ -84,6 +85,7 @@ > org.eclipse.jdt.internal.core.util.Util.verbose("-> index for " + this.containerPath + " just got deleted"); //$NON-NLS-1$//$NON-NLS-2$ > return true; // index got deleted since acquired > } >+ index.separator = IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR; > ZipFile zip = null; > try { > // this path will be a relative path to the workspace in case the zipfile in the workspace otherwise it will be a path in the >@@ -181,6 +183,7 @@ > manager.removeIndex(this.containerPath); > return false; > } >+ index.separator = IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR; > > for (Enumeration e = zip.entries(); e.hasMoreElements();) { > if (this.isCancelled) { >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/JavaSearchMultipleProjectsTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchMultipleProjectsTests.java,v >retrieving revision 1.42 >diff -u -r1.42 JavaSearchMultipleProjectsTests.java >--- src/org/eclipse/jdt/core/tests/model/JavaSearchMultipleProjectsTests.java 16 Mar 2007 18:35:31 -0000 1.42 >+++ src/org/eclipse/jdt/core/tests/model/JavaSearchMultipleProjectsTests.java 9 Aug 2007 16:44:21 -0000 >@@ -918,4 +918,86 @@ > deleteProject("P"); > } > } >+ >+/** >+ * @bug 199392: [search] Type Dialog Error 'Items filtering ... Reason: Class file name must end with .class' >+ * @test Ensure that types are found even in project which name ends either with ".jar" or ".zip" >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=199392" >+ */ >+public void testONLY_Bug199392_Jar() throws CoreException { >+ try { >+ IJavaProject project = createJavaProject("Test.jar"); >+ createFolder("/Test.jar/test"); >+ createFile( >+ "/Test.jar/test/MyClass.java", >+ "package test;\n" + >+ "public class MyClass {\n" + >+ "}\n" >+ ); >+ >+ // Search all type names with TypeNameMatchRequestor >+ AbstractJavaSearchTests.TypeNameMatchCollector collector = new AbstractJavaSearchTests.TypeNameMatchCollector() { >+ public String toString(){ >+ return toFullyQualifiedNamesString(); >+ } >+ }; >+ IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { project }); >+ new SearchEngine().searchAllTypeNames( >+ null, >+ SearchPattern.R_EXACT_MATCH, >+ new char[] { 'M', 'y' }, >+ SearchPattern.R_CAMELCASE_MATCH, >+ IJavaSearchConstants.TYPE, >+ scope, >+ collector, >+ IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, >+ null); >+ // Should have same types with these 2 searches >+ assertEquals("Invalid number of types found!", 1, collector.size()); >+ assertEquals("Found types sounds not to be correct", >+ "test.MyClass", >+ collector.toString() >+ ); >+ } finally { >+ deleteProject("Test.jar"); >+ } >+} >+public void testONLY_Bug199392_Zip() throws CoreException { >+ try { >+ IJavaProject project = createJavaProject("Test.zip"); >+ createFolder("/Test.zip/test"); >+ createFile( >+ "/Test.zip/test/MyClass.java", >+ "package test;\n" + >+ "public class MyClass {\n" + >+ "}\n" >+ ); >+ >+ // Search all type names with TypeNameMatchRequestor >+ AbstractJavaSearchTests.TypeNameMatchCollector collector = new AbstractJavaSearchTests.TypeNameMatchCollector() { >+ public String toString(){ >+ return toFullyQualifiedNamesString(); >+ } >+ }; >+ IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { project }); >+ new SearchEngine().searchAllTypeNames( >+ null, >+ SearchPattern.R_EXACT_MATCH, >+ new char[] { 'M', 'y' }, >+ SearchPattern.R_CAMELCASE_MATCH, >+ IJavaSearchConstants.TYPE, >+ scope, >+ collector, >+ IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, >+ null); >+ // Should have same types with these 2 searches >+ assertEquals("Invalid number of types found!", 1, collector.size()); >+ assertEquals("Found types sounds not to be correct", >+ "test.MyClass", >+ collector.toString() >+ ); >+ } finally { >+ deleteProject("Test.zip"); >+ } >+} > }
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 138184
:
39273
|
75775
|
75822
|
118873
|
120216
|
120225