Lines 13-18
Link Here
|
13 |
import java.io.File; |
13 |
import java.io.File; |
14 |
import java.util.*; |
14 |
import java.util.*; |
15 |
|
15 |
|
|
|
16 |
import org.eclipse.core.resources.IContainer; |
16 |
import org.eclipse.core.resources.IFile; |
17 |
import org.eclipse.core.resources.IFile; |
17 |
import org.eclipse.core.resources.IFolder; |
18 |
import org.eclipse.core.resources.IFolder; |
18 |
import org.eclipse.core.resources.IProject; |
19 |
import org.eclipse.core.resources.IProject; |
Lines 112-118
Link Here
|
112 |
if (resource != null) { |
113 |
if (resource != null) { |
113 |
this.root = this.project.getPackageFragmentRoot(resource); |
114 |
this.root = this.project.getPackageFragmentRoot(resource); |
114 |
} else { |
115 |
} else { |
115 |
Object target = JavaModel.getTarget(ResourcesPlugin.getWorkspace().getRoot(), this.rootPath, false/*don't check existence*/); |
116 |
Object target = JavaModel.getTarget(this.rootPath, false/*don't check existence*/); |
116 |
if (target instanceof IResource) { |
117 |
if (target instanceof IResource) { |
117 |
this.root = this.project.getPackageFragmentRoot((IResource)target); |
118 |
this.root = this.project.getPackageFragmentRoot((IResource)target); |
118 |
} else { |
119 |
} else { |
Lines 340-345
Link Here
|
340 |
readRawClasspath(javaProject); |
341 |
readRawClasspath(javaProject); |
341 |
// ensure project references are updated (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=121569) |
342 |
// ensure project references are updated (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=121569) |
342 |
checkProjectReferenceChange(project, javaProject); |
343 |
checkProjectReferenceChange(project, javaProject); |
|
|
344 |
// and external folders as well |
345 |
checkExternalFolderChange(project, javaProject); |
343 |
} |
346 |
} |
344 |
|
347 |
|
345 |
this.state.rootsAreStale = true; |
348 |
this.state.rootsAreStale = true; |
Lines 359-364
Link Here
|
359 |
readRawClasspath(javaProject); |
362 |
readRawClasspath(javaProject); |
360 |
// ensure project references are updated |
363 |
// ensure project references are updated |
361 |
checkProjectReferenceChange(project, javaProject); |
364 |
checkProjectReferenceChange(project, javaProject); |
|
|
365 |
// and external folders as well |
366 |
checkExternalFolderChange(project, javaProject); |
362 |
} |
367 |
} |
363 |
} else { |
368 |
} else { |
364 |
try { |
369 |
try { |
Lines 386-391
Link Here
|
386 |
readRawClasspath(javaProject); |
391 |
readRawClasspath(javaProject); |
387 |
// ensure project references are updated (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=172666) |
392 |
// ensure project references are updated (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=172666) |
388 |
checkProjectReferenceChange(project, javaProject); |
393 |
checkProjectReferenceChange(project, javaProject); |
|
|
394 |
// and external folders as well |
395 |
checkExternalFolderChange(project, javaProject); |
389 |
} else { |
396 |
} else { |
390 |
// remove classpath cache so that initializeRoots() will not consider the project has a classpath |
397 |
// remove classpath cache so that initializeRoots() will not consider the project has a classpath |
391 |
this.manager.removePerProjectInfo(javaProject); |
398 |
this.manager.removePerProjectInfo(javaProject); |
Lines 471-476
Link Here
|
471 |
} |
478 |
} |
472 |
} |
479 |
} |
473 |
|
480 |
|
|
|
481 |
private void checkExternalFolderChange(IProject project, JavaProject javaProject) { |
482 |
ClasspathChange change = (ClasspathChange) this.classpathChanges.get(project); |
483 |
this.state.addExternalFolderChange(javaProject, change == null ? null : change.oldResolvedClasspath); |
484 |
} |
485 |
|
474 |
private void checkProjectReferenceChange(IProject project, JavaProject javaProject) { |
486 |
private void checkProjectReferenceChange(IProject project, JavaProject javaProject) { |
475 |
ClasspathChange change = (ClasspathChange) this.classpathChanges.get(project); |
487 |
ClasspathChange change = (ClasspathChange) this.classpathChanges.get(project); |
476 |
this.state.addProjectReferenceChange(javaProject, change == null ? null : change.oldResolvedClasspath); |
488 |
this.state.addProjectReferenceChange(javaProject, change == null ? null : change.oldResolvedClasspath); |
Lines 487-500
Link Here
|
487 |
} |
499 |
} |
488 |
} |
500 |
} |
489 |
private void checkSourceAttachmentChange(IResourceDelta delta, IResource res) { |
501 |
private void checkSourceAttachmentChange(IResourceDelta delta, IResource res) { |
490 |
IPath rootPath = (IPath)this.state.sourceAttachments.get(res.getFullPath()); |
502 |
IPath rootPath = (IPath)this.state.sourceAttachments.get(externalPath(res)); |
491 |
if (rootPath != null) { |
503 |
if (rootPath != null) { |
492 |
RootInfo rootInfo = this.rootInfo(rootPath, delta.getKind()); |
504 |
RootInfo rootInfo = this.rootInfo(rootPath, delta.getKind()); |
493 |
if (rootInfo != null) { |
505 |
if (rootInfo != null) { |
494 |
IJavaProject projectOfRoot = rootInfo.project; |
506 |
IJavaProject projectOfRoot = rootInfo.project; |
495 |
IPackageFragmentRoot root = null; |
507 |
IPackageFragmentRoot root = null; |
496 |
try { |
508 |
try { |
497 |
// close the root so that source attachement cache is flushed |
509 |
// close the root so that source attachment cache is flushed |
498 |
root = projectOfRoot.findPackageFragmentRoot(rootPath); |
510 |
root = projectOfRoot.findPackageFragmentRoot(rootPath); |
499 |
if (root != null) { |
511 |
if (root != null) { |
500 |
root.close(); |
512 |
root.close(); |
Lines 610-616
Link Here
|
610 |
if (rootInfo.project.contains(resource)) { |
622 |
if (rootInfo.project.contains(resource)) { |
611 |
PackageFragmentRoot root = (PackageFragmentRoot) rootInfo.getPackageFragmentRoot(null); |
623 |
PackageFragmentRoot root = (PackageFragmentRoot) rootInfo.getPackageFragmentRoot(null); |
612 |
// create package handle |
624 |
// create package handle |
613 |
IPath pkgPath = path.removeFirstSegments(rootInfo.rootPath.segmentCount()); |
625 |
IPath pkgPath = path.removeFirstSegments(root.resource().getFullPath().segmentCount()); |
614 |
String[] pkgName = pkgPath.segments(); |
626 |
String[] pkgName = pkgPath.segments(); |
615 |
element = root.getPackageFragment(pkgName); |
627 |
element = root.getPackageFragment(pkgName); |
616 |
} |
628 |
} |
Lines 834-840
Link Here
|
834 |
if (status == null){ |
846 |
if (status == null){ |
835 |
|
847 |
|
836 |
// compute shared status |
848 |
// compute shared status |
837 |
Object targetLibrary = JavaModel.getTarget(wksRoot, entryPath, true); |
849 |
Object targetLibrary = JavaModel.getTarget(entryPath, true); |
838 |
|
850 |
|
839 |
if (targetLibrary == null){ // missing JAR |
851 |
if (targetLibrary == null){ // missing JAR |
840 |
if (this.state.getExternalLibTimeStamps().remove(entryPath) != null){ |
852 |
if (this.state.getExternalLibTimeStamps().remove(entryPath) != null){ |
Lines 1047-1053
Link Here
|
1047 |
} |
1059 |
} |
1048 |
|
1060 |
|
1049 |
// find the element type of the moved from element |
1061 |
// find the element type of the moved from element |
1050 |
RootInfo movedFromInfo = this.enclosingRootInfo(movedFromPath, IResourceDelta.REMOVED); |
1062 |
IPath rootPath = externalPath(movedFromRes); |
|
|
1063 |
RootInfo movedFromInfo = this.enclosingRootInfo(rootPath, IResourceDelta.REMOVED); |
1051 |
int movedFromType = |
1064 |
int movedFromType = |
1052 |
this.elementType( |
1065 |
this.elementType( |
1053 |
movedFromRes, |
1066 |
movedFromRes, |
Lines 1133-1139
Link Here
|
1133 |
} |
1146 |
} |
1134 |
|
1147 |
|
1135 |
// find the element type of the moved from element |
1148 |
// find the element type of the moved from element |
1136 |
RootInfo movedToInfo = this.enclosingRootInfo(movedToPath, IResourceDelta.ADDED); |
1149 |
IPath rootPath = externalPath(movedToRes); |
|
|
1150 |
RootInfo movedToInfo = this.enclosingRootInfo(rootPath, IResourceDelta.ADDED); |
1137 |
int movedToType = |
1151 |
int movedToType = |
1138 |
this.elementType( |
1152 |
this.elementType( |
1139 |
movedToRes, |
1153 |
movedToRes, |
Lines 1208-1214
Link Here
|
1208 |
case IJavaElement.PACKAGE_FRAGMENT_ROOT: |
1222 |
case IJavaElement.PACKAGE_FRAGMENT_ROOT: |
1209 |
case IJavaElement.PACKAGE_FRAGMENT: |
1223 |
case IJavaElement.PACKAGE_FRAGMENT: |
1210 |
if (rootInfo == null) { |
1224 |
if (rootInfo == null) { |
1211 |
rootInfo = this.enclosingRootInfo(res.getFullPath(), kind); |
1225 |
IPath rootPath = externalPath(res); |
|
|
1226 |
rootInfo = this.enclosingRootInfo(rootPath, kind); |
1212 |
} |
1227 |
} |
1213 |
if (rootInfo == null) { |
1228 |
if (rootInfo == null) { |
1214 |
return NON_JAVA_RESOURCE; |
1229 |
return NON_JAVA_RESOURCE; |
Lines 1235-1246
Link Here
|
1235 |
return IJavaElement.COMPILATION_UNIT; |
1250 |
return IJavaElement.COMPILATION_UNIT; |
1236 |
} else if (Util.isValidClassFileName(fileName, sourceLevel, complianceLevel)) { |
1251 |
} else if (Util.isValidClassFileName(fileName, sourceLevel, complianceLevel)) { |
1237 |
return IJavaElement.CLASS_FILE; |
1252 |
return IJavaElement.CLASS_FILE; |
1238 |
} else if ((rootInfo = this.rootInfo(res.getFullPath(), kind)) != null |
|
|
1239 |
&& rootInfo.project.getProject().getFullPath().isPrefixOf(res.getFullPath()) /*ensure root is a root of its project (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=185310) */) { |
1240 |
// case of proj=src=bin and resource is a jar file on the classpath |
1241 |
return IJavaElement.PACKAGE_FRAGMENT_ROOT; |
1242 |
} else { |
1253 |
} else { |
1243 |
return NON_JAVA_RESOURCE; |
1254 |
IPath rootPath = externalPath(res); |
|
|
1255 |
if ((rootInfo = this.rootInfo(rootPath, kind)) != null |
1256 |
&& rootInfo.project.getProject().getFullPath().isPrefixOf(rootPath) /*ensure root is a root of its project (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=185310) */) { |
1257 |
// case of proj=src=bin and resource is a jar file on the classpath |
1258 |
return IJavaElement.PACKAGE_FRAGMENT_ROOT; |
1259 |
} else { |
1260 |
return NON_JAVA_RESOURCE; |
1261 |
} |
1244 |
} |
1262 |
} |
1245 |
|
1263 |
|
1246 |
default: |
1264 |
default: |
Lines 1253-1259
Link Here
|
1253 |
public void flush() { |
1271 |
public void flush() { |
1254 |
this.javaModelDeltas = new ArrayList(); |
1272 |
this.javaModelDeltas = new ArrayList(); |
1255 |
} |
1273 |
} |
1256 |
|
1274 |
|
1257 |
private SourceElementParser getSourceElementParser(Openable element) { |
1275 |
private SourceElementParser getSourceElementParser(Openable element) { |
1258 |
if (this.sourceElementParserCache == null) |
1276 |
if (this.sourceElementParserCache == null) |
1259 |
this.sourceElementParserCache = this.manager.indexManager.getSourceElementParser(element.getJavaProject(), null/*requestor will be set by indexer*/); |
1277 |
this.sourceElementParserCache = this.manager.indexManager.getSourceElementParser(element.getJavaProject(), null/*requestor will be set by indexer*/); |
Lines 1271-1276
Link Here
|
1271 |
} |
1289 |
} |
1272 |
return null; |
1290 |
return null; |
1273 |
} |
1291 |
} |
|
|
1292 |
|
1293 |
private IPath externalPath(IResource res) { |
1294 |
IPath resourcePath = res.getFullPath(); |
1295 |
if (ExternalFoldersManager.isExternal(resourcePath)) |
1296 |
return res.getLocation(); |
1297 |
return resourcePath; |
1298 |
} |
1299 |
|
1274 |
/* |
1300 |
/* |
1275 |
* Fire Java Model delta, flushing them after the fact after post_change notification. |
1301 |
* Fire Java Model delta, flushing them after the fact after post_change notification. |
1276 |
* If the firing mode has been turned off, this has no effect. |
1302 |
* If the firing mode has been turned off, this has no effect. |
Lines 1391-1397
Link Here
|
1391 |
} |
1417 |
} |
1392 |
return true; |
1418 |
return true; |
1393 |
} |
1419 |
} |
1394 |
}); |
1420 |
}, |
|
|
1421 |
IContainer.INCLUDE_HIDDEN); |
1395 |
} catch(FoundRelevantDeltaException e) { |
1422 |
} catch(FoundRelevantDeltaException e) { |
1396 |
//System.out.println("RELEVANT DELTA detected in: "+ (System.currentTimeMillis() - start)); |
1423 |
//System.out.println("RELEVANT DELTA detected in: "+ (System.currentTimeMillis() - start)); |
1397 |
return true; |
1424 |
return true; |
Lines 1556-1563
Link Here
|
1556 |
* <li>An entry is made in the delta reporting a content change (K_CHANGE with F_CONTENT flag set). |
1583 |
* <li>An entry is made in the delta reporting a content change (K_CHANGE with F_CONTENT flag set). |
1557 |
* </ul> |
1584 |
* </ul> |
1558 |
*/ |
1585 |
*/ |
1559 |
private void nonJavaResourcesChanged(Openable element, IResourceDelta delta) |
1586 |
private void nonJavaResourcesChanged(Openable element, IResourceDelta delta) throws JavaModelException { |
1560 |
throws JavaModelException { |
1587 |
if (ExternalFoldersManager.isExternal(delta.getFullPath())) |
|
|
1588 |
return; |
1561 |
|
1589 |
|
1562 |
// reset non-java resources if element was open |
1590 |
// reset non-java resources if element was open |
1563 |
if (element.isOpen()) { |
1591 |
if (element.isOpen()) { |
Lines 1655-1661
Link Here
|
1655 |
if (this.currentElement instanceof IPackageFragmentRoot) { |
1683 |
if (this.currentElement instanceof IPackageFragmentRoot) { |
1656 |
currentElementPath = ((IPackageFragmentRoot)this.currentElement).getPath(); |
1684 |
currentElementPath = ((IPackageFragmentRoot)this.currentElement).getPath(); |
1657 |
} else { |
1685 |
} else { |
1658 |
IResource currentElementResource = this.currentElement.getResource(); |
1686 |
IResource currentElementResource = this.currentElement.resource(); |
1659 |
if (currentElementResource != null) { |
1687 |
if (currentElementResource != null) { |
1660 |
currentElementPath = currentElementResource.getFullPath(); |
1688 |
currentElementPath = currentElementResource.getFullPath(); |
1661 |
} |
1689 |
} |
Lines 1698-1704
Link Here
|
1698 |
this.currentElement = null; |
1726 |
this.currentElement = null; |
1699 |
|
1727 |
|
1700 |
// get the workspace delta, and start processing there. |
1728 |
// get the workspace delta, and start processing there. |
1701 |
IResourceDelta[] deltas = changes.getAffectedChildren(); |
1729 |
IResourceDelta[] deltas = changes.getAffectedChildren(IResourceDelta.ADDED | IResourceDelta.REMOVED | IResourceDelta.CHANGED, IContainer.INCLUDE_HIDDEN); |
1702 |
for (int i = 0; i < deltas.length; i++) { |
1730 |
for (int i = 0; i < deltas.length; i++) { |
1703 |
IResourceDelta delta = deltas[i]; |
1731 |
IResourceDelta delta = deltas[i]; |
1704 |
IResource res = delta.getResource(); |
1732 |
IResource res = delta.getResource(); |
Lines 1712-1719
Link Here
|
1712 |
if (!wasJavaProject && !isJavaProject) { |
1740 |
if (!wasJavaProject && !isJavaProject) { |
1713 |
elementType = NON_JAVA_RESOURCE; |
1741 |
elementType = NON_JAVA_RESOURCE; |
1714 |
} else { |
1742 |
} else { |
1715 |
rootInfo = this.enclosingRootInfo(res.getFullPath(), delta.getKind()); |
1743 |
IPath rootPath = externalPath(res); |
1716 |
if (rootInfo != null && rootInfo.isRootOfProject(res.getFullPath())) { |
1744 |
rootInfo = this.enclosingRootInfo(rootPath, delta.getKind()); |
|
|
1745 |
if (rootInfo != null && rootInfo.isRootOfProject(rootPath)) { |
1717 |
elementType = IJavaElement.PACKAGE_FRAGMENT_ROOT; |
1746 |
elementType = IJavaElement.PACKAGE_FRAGMENT_ROOT; |
1718 |
} else { |
1747 |
} else { |
1719 |
elementType = IJavaElement.JAVA_PROJECT; |
1748 |
elementType = IJavaElement.JAVA_PROJECT; |
Lines 1843-1848
Link Here
|
1843 |
if ((result & ClasspathChange.HAS_PROJECT_CHANGE) != 0) { |
1872 |
if ((result & ClasspathChange.HAS_PROJECT_CHANGE) != 0) { |
1844 |
this.state.addProjectReferenceChange(change.project, change.oldResolvedClasspath); |
1873 |
this.state.addProjectReferenceChange(change.project, change.oldResolvedClasspath); |
1845 |
} |
1874 |
} |
|
|
1875 |
if ((result & ClasspathChange.HAS_LIBRARY_CHANGE) != 0) { |
1876 |
state.addExternalFolderChange(change.project, change.oldResolvedClasspath); |
1877 |
} |
1846 |
} |
1878 |
} |
1847 |
this.classpathChanges.clear(); |
1879 |
this.classpathChanges.clear(); |
1848 |
if (!hasDelta) |
1880 |
if (!hasDelta) |
Lines 1853-1862
Link Here
|
1853 |
if (elementsToRefresh == null) { |
1885 |
if (elementsToRefresh == null) { |
1854 |
elementsToRefresh = this.state.removeExternalElementsToRefresh(); |
1886 |
elementsToRefresh = this.state.removeExternalElementsToRefresh(); |
1855 |
} else { |
1887 |
} else { |
1856 |
HashSet existingElements = this.state.removeExternalElementsToRefresh(); |
1888 |
HashSet newElementsToRefresh = this.state.removeExternalElementsToRefresh(); |
1857 |
if (existingElements != null) { |
1889 |
if (newElementsToRefresh != null) |
1858 |
elementsToRefresh.addAll(existingElements); |
1890 |
elementsToRefresh.addAll(newElementsToRefresh); |
1859 |
} |
|
|
1860 |
} |
1891 |
} |
1861 |
|
1892 |
|
1862 |
// generate external archive change deltas |
1893 |
// generate external archive change deltas |
Lines 1893-1898
Link Here
|
1893 |
boolean isAffected = isAffectedBy(delta); |
1924 |
boolean isAffected = isAffectedBy(delta); |
1894 |
boolean needCycleValidation = isAffected && validateClasspaths(delta); |
1925 |
boolean needCycleValidation = isAffected && validateClasspaths(delta); |
1895 |
|
1926 |
|
|
|
1927 |
// update external folders if necessary |
1928 |
ExternalFolderChange[] folderChanges = this.state.removeExternalFolderChanges(); |
1929 |
if (folderChanges != null) { |
1930 |
for (int i = 0, length = folderChanges.length; i < length; i++) { |
1931 |
try { |
1932 |
folderChanges[i].updateExternalFoldersIfNecessary(null); |
1933 |
} catch (JavaModelException e) { |
1934 |
if (!e.isDoesNotExist()) |
1935 |
Util.log(e, "Exception while updating external folders"); //$NON-NLS-1$ |
1936 |
} |
1937 |
} |
1938 |
} |
1939 |
|
1896 |
// create classpath markers if necessary |
1940 |
// create classpath markers if necessary |
1897 |
ClasspathValidation[] validations = this.state.removeClasspathValidations(); |
1941 |
ClasspathValidation[] validations = this.state.removeClasspathValidations(); |
1898 |
if (validations != null) { |
1942 |
if (validations != null) { |
Lines 1910-1915
Link Here
|
1910 |
projectRefChanges[i].updateProjectReferencesIfNecessary(); |
1954 |
projectRefChanges[i].updateProjectReferencesIfNecessary(); |
1911 |
} catch(JavaModelException e) { |
1955 |
} catch(JavaModelException e) { |
1912 |
// project doesn't exist any longer, continue with next one |
1956 |
// project doesn't exist any longer, continue with next one |
|
|
1957 |
if (!e.isDoesNotExist()) |
1958 |
Util.log(e, "Exception while updating project references"); //$NON-NLS-1$ |
1913 |
} |
1959 |
} |
1914 |
} |
1960 |
} |
1915 |
} |
1961 |
} |
Lines 2016-2024
Link Here
|
2016 |
this.checkSourceAttachmentChange(child, childRes); |
2062 |
this.checkSourceAttachmentChange(child, childRes); |
2017 |
|
2063 |
|
2018 |
// find out whether the child is a package fragment root of the current project |
2064 |
// find out whether the child is a package fragment root of the current project |
2019 |
IPath childPath = childRes.getFullPath(); |
2065 |
IPath childPath = externalPath(childRes); |
2020 |
int childKind = child.getKind(); |
2066 |
int childKind = child.getKind(); |
2021 |
RootInfo childRootInfo = this.rootInfo(childPath, childKind); |
2067 |
RootInfo childRootInfo = this.rootInfo(childPath, childKind); |
|
|
2068 |
RootInfo originalChildRootInfo = childRootInfo; |
2022 |
if (childRootInfo != null && !childRootInfo.isRootOfProject(childPath)) { |
2069 |
if (childRootInfo != null && !childRootInfo.isRootOfProject(childPath)) { |
2023 |
// package fragment root of another project (dealt with later) |
2070 |
// package fragment root of another project (dealt with later) |
2024 |
childRootInfo = null; |
2071 |
childRootInfo = null; |
Lines 2091-2098
Link Here
|
2091 |
// or if it is not a package fragment root of the current project |
2138 |
// or if it is not a package fragment root of the current project |
2092 |
// but it is a package fragment root of another project, traverse delta too |
2139 |
// but it is a package fragment root of another project, traverse delta too |
2093 |
if (isNestedRoot |
2140 |
if (isNestedRoot |
2094 |
|| (childRootInfo == null && (childRootInfo = this.rootInfo(childPath, childKind)) != null)) { |
2141 |
|| (childRootInfo == null && originalChildRootInfo != null)) { |
2095 |
this.traverseDelta(child, IJavaElement.PACKAGE_FRAGMENT_ROOT, childRootInfo, null); // binary output of childRootInfo.project cannot be this root |
2142 |
this.traverseDelta(child, IJavaElement.PACKAGE_FRAGMENT_ROOT, originalChildRootInfo, null); // binary output of childRootInfo.project cannot be this root |
2096 |
} |
2143 |
} |
2097 |
|
2144 |
|
2098 |
// if the child is a package fragment root of one or several other projects |
2145 |
// if the child is a package fragment root of one or several other projects |
Lines 2100-2108
Link Here
|
2100 |
if ((rootList = this.otherRootsInfo(childPath, childKind)) != null) { |
2147 |
if ((rootList = this.otherRootsInfo(childPath, childKind)) != null) { |
2101 |
Iterator iterator = rootList.iterator(); |
2148 |
Iterator iterator = rootList.iterator(); |
2102 |
while (iterator.hasNext()) { |
2149 |
while (iterator.hasNext()) { |
2103 |
childRootInfo = (RootInfo) iterator.next(); |
2150 |
originalChildRootInfo = (RootInfo) iterator.next(); |
2104 |
this.currentElement = null; // ensure that 2 roots refering to the same resource don't share the current element (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=210746 ) |
2151 |
this.currentElement = null; // ensure that 2 roots refering to the same resource don't share the current element (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=210746 ) |
2105 |
this.traverseDelta(child, IJavaElement.PACKAGE_FRAGMENT_ROOT, childRootInfo, null); // binary output of childRootInfo.project cannot be this root |
2152 |
this.traverseDelta(child, IJavaElement.PACKAGE_FRAGMENT_ROOT, originalChildRootInfo, null); // binary output of childRootInfo.project cannot be this root |
2106 |
} |
2153 |
} |
2107 |
} |
2154 |
} |
2108 |
} |
2155 |
} |
Lines 2285-2291
Link Here
|
2285 |
return elementType == IJavaElement.PACKAGE_FRAGMENT; |
2332 |
return elementType == IJavaElement.PACKAGE_FRAGMENT; |
2286 |
case IResourceDelta.CHANGED : |
2333 |
case IResourceDelta.CHANGED : |
2287 |
int flags = delta.getFlags(); |
2334 |
int flags = delta.getFlags(); |
2288 |
if ((flags & IResourceDelta.CONTENT) != 0 || (flags & IResourceDelta.ENCODING) != 0) { |
2335 |
if (elementType == IJavaElement.PACKAGE_FRAGMENT_ROOT && (flags & IResourceDelta.LOCAL_CHANGED) != 0) { |
|
|
2336 |
// external folder added or removed |
2337 |
deltaRes = delta.getResource(); |
2338 |
Object target = JavaModel.getExternalTarget(deltaRes.getLocation(), true/*check resource existence*/); |
2339 |
element = createElement(deltaRes, elementType, rootInfo); |
2340 |
updateIndex(element, delta); |
2341 |
if (target != null) { |
2342 |
// external folder added |
2343 |
elementAdded(element, delta, rootInfo); |
2344 |
} else { |
2345 |
// external folder removed |
2346 |
elementRemoved(element, delta, rootInfo); |
2347 |
} |
2348 |
this.state.addClasspathValidation(rootInfo.project); |
2349 |
} else if ((flags & IResourceDelta.CONTENT) != 0 || (flags & IResourceDelta.ENCODING) != 0) { |
2289 |
// content or encoding has changed |
2350 |
// content or encoding has changed |
2290 |
element = createElement(delta.getResource(), elementType, rootInfo); |
2351 |
element = createElement(delta.getResource(), elementType, rootInfo); |
2291 |
if (element == null) return false; |
2352 |
if (element == null) return false; |
Lines 2397-2403
Link Here
|
2397 |
break; |
2458 |
break; |
2398 |
} |
2459 |
} |
2399 |
int kind = delta.getKind(); |
2460 |
int kind = delta.getKind(); |
2400 |
if (kind == IResourceDelta.ADDED || kind == IResourceDelta.REMOVED) { |
2461 |
if (kind == IResourceDelta.ADDED || kind == IResourceDelta.REMOVED || (kind == IResourceDelta.CHANGED && (delta.getFlags() & IResourceDelta.LOCAL_CHANGED) != 0)) { |
2401 |
PackageFragmentRoot root = (PackageFragmentRoot)element; |
2462 |
PackageFragmentRoot root = (PackageFragmentRoot)element; |
2402 |
this.updateRootIndex(root, CharOperation.NO_STRINGS, delta); |
2463 |
this.updateRootIndex(root, CharOperation.NO_STRINGS, delta); |
2403 |
break; |
2464 |
break; |
Lines 2405-2410
Link Here
|
2405 |
// don't break as packages of the package fragment root can be indexed below |
2466 |
// don't break as packages of the package fragment root can be indexed below |
2406 |
case IJavaElement.PACKAGE_FRAGMENT : |
2467 |
case IJavaElement.PACKAGE_FRAGMENT : |
2407 |
switch (delta.getKind()) { |
2468 |
switch (delta.getKind()) { |
|
|
2469 |
case IResourceDelta.CHANGED: |
2470 |
if ((delta.getFlags() & IResourceDelta.LOCAL_CHANGED) == 0) |
2471 |
break; |
2408 |
case IResourceDelta.ADDED: |
2472 |
case IResourceDelta.ADDED: |
2409 |
case IResourceDelta.REMOVED: |
2473 |
case IResourceDelta.REMOVED: |
2410 |
IPackageFragment pkg = null; |
2474 |
IPackageFragment pkg = null; |
Lines 2442-2448
Link Here
|
2442 |
case IJavaElement.CLASS_FILE : |
2506 |
case IJavaElement.CLASS_FILE : |
2443 |
IFile file = (IFile) delta.getResource(); |
2507 |
IFile file = (IFile) delta.getResource(); |
2444 |
IJavaProject project = element.getJavaProject(); |
2508 |
IJavaProject project = element.getJavaProject(); |
2445 |
IPath binaryFolderPath = element.getPackageFragmentRoot().getPath(); |
2509 |
PackageFragmentRoot root = element.getPackageFragmentRoot(); |
|
|
2510 |
IPath binaryFolderPath = root.isExternal() && !root.isArchive() ? root.resource().getFullPath() : root.getPath(); |
2446 |
// if the class file is part of the binary output, it has been created by |
2511 |
// if the class file is part of the binary output, it has been created by |
2447 |
// the java builder -> ignore |
2512 |
// the java builder -> ignore |
2448 |
try { |
2513 |
try { |