Chromium Code Reviews| Index: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/index/impl/InMemoryIndex.java |
| =================================================================== |
| --- editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/index/impl/InMemoryIndex.java (revision 7590) |
| +++ editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/index/impl/InMemoryIndex.java (working copy) |
| @@ -197,14 +197,10 @@ |
| */ |
| public void indexResource(File libraryFile, File sourceFile, DartUnit dartUnit) |
| throws DartModelException { |
| - EditorLibraryManager libraryManager = SystemLibraryManagerProvider.getSystemLibraryManager(); |
| // Get the LibrarySource |
| - URI fileUri = libraryFile.toURI(); |
| - URI shortUri = libraryManager.getShortUri(fileUri); |
| - URI libUri = shortUri != null ? shortUri : fileUri; |
| - LibrarySource librarySource = new UrlLibrarySource(libUri, libraryManager); |
| + LibrarySource librarySource = dartUnit.getLibrary().getSource(); |
| // Get the DartLibrary |
| @@ -226,22 +222,24 @@ |
| // Get the CompilationUnit |
| + DartSource unitSource = (DartSource) dartUnit.getSourceInfo().getSource(); |
| CompilationUnit compilationUnit; |
| IResource res = ResourceUtil.getResource(sourceFile); |
| if (res != null) { |
| - compilationUnit = new CompilationUnitImpl( |
| - library, |
| - (IFile) res, |
| - DefaultWorkingCopyOwner.getInstance()); |
| + DefaultWorkingCopyOwner workingCopy = DefaultWorkingCopyOwner.getInstance(); |
| + compilationUnit = new CompilationUnitImpl(library, (IFile) res, workingCopy); |
| } else { |
| - DartSource unitSource = (DartSource) dartUnit.getSourceInfo().getSource(); |
| - compilationUnit = new ExternalCompilationUnitImpl( |
| - library, |
| - unitSource.getRelativePath(), |
| - unitSource); |
| + String relPath = unitSource.getRelativePath(); |
| + compilationUnit = new ExternalCompilationUnitImpl(library, relPath, unitSource); |
| } |
| - Resource indexResource = ResourceFactory.getResource(compilationUnit); |
| + URI unitUri = unitSource.getUri(); |
| + Resource indexResource; |
|
Brian Wilkerson
2012/05/14 14:19:58
nit: Perhaps "resource" would be a better variable
danrubel
2012/05/16 04:26:36
Good point, but I named it such to remind myself t
|
| + if (SystemLibraryManager.isDartUri(unitUri)) { |
| + indexResource = new Resource(unitUri.toString()); |
| + } else { |
| + indexResource = ResourceFactory.getResource(compilationUnit); |
| + } |
| indexResource(indexResource, compilationUnit, dartUnit); |
| } |