Skip to content

Commit

Permalink
attempt relying on workspace events
Browse files Browse the repository at this point in the history
NOT WORKING
  • Loading branch information
LorenzoBettini committed Dec 4, 2022
1 parent 53d7cc0 commit 9cc7d95
Showing 1 changed file with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import org.eclipse.emf.parsley.examples.views.EmfParsleyExamplesViewsActivator;
import org.eclipse.emf.parsley.junit4.ui.util.ImageTester;
import org.eclipse.emf.parsley.tests.swtbot.activator.EmfParsleySwtBotTestsActivator;
import org.eclipse.emf.parsley.tests.swtbot.utils.WaitForBuildCondition;
import org.eclipse.emf.parsley.tests.swtbot.views.TestOnSelectionLibraryTreeViewWithResourceURI;
import org.eclipse.emf.parsley.util.ActionBarsUtils;
import org.eclipse.jdt.core.JavaCore;
Expand Down Expand Up @@ -943,31 +944,24 @@ protected void assertProjectIsCreated(String projectName) {
}

protected void waitForBuild() throws CoreException {
// var condition = new WaitForBuildCondition(bot);
// condition.startListenForBuild();
// condition.waitForBuild();
bot.waitUntil(new DefaultCondition() {

private AssertionError error;

@Override
public boolean test() throws Exception {
IResourcesSetupUtil.waitForBuild();
try {
assertNoIssuesInProject();
} catch (AssertionError error) {
this.error = error;
System.err.println("errors: " + error.getMessage());
System.err.println("retrying...");
// ensure that all queued workspace operations and locks are released
try {
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
@Override
public void run(IProgressMonitor monitor) throws CoreException {
// nothing to do!
}
}, new NullProgressMonitor());
} catch (CoreException e) {
e.printStackTrace();
while (Display.getDefault().readAndDispatch()) {
}
IResourcesSetupUtil.cleanBuild();
return false;
}
return true;
Expand All @@ -977,7 +971,7 @@ public void run(IProgressMonitor monitor) throws CoreException {
public String getFailureMessage() {
return "Build with errors: " + error.getMessage();
}
});
}, SWTBotPreferences.TIMEOUT, 2000);
/*
IResourcesSetupUtil.reallyWaitForAutoBuild();
Expand Down

0 comments on commit 9cc7d95

Please sign in to comment.