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

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

Issue 439933005: first incremental cut at editor without packages directories (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 4 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/analysis/model/ProjectImpl.java
diff --git a/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/analysis/model/ProjectImpl.java b/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/analysis/model/ProjectImpl.java
index 874aeb7e845db9ab0d28ce728b1e3ac52606d521..f7dcdb4bfc14ad17a7e4c1ee44d07afceed12163 100644
--- a/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/analysis/model/ProjectImpl.java
+++ b/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/analysis/model/ProjectImpl.java
@@ -741,31 +741,26 @@ public class ProjectImpl extends ContextManagerImpl implements Project {
* @return UriResolver used to resolve package: uris.
*/
private UriResolver getPackageUriResolver(IContainer container, DartSdk sdk, boolean hasPubspec) {
-
- UriResolver pkgResolver = null;
File[] packageRoots = factory.getPackageRoots(container);
if (packageRoots.length > 0) {
- pkgResolver = new PackageUriResolver(packageRoots);
- return pkgResolver;
+ return new PackageUriResolver(packageRoots);
}
- File[] packagesDirs = null;
- if (hasPubspec) {
+ if (hasPubspec && !DartCoreDebug.NO_PUB_PACKAGES) {
IPath location = container.getLocation();
if (location != null) {
- packagesDirs = new File[] {new File(location.toFile(), PACKAGES_DIRECTORY_NAME)};
+ File[] packagesDirs = new File[] {new File(location.toFile(), PACKAGES_DIRECTORY_NAME)};
+ return new PackageUriResolver(packagesDirs);
}
}
- if (packagesDirs != null) {
- pkgResolver = new PackageUriResolver(packagesDirs);
- } else if (sdk instanceof DirectoryBasedDartSdk) {
+ if (sdk instanceof DirectoryBasedDartSdk) {
IPath location = container.getLocation();
if (location != null) {
- pkgResolver = new InstrumentedExplicitPackageUriResolver(
+ return new InstrumentedExplicitPackageUriResolver(
(DirectoryBasedDartSdk) sdk,
location.toFile());
}
}
- return pkgResolver;
+ return null;
}
/**
@@ -872,6 +867,17 @@ public class ProjectImpl extends ContextManagerImpl implements Project {
context.setSourceFactory(sourceFactory);
context.setAnalysisOptions(options);
+
+ if (DartCoreDebug.NO_PUB_PACKAGES && pkgResolver instanceof ExplicitPackageUriResolver) {
+ //TODO (danrubel): Add package sources to context so that it is properly indexed
+// ChangeSet changeSet = new ChangeSet();
+// for (File dir : ((ExplicitPackageUriResolver) pkgResolver).getPackageDirectories()) {
+// // traverse package directory tree
+// changeSet.addedSource(new FileBasedSource(file));
+// }
+// context.applyChanges(changeSet);
+ }
+
return context;
}

Powered by Google App Engine
This is Rietveld 408576698