OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012, the Dart project authors. | 2 * Copyright (c) 2012, the Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 | 233 |
234 /** | 234 /** |
235 * Given "package:web_ui/dwc.dart", return "/Users/foo/dart/sample/packages/we
b_ui/dwc.dart". | 235 * Given "package:web_ui/dwc.dart", return "/Users/foo/dart/sample/packages/we
b_ui/dwc.dart". |
236 * | 236 * |
237 * @param packageUrl | 237 * @param packageUrl |
238 * @return | 238 * @return |
239 */ | 239 */ |
240 private String resolvePackageUrl(String packageUrl) { | 240 private String resolvePackageUrl(String packageUrl) { |
241 String urlSnippet = packageUrl.substring("package:".length()); | 241 String urlSnippet = packageUrl.substring("package:".length()); |
242 | 242 |
| 243 //TODO (danrubel): map package reference to packages returned by pub-list wh
en packages |
| 244 // directory does not exist AND when pubspec is not in project folder |
243 for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects
()) { | 245 for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects
()) { |
244 IFolder packagesDir = project.getFolder(DartCore.PACKAGES_DIRECTORY_NAME); | 246 IFolder packagesDir = project.getFolder(DartCore.PACKAGES_DIRECTORY_NAME); |
245 | 247 |
246 if (packagesDir.exists()) { | 248 if (packagesDir.exists()) { |
247 IFile file = packagesDir.getFile(urlSnippet); | 249 IFile file = packagesDir.getFile(urlSnippet); |
248 | 250 |
249 if (file.exists() && file.isAccessible()) { | 251 if (file.exists() && file.isAccessible()) { |
250 return file.getLocation().toPortableString(); | 252 return file.getLocation().toPortableString(); |
251 } | 253 } |
252 } | 254 } |
(...skipping 13 matching lines...) Expand all Loading... |
266 } | 268 } |
267 | 269 |
268 private String stripParens(String str) { | 270 private String stripParens(String str) { |
269 if (str.startsWith("(") && str.endsWith(")")) { | 271 if (str.startsWith("(") && str.endsWith(")")) { |
270 return str.substring(1, str.length() - 1); | 272 return str.substring(1, str.length() - 1); |
271 } else { | 273 } else { |
272 return str; | 274 return str; |
273 } | 275 } |
274 } | 276 } |
275 } | 277 } |
OLD | NEW |