|
15 | 15 |
|
16 | 16 | import java.util.ArrayList; |
17 | 17 | import java.util.List; |
| 18 | +import java.util.concurrent.TimeUnit; |
18 | 19 |
|
19 | 20 | import org.eclipse.core.resources.IFile; |
20 | 21 | import org.eclipse.core.resources.IProject; |
| 22 | +import org.eclipse.core.resources.IResource; |
| 23 | +import org.eclipse.core.resources.IWorkspaceRoot; |
21 | 24 | import org.eclipse.core.resources.ResourcesPlugin; |
22 | 25 | import org.eclipse.core.runtime.CoreException; |
23 | 26 | import org.eclipse.core.runtime.IStatus; |
@@ -134,11 +137,24 @@ private void removeAllWorkingSets() { |
134 | 137 | } |
135 | 138 |
|
136 | 139 | private void cleanupWorkspace() { |
| 140 | + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); |
137 | 141 | try { |
138 | | - ResourcesPlugin.getWorkspace().getRoot().delete(true, null); |
| 142 | + root.delete(true, null); |
139 | 143 | } catch (CoreException e) { |
140 | | - TestPlugin.getDefault().getLog().log(e.getStatus()); |
141 | | - throw createAssertionError(e); |
| 144 | + // give it some more time |
| 145 | + try { |
| 146 | + TimeUnit.SECONDS.sleep(1); |
| 147 | + } catch (InterruptedException e1) { |
| 148 | + } |
| 149 | + try { |
| 150 | + root.refreshLocal(IResource.DEPTH_INFINITE, null); |
| 151 | + if (root.exists()) { |
| 152 | + root.delete(true, null); |
| 153 | + } |
| 154 | + } catch (CoreException e1) { |
| 155 | + TestPlugin.getDefault().getLog().log(e.getStatus()); |
| 156 | + throw createAssertionError(e); |
| 157 | + } |
142 | 158 | } finally { |
143 | 159 | project1 = null; |
144 | 160 | project2 = null; |
|
0 commit comments