View | Details | Raw Unified | Return to bug 348507 | Differences between
and this patch

Collapse All | Expand All

(-)search/org/eclipse/jdt/internal/core/search/IndexSelector.java (-7 / +7 lines)
Lines 7-15 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Nikolay Botev - Bug 348507
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.jdt.internal.core.search;
12
package org.eclipse.jdt.internal.core.search;
12
13
14
import java.util.LinkedHashSet;
15
13
import org.eclipse.core.resources.IFolder;
16
import org.eclipse.core.resources.IFolder;
14
import org.eclipse.core.resources.ResourcesPlugin;
17
import org.eclipse.core.resources.ResourcesPlugin;
15
import org.eclipse.core.runtime.IPath;
18
import org.eclipse.core.runtime.IPath;
Lines 180-186 Link Here
180
private void initializeIndexLocations() {
183
private void initializeIndexLocations() {
181
	IPath[] projectsAndJars = this.searchScope.enclosingProjectsAndJars();
184
	IPath[] projectsAndJars = this.searchScope.enclosingProjectsAndJars();
182
	IndexManager manager = JavaModelManager.getIndexManager();
185
	IndexManager manager = JavaModelManager.getIndexManager();
183
	SimpleSet locations = new SimpleSet();
186
	// use a linked set to preserve the order during search: see bug 348507
187
	LinkedHashSet locations = new LinkedHashSet();
184
	IJavaElement focus = MatchLocator.projectOrJarFocus(this.pattern);
188
	IJavaElement focus = MatchLocator.projectOrJarFocus(this.pattern);
185
	if (focus == null) {
189
	if (focus == null) {
186
		for (int i = 0; i < projectsAndJars.length; i++) {
190
		for (int i = 0; i < projectsAndJars.length; i++) {
Lines 263-274 Link Here
263
		}
267
		}
264
	}
268
	}
265
269
266
	this.indexLocations = new IPath[locations.elementSize];
270
	locations.remove(null); // Ensure no nulls
267
	Object[] values = locations.values;
271
	this.indexLocations = (IPath[]) locations.toArray(new IPath[locations.size()]);
268
	int count = 0;
269
	for (int i = values.length; --i >= 0;)
270
		if (values[i] != null)
271
			this.indexLocations[count++] = (IPath) values[i];
272
}
272
}
273
273
274
public IPath[] getIndexLocations() {
274
public IPath[] getIndexLocations() {
(-)search/org/eclipse/jdt/internal/core/search/JavaWorkspaceScope.java (-2 / +12 lines)
Lines 7-17 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Nikolay Botev - Bug 348507
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.jdt.internal.core.search;
12
package org.eclipse.jdt.internal.core.search;
12
13
13
import java.util.HashMap;
14
import java.util.HashMap;
14
import java.util.HashSet;
15
import java.util.LinkedHashSet;
15
import java.util.Set;
16
import java.util.Set;
16
17
17
import org.eclipse.core.resources.IFolder;
18
import org.eclipse.core.resources.IFolder;
Lines 72-84 Link Here
72
	long start = BasicSearchEngine.VERBOSE ? System.currentTimeMillis() : -1;
73
	long start = BasicSearchEngine.VERBOSE ? System.currentTimeMillis() : -1;
73
	try {
74
	try {
74
		IJavaProject[] projects = JavaModelManager.getJavaModelManager().getJavaModel().getJavaProjects();
75
		IJavaProject[] projects = JavaModelManager.getJavaModelManager().getJavaModel().getJavaProjects();
75
		Set paths = new HashSet(projects.length * 2);
76
		// use a linked set to preserve the order during search: see bug 348507
77
		Set paths = new LinkedHashSet(projects.length * 2);
76
		for (int i = 0, length = projects.length; i < length; i++) {
78
		for (int i = 0, length = projects.length; i < length; i++) {
77
			JavaProject javaProject = (JavaProject) projects[i];
79
			JavaProject javaProject = (JavaProject) projects[i];
78
80
79
			// Add project full path
81
			// Add project full path
80
			IPath projectPath = javaProject.getProject().getFullPath();
82
			IPath projectPath = javaProject.getProject().getFullPath();
81
			paths.add(projectPath);
83
			paths.add(projectPath);
84
		}
85
86
		// add the project source paths first in a separate loop above
87
		// to ensure source files always get higher precedence during search.
88
		// see bug 348507
89
90
		for (int i = 0, length = projects.length; i < length; i++) {
91
			JavaProject javaProject = (JavaProject) projects[i];
82
92
83
			// Add project libraries paths
93
			// Add project libraries paths
84
			IClasspathEntry[] entries = javaProject.getResolvedClasspath();
94
			IClasspathEntry[] entries = javaProject.getResolvedClasspath();

Return to bug 348507