Index: dart/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/analysis/model/PubFolderImpl.java |
=================================================================== |
--- dart/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/analysis/model/PubFolderImpl.java (revision 31563) |
+++ dart/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/analysis/model/PubFolderImpl.java (working copy) |
@@ -1,11 +1,11 @@ |
/* |
* Copyright (c) 2013, the Dart project authors. |
- * |
+ * |
* Licensed under the Eclipse Public License v1.0 (the "License"); you may not use this file except |
* in compliance with the License. You may obtain a copy of the License at |
- * |
+ * |
* http://www.eclipse.org/legal/epl-v10.html |
- * |
+ * |
* Unless required by applicable law or agreed to in writing, software distributed under the License |
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
* or implied. See the License for the specific language governing permissions and limitations under |
@@ -16,8 +16,10 @@ |
import com.google.dart.engine.context.AnalysisContext; |
import com.google.dart.engine.sdk.DartSdk; |
import com.google.dart.engine.source.DirectoryBasedSourceContainer; |
+import com.google.dart.engine.source.ExplicitPackageUriResolver; |
import com.google.dart.engine.source.Source; |
import com.google.dart.engine.source.SourceContainer; |
+import com.google.dart.engine.source.UriResolver; |
import com.google.dart.tools.core.DartCore; |
import com.google.dart.tools.core.analysis.model.PubFolder; |
import com.google.dart.tools.core.pub.PubspecModel; |
@@ -41,7 +43,7 @@ |
/** |
* Represents a project or folder within a project containing a pubspec file. |
- * |
+ * |
* @coverage dart.tools.core.model |
*/ |
public class PubFolderImpl extends PubResourceMapImpl implements PubFolder { |
@@ -56,9 +58,16 @@ |
*/ |
private PubspecModel pubspec; |
- public PubFolderImpl(IContainer container, AnalysisContext context, DartSdk sdk) { |
+ /** |
+ * The package resolver used to resolve package: uris |
+ */ |
+ private UriResolver pkgResolver; |
+ |
+ public PubFolderImpl( |
+ IContainer container, AnalysisContext context, DartSdk sdk, UriResolver pkgResolver) { |
super(container, context); |
this.sdk = sdk; |
+ this.pkgResolver = pkgResolver; |
} |
@Override |
@@ -104,6 +113,14 @@ |
pubspec = null; |
} |
+ @Override |
+ public String resolvePathToPackage(String path) { |
+ if (pkgResolver instanceof ExplicitPackageUriResolver) { |
+ return ((ExplicitPackageUriResolver) pkgResolver).resolvePathToPackage(path); |
+ } |
+ return null; |
+ } |
+ |
private CompositeSourceContainer getSourceContainer() { |
List<SourceContainer> containers = new ArrayList<SourceContainer>(); |
containers.add(new DirectoryBasedSourceContainer(container.getLocation().toFile())); |