Lines 143-148
Link Here
|
143 |
private final static char[][] UNINIT_PATTERNS = new char[][] { "Non-initialized yet".toCharArray() }; //$NON-NLS-1$ |
143 |
private final static char[][] UNINIT_PATTERNS = new char[][] { "Non-initialized yet".toCharArray() }; //$NON-NLS-1$ |
144 |
private final static ClasspathEntry[] NO_ENTRIES = new ClasspathEntry[0]; |
144 |
private final static ClasspathEntry[] NO_ENTRIES = new ClasspathEntry[0]; |
145 |
private final static IPath[] NO_PATHS = new IPath[0]; |
145 |
private final static IPath[] NO_PATHS = new IPath[0]; |
|
|
146 |
private final static IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); |
146 |
|
147 |
|
147 |
private boolean combineAccessRules; |
148 |
private boolean combineAccessRules; |
148 |
|
149 |
|
Lines 956-969
Link Here
|
956 |
*/ |
957 |
*/ |
957 |
public static IPath resolveDotDot(IPath path) { |
958 |
public static IPath resolveDotDot(IPath path) { |
958 |
IPath newPath = null; |
959 |
IPath newPath = null; |
959 |
IWorkspaceRoot root = null; |
|
|
960 |
IPath workspaceLocation = null; |
960 |
IPath workspaceLocation = null; |
961 |
for (int i = 0, length = path.segmentCount(); i < length; i++) { |
961 |
for (int i = 0, length = path.segmentCount(); i < length; i++) { |
962 |
String segment = path.segment(i); |
962 |
String segment = path.segment(i); |
963 |
if (DOT_DOT.equals(segment)) { |
963 |
if (DOT_DOT.equals(segment)) { |
964 |
if (newPath == null) { |
964 |
if (newPath == null) { |
965 |
if (i == 0) { |
965 |
if (i == 0) { |
966 |
workspaceLocation = (root = ResourcesPlugin.getWorkspace().getRoot()).getLocation(); |
966 |
workspaceLocation = workspaceRoot.getLocation(); |
967 |
newPath = workspaceLocation; |
967 |
newPath = workspaceLocation; |
968 |
} else { |
968 |
} else { |
969 |
newPath = path.removeFirstSegments(i); |
969 |
newPath = path.removeFirstSegments(i); |
Lines 972-983
Link Here
|
972 |
if (newPath.segmentCount() > 0) { |
972 |
if (newPath.segmentCount() > 0) { |
973 |
newPath = newPath.removeLastSegments(1); |
973 |
newPath = newPath.removeLastSegments(1); |
974 |
} else { |
974 |
} else { |
975 |
workspaceLocation = (root = ResourcesPlugin.getWorkspace().getRoot()).getLocation(); |
975 |
workspaceLocation = workspaceRoot.getLocation(); |
976 |
newPath = workspaceLocation; |
976 |
newPath = workspaceLocation; |
977 |
} |
977 |
} |
978 |
} |
978 |
} |
979 |
} else if (newPath != null) { |
979 |
} else if (newPath != null) { |
980 |
if (newPath.equals(workspaceLocation) && root.getProject(segment).isAccessible()) { |
980 |
if (newPath.equals(workspaceLocation) && workspaceRoot.getProject(segment).isAccessible()) { |
981 |
newPath = new Path(segment).makeAbsolute(); |
981 |
newPath = new Path(segment).makeAbsolute(); |
982 |
} else { |
982 |
} else { |
983 |
newPath = newPath.append(segment); |
983 |
newPath = newPath.append(segment); |
Lines 1766-1772
Link Here
|
1766 |
|
1766 |
|
1767 |
private static IJavaModelStatus validateClasspathEntry(IJavaProject project, IClasspathEntry entry, IClasspathContainer entryContainer, boolean checkSourceAttachment, boolean referredByContainer){ |
1767 |
private static IJavaModelStatus validateClasspathEntry(IJavaProject project, IClasspathEntry entry, IClasspathContainer entryContainer, boolean checkSourceAttachment, boolean referredByContainer){ |
1768 |
|
1768 |
|
1769 |
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); |
|
|
1770 |
IPath path = entry.getPath(); |
1769 |
IPath path = entry.getPath(); |
1771 |
|
1770 |
|
1772 |
// Build some common strings for status message |
1771 |
// Build some common strings for status message |
Lines 1960-1965
Link Here
|
1960 |
private static IJavaModelStatus validateLibraryEntry(IPath path, IJavaProject project, String container, IPath sourceAttachment, String entryPathMsg) { |
1959 |
private static IJavaModelStatus validateLibraryEntry(IPath path, IJavaProject project, String container, IPath sourceAttachment, String entryPathMsg) { |
1961 |
if (path.isAbsolute() && !path.isEmpty()) { |
1960 |
if (path.isAbsolute() && !path.isEmpty()) { |
1962 |
Object target = JavaModel.getTarget(path, true); |
1961 |
Object target = JavaModel.getTarget(path, true); |
|
|
1962 |
if (target == null) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=248661 |
1963 |
IPath workspaceLocation = workspaceRoot.getLocation(); |
1964 |
if (workspaceLocation.isPrefixOf(path)) { |
1965 |
target = JavaModel.getTarget(path.makeRelativeTo(workspaceLocation).makeAbsolute(), true); |
1966 |
} |
1967 |
} |
1963 |
if (target != null && !JavaCore.IGNORE.equals(project.getOption(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL, true))) { |
1968 |
if (target != null && !JavaCore.IGNORE.equals(project.getOption(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL, true))) { |
1964 |
long projectTargetJDK = CompilerOptions.versionToJdkLevel(project.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, true)); |
1969 |
long projectTargetJDK = CompilerOptions.versionToJdkLevel(project.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, true)); |
1965 |
long libraryJDK = Util.getJdkLevel(target); |
1970 |
long libraryJDK = Util.getJdkLevel(target); |