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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 } | 58 } |
59 | 59 |
60 /** | 60 /** |
61 * Test for files that are in the packages directory and linked to another res
ource in the | 61 * Test for files that are in the packages directory and linked to another res
ource in the |
62 * workspace. | 62 * workspace. |
63 */ | 63 */ |
64 public static boolean isSelfLinkedPackageResource(IResource resource) { | 64 public static boolean isSelfLinkedPackageResource(IResource resource) { |
65 | 65 |
66 IPath relativePath = resource.getProjectRelativePath(); | 66 IPath relativePath = resource.getProjectRelativePath(); |
67 | 67 |
68 if ("packages".equals(relativePath.segment(0))) { | 68 if (DartCore.PACKAGES_DIRECTORY_NAME.equals(relativePath.segment(0))) { |
69 | 69 |
70 try { | 70 try { |
71 | 71 |
72 File canonicalFile = resource.getLocation().toFile().getCanonicalFile(); | 72 File canonicalFile = resource.getLocation().toFile().getCanonicalFile(); |
73 IWorkspace workspace = ResourcesPlugin.getWorkspace(); | 73 IWorkspace workspace = ResourcesPlugin.getWorkspace(); |
74 IPath loc = Path.fromOSString(canonicalFile.getAbsolutePath()); | 74 IPath loc = Path.fromOSString(canonicalFile.getAbsolutePath()); |
75 IFile wsFile = workspace.getRoot().getFileForLocation(loc); | 75 IFile wsFile = workspace.getRoot().getFileForLocation(loc); |
76 | 76 |
77 if (wsFile != null && wsFile.exists()) { | 77 if (wsFile != null && wsFile.exists()) { |
78 return true; | 78 return true; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 return true; | 117 return true; |
118 } | 118 } |
119 if (fileName.endsWith(".dart.js")) { | 119 if (fileName.endsWith(".dart.js")) { |
120 return true; | 120 return true; |
121 } | 121 } |
122 | 122 |
123 return DartCore.isImageLikeFileName(fileName); | 123 return DartCore.isImageLikeFileName(fileName); |
124 } | 124 } |
125 | 125 |
126 } | 126 } |
OLD | NEW |