* indexing of builtins fixed.
diff --git a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/core/IBuildpathEntry.java b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/core/IBuildpathEntry.java
index b443255..b180504 100644
--- a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/core/IBuildpathEntry.java
+++ b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/core/IBuildpathEntry.java
@@ -40,6 +40,7 @@
int BPE_CONTAINER = 5;
IPath BUILTIN_EXTERNAL_ENTRY = new Path("#special#builtin#");
+ String BUILTIN_EXTERNAL_ENTRY_STR = "#special#builtin#";
/**
* Returns whether the access rules of the project's exported entries should be combined with this entry's access rules.
diff --git a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/BuildpathEntry.java b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/BuildpathEntry.java
index b86dd26..fdd946c 100644
--- a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/BuildpathEntry.java
+++ b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/BuildpathEntry.java
@@ -1139,7 +1139,7 @@
break;
// library entry check
case IBuildpathEntry.BPE_LIBRARY:
- if( path.equals(IBuildpathEntry.BUILTIN_EXTERNAL_ENTRY)) {
+ if( path.toString().startsWith(IBuildpathEntry.BUILTIN_EXTERNAL_ENTRY_STR)) {
break;
}
if (path != null && path.isAbsolute() && !path.isEmpty()) {
diff --git a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/DLTKProject.java b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/DLTKProject.java
index c67b96b..0eb8f4e 100644
--- a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/DLTKProject.java
+++ b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/DLTKProject.java
@@ -207,7 +207,7 @@
*/
public IProjectFragment getProjectFragment(IPath path) {
boolean isBuiltin = path.toString().startsWith(
- IBuildpathEntry.BUILTIN_EXTERNAL_ENTRY.toString());
+ IBuildpathEntry.BUILTIN_EXTERNAL_ENTRY_STR);
if (!path.isAbsolute() && !isBuiltin) {
path = getPath().append(path);
}
@@ -785,10 +785,9 @@
if (referringEntry != null && !resolvedEntry.isExported())
return;
if (checkExistency) {
- if (entryPath.equals(IBuildpathEntry.BUILTIN_EXTERNAL_ENTRY)
+ if (entryPath.toString().startsWith(IBuildpathEntry.BUILTIN_EXTERNAL_ENTRY_STR)
&& BuiltinProjectFragment.isSupported(this)) {
- root = new BuiltinProjectFragment(entryPath.append("/")
- .append(this.getPath()), this);
+ root = new BuiltinProjectFragment(entryPath, this);
break;
}
Object target = Model.getTarget(workspaceRoot, entryPath,
diff --git a/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/core/search/SearchEngine.java b/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/core/search/SearchEngine.java
index 7850513..6523e26 100644
--- a/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/core/search/SearchEngine.java
+++ b/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/core/search/SearchEngine.java
@@ -717,8 +717,8 @@
documentPath = documentPath.substring(SPECIAL_MIXIN.length());
}
String s = IBuildpathEntry.BUILTIN_EXTERNAL_ENTRY.toString();
- if( documentPath.indexOf(s) != -1) {
- documentPath = documentPath.substring(documentPath.indexOf(s));
+ if( documentPath.indexOf(IDLTKSearchScope.FILE_ENTRY_SEPARATOR) != -1) {
+ documentPath = documentPath.substring(documentPath.indexOf(IDLTKSearchScope.FILE_ENTRY_SEPARATOR) + 1);
}
Openable createOpenable = factory.createOpenable(documentPath, scope);
if( createOpenable instanceof ISourceModule ) {
diff --git a/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/core/search/indexing/AddBuiltinFolderToIndex.java b/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/core/search/indexing/AddBuiltinFolderToIndex.java
index e73ce2f..3fef1c3 100644
--- a/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/core/search/indexing/AddBuiltinFolderToIndex.java
+++ b/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/core/search/indexing/AddBuiltinFolderToIndex.java
@@ -19,6 +19,7 @@
import org.eclipse.dltk.compiler.util.SimpleLookupTable;
import org.eclipse.dltk.core.DLTKCore;
import org.eclipse.dltk.core.DLTKLanguageManager;
+import org.eclipse.dltk.core.IBuildpathEntry;
import org.eclipse.dltk.core.IBuiltinModuleProvider;
import org.eclipse.dltk.core.IDLTKLanguageToolkit;
import org.eclipse.dltk.core.IDLTKProject;
@@ -85,9 +86,12 @@
return true; // nothing to do
/* ensure no concurrent write access to index */
- IPath fullPath = project.getProject().getFullPath();
- String cfp = fullPath.toString();
- Index index = this.manager.getSpecialIndex("builtin", cfp, containerPath.toOSString() + fullPath.toString() );
+// IPath fullPath = project.getProject().getFullPath();
+ String cfp = containerPath.toString();
+ if( cfp.startsWith(IBuildpathEntry.BUILTIN_EXTERNAL_ENTRY_STR)) {
+ cfp = cfp.substring(IBuildpathEntry.BUILTIN_EXTERNAL_ENTRY_STR.length());
+ }
+ Index index = this.manager.getSpecialIndex("builtin", cfp, containerPath.toOSString() );
if (index == null) {
if (JobManager.VERBOSE)
org.eclipse.dltk.internal.core.util.Util
@@ -118,7 +122,7 @@
long initialTime = System.currentTimeMillis();
SearchParticipant participant = SearchEngine
- .getDefaultSearchParticipant();
+ .getDefaultSearchParticipant();
visit(null, scriptProject, parser, requestor, indexManager, container,
true, participant, index);
diff --git a/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/core/search/indexing/IndexManager.java b/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/core/search/indexing/IndexManager.java
index 3fe41b9..09f0d14 100644
--- a/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/core/search/indexing/IndexManager.java
+++ b/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/core/search/indexing/IndexManager.java
@@ -605,7 +605,7 @@
// requestingProject);
return;
}
- else if( target == null && path.equals(IBuildpathEntry.BUILTIN_EXTERNAL_ENTRY)) {
+ else if( target == null && path.toString().startsWith(IBuildpathEntry.BUILTIN_EXTERNAL_ENTRY_STR)) {
request = new AddBuiltinFolderToIndex(path, requestingProject, this );
}
// check if the same request is not already in the queue
diff --git a/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/internal/core/mixin/MixinBuilder.java b/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/internal/core/mixin/MixinBuilder.java
index dcce042..8a5a9d8 100644
--- a/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/internal/core/mixin/MixinBuilder.java
+++ b/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/internal/core/mixin/MixinBuilder.java
@@ -44,6 +44,8 @@
import org.eclipse.dltk.internal.core.SourceModule;
import org.eclipse.dltk.internal.core.search.DLTKSearchDocument;
+import sun.org.mozilla.javascript.internal.ScriptRuntime;
+
public class MixinBuilder implements IScriptBuilder {
public IStatus[] buildResources(IDLTKProject project, List resources, IProgressMonitor monitor) {
return null;
@@ -77,8 +79,6 @@
// waitUntilIndexReady(toolkit);
IPath fullPath = project.getProject().getFullPath();
-
-
mixinIndex = manager.getSpecialIndex("mixin", /*project.getProject()*/ fullPath.toString(), fullPath.toOSString() );
imon = mixinIndex.monitor;
imon.enterWrite();
@@ -92,7 +92,7 @@
IProjectFragment projectFragment = (IProjectFragment)element.getAncestor(IModelElement.PROJECT_FRAGMENT);
IPath containerPath = project.getPath();
- if( projectFragment instanceof ExternalProjectFragment ) {
+ if( projectFragment instanceof ExternalProjectFragment || projectFragment instanceof BuiltinProjectFragment ) {
IPath path = projectFragment.getPath();
if( indexes.containsKey(path)) {
currentIndex = (Index)indexes.get(path);
@@ -110,21 +110,6 @@
}
}
}
- else if( projectFragment instanceof BuiltinProjectFragment ) {
- IPath path = projectFragment.getPath();
-// if( indexes.containsKey(path)) {
-// currentIndex = (Index)indexes.get(path);
- containerPath = path;
-// }
-// else {
-// Index index = manager.getSpecialIndex("mixin", path.toString(), path.toOSString() );
-// if( index != null ) {
-//// currentIndex = index;
-// indexes.put(path, index);
-// containerPath = path.removeLastSegments(1);
-// }
-// }
- }
char[] source = element.getSourceAsCharArray();
SearchParticipant participant = SearchEngine
diff --git a/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/internal/core/search/DLTKSearchScope.java b/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/internal/core/search/DLTKSearchScope.java
index ddcdd8e..2f96331 100644
--- a/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/internal/core/search/DLTKSearchScope.java
+++ b/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/internal/core/search/DLTKSearchScope.java
@@ -580,9 +580,9 @@
*/
public AccessRuleSet getAccessRuleSet(String relativePath,
String containerPath) {
- if( containerPath.startsWith(IBuildpathEntry.BUILTIN_EXTERNAL_ENTRY.toString())) {
- containerPath = IBuildpathEntry.BUILTIN_EXTERNAL_ENTRY.toString();
- }
+// if( containerPath.startsWith(IBuildpathEntry.BUILTIN_EXTERNAL_ENTRY_STR)) {
+// containerPath = IBuildpathEntry.BUILTIN_EXTERNAL_ENTRY_STR + relativePath;
+// }
int index = indexOf(containerPath, relativePath);
if (index == -1) {
// this search scope does not enclose given path
@@ -677,7 +677,7 @@
int separatorIndex = resourcePathString
.indexOf(FILE_ENTRY_SEPARATOR);
boolean isZIPFile = separatorIndex != -1;
- boolean isBuiltin = resourcePathString.startsWith(IBuildpathEntry.BUILTIN_EXTERNAL_ENTRY.toString());
+ boolean isBuiltin = resourcePathString.startsWith(IBuildpathEntry.BUILTIN_EXTERNAL_ENTRY_STR);
if (isZIPFile) {
// internal or external jar (case 3, 4, or 5)
String zipPath = resourcePathString.substring(0, separatorIndex);
@@ -700,7 +700,7 @@
.getProjectFragment(this.containerPaths[index]);
}
if( isBuiltin ) {
- return project.getProjectFragment(this.containerPaths[index] + "/" + projectPath);
+ return project.getProjectFragment(this.containerPaths[index]);
}
Object target = Model.getTarget(ResourcesPlugin
.getWorkspace().getRoot(), new Path(
diff --git a/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/internal/core/search/IndexSelector.java b/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/internal/core/search/IndexSelector.java
index 10a8614..0a26c31 100644
--- a/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/internal/core/search/IndexSelector.java
+++ b/core/plugins/org.eclipse.dltk.core/search/org/eclipse/dltk/internal/core/search/IndexSelector.java
@@ -275,18 +275,28 @@
// checkSpecialCase(manager, locations, prjPath);
locations.add(manager.computeIndexLocation(new Path(prjPath)));
// add builtin indexes
- IPath path = projectsAndArchives;
-// if (!mixin) {
- if (!path.equals(IBuildpathEntry.BUILTIN_EXTERNAL_ENTRY)) {
- DLTKProject project = (DLTKProject) getScriptProject(path,
- model);
- if (project != null) {
- IPath p = new Path("#special#builtin#")
- .append(projectsAndArchives);
- locations.add(manager.computeIndexLocation(p));
- }
- }
-// }
+// IPath path = projectsAndArchives;
+//// if (!mixin) {
+// if (!path.toString().startsWith(IBuildpathEntry.BUILTIN_EXTERNAL_ENTRY_STR)) {
+// DLTKProject project = (DLTKProject) getScriptProject(path,
+// model);
+// if (project != null) {
+// IPath p = new Path("#special#builtin#")
+// .append(projectsAndArchives);
+// locations.add(manager.computeIndexLocation(p));
+// }
+// }
+// else {
+// path = path.removeFirstSegments(1);
+// DLTKProject project = (DLTKProject) getScriptProject(path,
+// model);
+// if (project != null) {
+// IPath p = new Path("#special#builtin#")
+// .append(projectsAndArchives);
+// locations.add(manager.computeIndexLocation(p));
+// }
+// }
+//// }
}
// private void checkSpecialCase(IndexManager manager, SimpleSet locations,