Note that there are some explanatory texts on larger screens.

plurals
  1. POIProgressMonitor .worked(int) not Updating Progress Bar
    primarykey
    data
    text
    <p>I'm using an IProgressMonitor for an Eclipse plugin (3.7). Various methods call .setTaskName(String) and .worked(int). When I run it, the task it's doing updates, but the green progress on the progress bar never advances. Below is some of the code:</p> <p>IProgressMonitor.beginTask is called here, then doFinish is called and the monitor is passed along to it:</p> <pre><code>public boolean performFinish() { IRunnableWithProgress op = new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException { try { monitor.beginTask("Building project...", 10); doFinish(projectNamePage.getComposite(), new GridLayout(), monitor); } catch (CoreException e1) { e1.printStackTrace(); } finally { monitor.done(); } } }; try { getContainer().run(false, false, op); } catch (InterruptedException e) { return false; } catch (InvocationTargetException e) { Throwable realException = e.getTargetException(); MessageDialog.openError(getShell(), "Error", realException.getMessage()); e.printStackTrace(); return false; } return true; } </code></pre> <p>The doFinish method delegates to other methods.</p> <pre><code>private void doFinish(Composite container, GridLayout layout, IProgressMonitor pmp) throws CoreException { //Get the root of the current Eclipse workspace IWorkspaceRoot iwr = ResourcesPlugin.getWorkspace().getRoot(); //Create a new project with the name requested in SampleNewWizardPage. IProject project = iwr.getProject(projectNamePage.getFileName().split("\\.")[0]); IProjectDescription description = null; project.create(pmp); project.open(pmp); description = project.getDescription(); pmp.worked(1); IJavaProject javaProject = setProjectDescription(description, project, pmp); setRawClasspathEntryList(pmp, javaProject); IFolder sourceFolder = buildSourceFolder(project, pmp); String jarFilePath = downloadAlgoraphJar(javaProject, iwr, pmp); buildAlgoSettingsFile(javaProject, iwr, pmp); populateClasspath(sourceFolder, javaProject, jarFilePath, pmp); buildPackageWithSkeleton(javaProject, sourceFolder, pmp); } </code></pre> <p>Here's an example of one of the methods doFinish delegates to:</p> <pre><code>private void setRawClasspathEntryList(IProgressMonitor pmp, IJavaProject javaProject) { pmp.setTaskName("Building classpath..."); List&lt;IClasspathEntry&gt; entries = new ArrayList&lt;IClasspathEntry&gt;(); entries.add(JavaRuntime.getDefaultJREContainerEntry()); try { javaProject.setRawClasspath(entries.toArray(new IClasspathEntry[entries.size()]), pmp); } catch (JavaModelException e) { e.printStackTrace(); } pmp.worked(1); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload