Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(528)

Unified Diff: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/HTMLFileImpl.java

Issue 10563005: fix mapping of html files to libraries http://code.google.com/p/dart/issues/detail?id=3586 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/HTMLFileImpl.java
===================================================================
--- editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/HTMLFileImpl.java (revision 8721)
+++ editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/HTMLFileImpl.java (working copy)
@@ -23,6 +23,7 @@
import com.google.dart.tools.core.model.DartModelException;
import com.google.dart.tools.core.model.HTMLFile;
import com.google.dart.tools.core.utilities.resource.IFileUtilities;
+import com.google.dart.tools.core.utilities.resource.IResourceUtilities;
import com.google.dart.tools.core.workingcopy.WorkingCopyOwner;
import org.eclipse.core.resources.IFile;
@@ -89,19 +90,23 @@
fileInfo.setChildren(DartElementImpl.EMPTY_ARRAY);
try {
List<String> libraryNames = LibraryReferenceFinder.findInHTML(IFileUtilities.getContents(file));
+ List<String> libraryPaths = IResourceUtilities.getResolvedFilePaths(
+ getUnderlyingResource(),
+ libraryNames);
List<DartLibrary> referencedLibraries = new ArrayList<DartLibrary>(libraryNames.size());
List<DartLibrary> libraries = DartModelManager.getInstance().getDartModel().getDartLibraries();
for (DartLibrary library : libraries) {
if (library.getDartProject().getProject().equals(file.getProject())) {
String elementName = library.getElementName();
- for (String libraryName : libraryNames) {
- if (elementName.equals(libraryName) || elementName.endsWith("/" + libraryName)) {
+ for (String libraryPath : libraryPaths) {
+ if (elementName.equals(libraryPath) || elementName.contains(libraryPath)) {
referencedLibraries.add(library);
break;
}
}
}
}
+
fileInfo.setReferencedLibraries(referencedLibraries.toArray(new DartLibrary[referencedLibraries.size()]));
fileInfo.setIsStructureKnown(true);
return true;

Powered by Google App Engine
This is Rietveld 408576698