I am working on Eclipse RCP application, I want to achieve the eclipse workspace job with a Dialog with the buttons like "Run in Background", "Cancel" and "Details". I tried all the options but all my efforts did not bear fruit. However I am able to create ProgressBar with ProgressMonitor dialog with cancel button. I want to achieve like the image given below. Please help me in this regard. I also went through the following link along with other links. I also tried with IProgressService but it did not work. Currently I am working in Eclipse Photon version.
https://www.eclipse.org/articles/Article-Concurrency/jobs-api.html
I provide below the code for workspace job
public void show11() {
Job job =
new WorkspaceJob("name") {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
for (int i = 0; i < 10; i++) {
System.out.println("This is a MYJob");
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
monitor.subTask("Copying file " + (i + 1) + " of " + "workload" + "...");
}
return Status.OK_STATUS;
}
};
job.setUser(true);
job.schedule();
try
{
job.join();
}
catch (InterruptedException e)
{
//
}
}
Job
orWorkspaceJob
withsetUser(true)
which will display this dialog – Bellyfulorg.eclipse.ui.internal.progress.ProgressMonitorFocusJobDialog
which has these three buttons. Show us the code you are trying. – Bellyfuljob.join()
blocks the UI thread so the dialog cannot be displayed - don't do this in the UI thread. – Bellyful