I have written a utils method, where I have to invoke the run method of a Action. But, I have to call this util method repeatedly with different parameters. The util method signature is
clickPullDownMenu(String ViewID, String MenuPath){
Display.getDefault.syncexec(new Runnable(){
public void run(){
//few lines of code
action.run();
}));
}
}
When I give a 'view id' and the 'Menu' to be clicked.
Example.
clickPullDownMenu("view_ID", "import");
//check whether the entry is imported.
After I invoke the save menu item, it takes sometime for the 'run' method to run. Hence, my code to check whether the import of data is completed, is failing.
But, when I debug the same, it is successfully working as I use step over for each step.
Is there a way to wait till the run() method is completely fully? I suspect that run() method in turn may invoke some Runnables.
If you know about how long the run method is taking on average, you can just wait the upper limit of that average to be safe if it's not too terribly long like so:
You would put that where your action.run() call is.