|
Lines 133-139
Link Here
|
| 133 |
if ((includeMask & APPLICATION_LIBRARIES) != 0) { |
133 |
if ((includeMask & APPLICATION_LIBRARIES) != 0) { |
| 134 |
IPath path = entry.getPath(); |
134 |
IPath path = entry.getPath(); |
| 135 |
if (pathToAdd == null || pathToAdd.equals(path)) { |
135 |
if (pathToAdd == null || pathToAdd.equals(path)) { |
| 136 |
add("", path.toString(), true, access); //$NON-NLS-1$ |
136 |
String pathToString = path.getDevice() == null ? path.toString() : path.toOSString(); |
|
|
137 |
add("", pathToString, true, access); //$NON-NLS-1$ |
| 137 |
addEnclosingProjectOrJar(path); |
138 |
addEnclosingProjectOrJar(path); |
| 138 |
} |
139 |
} |
| 139 |
} |
140 |
} |
|
Lines 145-151
Link Here
|
| 145 |
|| (includeMask & SYSTEM_LIBRARIES) != 0) { |
146 |
|| (includeMask & SYSTEM_LIBRARIES) != 0) { |
| 146 |
IPath path = entry.getPath(); |
147 |
IPath path = entry.getPath(); |
| 147 |
if (pathToAdd == null || pathToAdd.equals(path)) { |
148 |
if (pathToAdd == null || pathToAdd.equals(path)) { |
| 148 |
add("", path.toString(), true, access); //$NON-NLS-1$ |
149 |
String pathToString = path.getDevice() == null ? path.toString() : path.toOSString(); |
|
|
150 |
add("", pathToString, true, access); //$NON-NLS-1$ |
| 149 |
addEnclosingProjectOrJar(path); |
151 |
addEnclosingProjectOrJar(path); |
| 150 |
} |
152 |
} |
| 151 |
} |
153 |
} |
|
Lines 178-183
Link Here
|
| 178 |
*/ |
180 |
*/ |
| 179 |
public void add(IJavaElement element) throws JavaModelException { |
181 |
public void add(IJavaElement element) throws JavaModelException { |
| 180 |
IPath containerPath = null; |
182 |
IPath containerPath = null; |
|
|
183 |
String containerPathToString = null; |
| 181 |
int includeMask = SOURCES | APPLICATION_LIBRARIES | SYSTEM_LIBRARIES; |
184 |
int includeMask = SOURCES | APPLICATION_LIBRARIES | SYSTEM_LIBRARIES; |
| 182 |
switch (element.getElementType()) { |
185 |
switch (element.getElementType()) { |
| 183 |
case IJavaElement.JAVA_MODEL: |
186 |
case IJavaElement.JAVA_MODEL: |
|
Lines 190-201
Link Here
|
| 190 |
IPackageFragmentRoot root = (IPackageFragmentRoot)element; |
193 |
IPackageFragmentRoot root = (IPackageFragmentRoot)element; |
| 191 |
IPath rootPath = root.getPath(); |
194 |
IPath rootPath = root.getPath(); |
| 192 |
containerPath = root.getKind() == IPackageFragmentRoot.K_SOURCE ? root.getParent().getPath() : rootPath; |
195 |
containerPath = root.getKind() == IPackageFragmentRoot.K_SOURCE ? root.getParent().getPath() : rootPath; |
|
|
196 |
containerPathToString = containerPath.getDevice() == null ? containerPath.toString() : containerPath.toOSString(); |
| 193 |
IResource rootResource = root.getResource(); |
197 |
IResource rootResource = root.getResource(); |
| 194 |
if (rootResource != null && rootResource.isAccessible()) { |
198 |
if (rootResource != null && rootResource.isAccessible()) { |
| 195 |
String relativePath = Util.relativePath(rootResource.getFullPath(), containerPath.segmentCount()); |
199 |
String relativePath = Util.relativePath(rootResource.getFullPath(), containerPath.segmentCount()); |
| 196 |
add(relativePath, containerPath.toString(), true, null); |
200 |
add(relativePath, containerPathToString, true, null); |
| 197 |
} else { |
201 |
} else { |
| 198 |
add("", containerPath.toString(), true, null); //$NON-NLS-1$ |
202 |
add("", containerPathToString, true, null); //$NON-NLS-1$ |
| 199 |
} |
203 |
} |
| 200 |
break; |
204 |
break; |
| 201 |
case IJavaElement.PACKAGE_FRAGMENT: |
205 |
case IJavaElement.PACKAGE_FRAGMENT: |
|
Lines 203-215
Link Here
|
| 203 |
if (root.isArchive()) { |
207 |
if (root.isArchive()) { |
| 204 |
String relativePath = Util.concatWith(((PackageFragment) element).names, '/'); |
208 |
String relativePath = Util.concatWith(((PackageFragment) element).names, '/'); |
| 205 |
containerPath = root.getPath(); |
209 |
containerPath = root.getPath(); |
| 206 |
add(relativePath, containerPath.toString(), false, null); |
210 |
containerPathToString = containerPath.getDevice() == null ? containerPath.toString() : containerPath.toOSString(); |
|
|
211 |
add(relativePath, containerPathToString, false, null); |
| 207 |
} else { |
212 |
} else { |
| 208 |
IResource resource = element.getResource(); |
213 |
IResource resource = element.getResource(); |
| 209 |
if (resource != null && resource.isAccessible()) { |
214 |
if (resource != null && resource.isAccessible()) { |
| 210 |
containerPath = root.getKind() == IPackageFragmentRoot.K_SOURCE ? root.getParent().getPath() : root.getPath(); |
215 |
containerPath = root.getKind() == IPackageFragmentRoot.K_SOURCE ? root.getParent().getPath() : root.getPath(); |
|
|
216 |
containerPathToString = containerPath.getDevice() == null ? containerPath.toString() : containerPath.toOSString(); |
| 211 |
String relativePath = Util.relativePath(resource.getFullPath(), containerPath.segmentCount()); |
217 |
String relativePath = Util.relativePath(resource.getFullPath(), containerPath.segmentCount()); |
| 212 |
add(relativePath, containerPath.toString(), false, null); |
218 |
add(relativePath, containerPathToString, false, null); |
| 213 |
} |
219 |
} |
| 214 |
} |
220 |
} |
| 215 |
break; |
221 |
break; |
|
Lines 230-236
Link Here
|
| 230 |
containerPath = root.getPath(); |
236 |
containerPath = root.getPath(); |
| 231 |
relativePath = getPath(element, true/*relative path*/).toString(); |
237 |
relativePath = getPath(element, true/*relative path*/).toString(); |
| 232 |
} |
238 |
} |
| 233 |
add(relativePath, containerPath.toString(), true, null); |
239 |
containerPathToString = containerPath.getDevice() == null ? containerPath.toString() : containerPath.toOSString(); |
|
|
240 |
add(relativePath, containerPathToString, true, null); |
| 234 |
} |
241 |
} |
| 235 |
|
242 |
|
| 236 |
if (containerPath != null) |
243 |
if (containerPath != null) |
|
Lines 342-349
Link Here
|
| 342 |
IPackageFragmentRoot root = (IPackageFragmentRoot) element.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); |
349 |
IPackageFragmentRoot root = (IPackageFragmentRoot) element.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); |
| 343 |
if (root != null && root.isArchive()) { |
350 |
if (root != null && root.isArchive()) { |
| 344 |
IPath rootPath = root.getPath(); |
351 |
IPath rootPath = root.getPath(); |
|
|
352 |
String rootPathToString = rootPath.getDevice() == null ? rootPath.toString() : rootPath.toOSString(); |
| 345 |
IPath relativePath = getPath(element, true/*relative path*/); |
353 |
IPath relativePath = getPath(element, true/*relative path*/); |
| 346 |
return indexOf(relativePath.toString(), rootPath.toString()) >= 0; |
354 |
return indexOf(relativePath.toString(), rootPathToString) >= 0; |
| 347 |
} |
355 |
} |
| 348 |
return this.indexOf(getPath(element, false/*full path*/).toString(), null) >= 0; |
356 |
return this.indexOf(getPath(element, false/*full path*/).toString(), null) >= 0; |
| 349 |
} |
357 |
} |