if (entry.getEntryKind() != IClasspathEntry.CPE_VARIABLE)
return entry;
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
IPath resolvedPath = JavaCore.getResolvedVariablePath(entry.getPath());
if (resolvedPath == null)
return null;
Object target = JavaModel.getTarget(workspaceRoot, resolvedPath, false);
if (target == null)
return null;
// inside the workspace
if (target instanceof IResource) {
IResource resolvedResource = (IResource) target;
switch (resolvedResource.getType()) {
case IResource.PROJECT :
// internal project
return JavaCore.newProjectEntry(
resolvedPath,
entry.getAccessRules(),
entry.combineAccessRules(),
entry.getExtraAttributes(),
entry.isExported());
case IResource.FILE :
if (org.aspectj.org.eclipse.jdt.internal.compiler.util.Util.isArchiveFileName(resolvedResource.getName())) {
// internal binary archive
return JavaCore.newLibraryEntry(
resolvedPath,
getResolvedVariablePath(entry.getSourceAttachmentPath()),
getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
entry.getAccessRules(),
entry.getExtraAttributes(),
entry.isExported());
}
break;
case IResource.FOLDER :
// internal binary folder
return JavaCore.newLibraryEntry(
resolvedPath,
getResolvedVariablePath(entry.getSourceAttachmentPath()),
getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
entry.getAccessRules(),
entry.getExtraAttributes(),
entry.isExported());
}
}
// outside the workspace
if (target instanceof File) {
File externalFile = JavaModel.getFile(target);
if (externalFile != null) {
String fileName = externalFile.getName().toLowerCase();
if (fileName.endsWith(SuffixConstants.SUFFIX_STRING_jar) || fileName.endsWith(SuffixConstants.SUFFIX_STRING_zip)) {
// external binary archive
return JavaCore.newLibraryEntry(
resolvedPath,
getResolvedVariablePath(entry.getSourceAttachmentPath()),
getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
entry.getAccessRules(),
entry.getExtraAttributes(),
entry.isExported());
}
} else { // external binary folder
if (resolvedPath.isAbsolute()){
return JavaCore.newLibraryEntry(
resolvedPath,
getResolvedVariablePath(entry.getSourceAttachmentPath()),
getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
entry.getAccessRules(),