| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 Path path = new Path(regex); | 182 Path path = new Path(regex); |
| 183 int i = 0; | 183 int i = 0; |
| 184 if (regex.indexOf(LIB_DIRECTORY_PATH) != -1) { | 184 if (regex.indexOf(LIB_DIRECTORY_PATH) != -1) { |
| 185 // remove all segments after "lib", they show path in the package | 185 // remove all segments after "lib", they show path in the package |
| 186 while (i < path.segmentCount() && !path.segment(i).equals("lib")) { | 186 while (i < path.segmentCount() && !path.segment(i).equals("lib")) { |
| 187 i++; | 187 i++; |
| 188 } | 188 } |
| 189 } else { | 189 } else { |
| 190 i = 1; | 190 i = 1; |
| 191 } | 191 } |
| 192 String filePath = new Path(regex).removeLastSegments(path.segmentCount() - (
i + 1)).toString(); | 192 String filePath = regex; |
| 193 if (path.segmentCount() > i + 1) { |
| 194 filePath = new Path(regex).removeLastSegments(path.segmentCount() - (i + 1
)).toString(); |
| 195 } |
| 193 | 196 |
| 194 String packagePath = resolvePathToPackage(resource, filePath); | 197 String packagePath = resolvePathToPackage(resource, filePath); |
| 195 if (packagePath != null) { | 198 if (packagePath != null) { |
| 196 packagePath += "/" + path.removeFirstSegments(i + 1); | 199 packagePath += "/" + path.removeFirstSegments(i + 1); |
| 197 } | 200 } |
| 198 return packagePath; | 201 return packagePath; |
| 199 } | 202 } |
| 200 | 203 |
| 201 @VisibleForTesting | 204 @VisibleForTesting |
| 202 protected String resolvePathToPackage(IFile resource, String filePath) { | 205 protected String resolvePathToPackage(IFile resource, String filePath) { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 } | 360 } |
| 358 | 361 |
| 359 if (container.getParent() instanceof IWorkspaceRoot) { | 362 if (container.getParent() instanceof IWorkspaceRoot) { |
| 360 return false; | 363 return false; |
| 361 } | 364 } |
| 362 | 365 |
| 363 return isPubLib(container.getParent()); | 366 return isPubLib(container.getParent()); |
| 364 } | 367 } |
| 365 | 368 |
| 366 } | 369 } |
| OLD | NEW |