| Index: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/Context.java
|
| ===================================================================
|
| --- editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/Context.java (revision 9797)
|
| +++ editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/Context.java (working copy)
|
| @@ -272,21 +272,16 @@
|
| if (library != null) {
|
| return new Library[] {library};
|
| }
|
| - Library[] result = NO_LIBRARIES;
|
|
|
| // If this is a file, then return the libraries that source the file
|
|
|
| if (file.isFile() || (!file.exists() && DartCore.isDartLikeFileName(file.getName()))) {
|
| - for (Library cachedLibrary : libraryCache.values()) {
|
| - if (cachedLibrary.getSourceFiles().contains(file)) {
|
| - result = append(result, cachedLibrary);
|
| - }
|
| - }
|
| - return result;
|
| + return getLibrariesSourcing(file);
|
| }
|
|
|
| // Otherwise return the libraries containing files in the specified directory tree
|
|
|
| + Library[] result = NO_LIBRARIES;
|
| String prefix = file.getAbsolutePath() + File.separator;
|
| for (Library cachedLibrary : libraryCache.values()) {
|
| for (File sourceFile : cachedLibrary.getSourceFiles()) {
|
| @@ -313,6 +308,21 @@
|
| }
|
|
|
| /**
|
| + * Answer the libraries that source the specified file
|
| + *
|
| + * @return an array of libraries (not <code>null</code>, contains no <code>null</code>s)
|
| + */
|
| + Library[] getLibrariesSourcing(File file) {
|
| + Library[] result = NO_LIBRARIES;
|
| + for (Library cachedLibrary : libraryCache.values()) {
|
| + if (cachedLibrary.getSourceFiles().contains(file)) {
|
| + result = append(result, cachedLibrary);
|
| + }
|
| + }
|
| + return result;
|
| + }
|
| +
|
| + /**
|
| * Answer the currently cached and resolved libraries
|
| */
|
| HashMap<URI, LibraryUnit> getResolvedLibraries() {
|
|
|