Lines 1721-1727
Link Here
|
1721 |
} |
1721 |
} |
1722 |
|
1722 |
|
1723 |
// collect all container paths |
1723 |
// collect all container paths |
1724 |
HashMap allContainerPaths = new HashMap(); |
1724 |
final HashMap allContainerPaths = new HashMap(); |
1725 |
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); |
1725 |
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); |
1726 |
for (int i = 0, length = projects.length; i < length; i++) { |
1726 |
for (int i = 0, length = projects.length; i < length; i++) { |
1727 |
IProject project = projects[i]; |
1727 |
IProject project = projects[i]; |
Lines 1768-1790
Link Here
|
1768 |
// initialize all containers |
1768 |
// initialize all containers |
1769 |
boolean ok = false; |
1769 |
boolean ok = false; |
1770 |
try { |
1770 |
try { |
1771 |
Set keys = allContainerPaths.keySet(); |
1771 |
// if possible run iniside an IWokspaceRunnable with AVOID_UPATE to avoid unwanted builds |
1772 |
int length = keys.size(); |
1772 |
// (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=118507) |
1773 |
IJavaProject[] javaProjects = new IJavaProject[length]; // clone as the following will have a side effect |
1773 |
IWorkspaceRunnable runnable = |
1774 |
keys.toArray(javaProjects); |
1774 |
new IWorkspaceRunnable() { |
1775 |
for (int i = 0; i < length; i++) { |
1775 |
public void run(IProgressMonitor monitor) throws CoreException { |
1776 |
IJavaProject javaProject = javaProjects[i]; |
1776 |
Set keys = allContainerPaths.keySet(); |
1777 |
HashSet pathSet = (HashSet) allContainerPaths.get(javaProject); |
1777 |
int length = keys.size(); |
1778 |
if (pathSet == null) continue; |
1778 |
IJavaProject[] javaProjects = new IJavaProject[length]; // clone as the following will have a side effect |
1779 |
int length2 = pathSet.size(); |
1779 |
keys.toArray(javaProjects); |
1780 |
IPath[] paths = new IPath[length2]; |
1780 |
for (int i = 0; i < length; i++) { |
1781 |
pathSet.toArray(paths); // clone as the following will have a side effect |
1781 |
IJavaProject javaProject = javaProjects[i]; |
1782 |
for (int j = 0; j < length2; j++) { |
1782 |
HashSet pathSet = (HashSet) allContainerPaths.get(javaProject); |
1783 |
IPath path = paths[j]; |
1783 |
if (pathSet == null) continue; |
1784 |
initializeContainer(javaProject, path); |
1784 |
int length2 = pathSet.size(); |
1785 |
} |
1785 |
IPath[] paths = new IPath[length2]; |
1786 |
} |
1786 |
pathSet.toArray(paths); // clone as the following will have a side effect |
|
|
1787 |
for (int j = 0; j < length2; j++) { |
1788 |
IPath path = paths[j]; |
1789 |
initializeContainer(javaProject, path); |
1790 |
} |
1791 |
} |
1792 |
} |
1793 |
}; |
1794 |
IWorkspace workspace = ResourcesPlugin.getWorkspace(); |
1795 |
if (workspace.isTreeLocked()) |
1796 |
runnable.run(null/*no progress available*/); |
1797 |
else |
1798 |
workspace.run( |
1799 |
runnable, |
1800 |
null/*don't take any lock*/, |
1801 |
IWorkspace.AVOID_UPDATE, |
1802 |
null/*no progress available here*/); |
1787 |
ok = true; |
1803 |
ok = true; |
|
|
1804 |
} catch (CoreException e) { |
1805 |
// ignore |
1806 |
Util.log(e, "Exception while initializing all containers"); //$NON-NLS-1$ |
1788 |
} finally { |
1807 |
} finally { |
1789 |
if (!ok) { |
1808 |
if (!ok) { |
1790 |
// if we're being traversed by an exception, ensure that that containers are |
1809 |
// if we're being traversed by an exception, ensure that that containers are |
Lines 1797-1803
Link Here
|
1797 |
return containerGet(javaProjectToInit, containerToInit); |
1816 |
return containerGet(javaProjectToInit, containerToInit); |
1798 |
} |
1817 |
} |
1799 |
|
1818 |
|
1800 |
private IClasspathContainer initializeContainer(IJavaProject project, IPath containerPath) throws JavaModelException { |
1819 |
IClasspathContainer initializeContainer(IJavaProject project, IPath containerPath) throws JavaModelException { |
1801 |
|
1820 |
|
1802 |
IClasspathContainer container = null; |
1821 |
IClasspathContainer container = null; |
1803 |
final ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer(containerPath.segment(0)); |
1822 |
final ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer(containerPath.segment(0)); |