Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 156687

Summary: [Progress] IProgressService#busyCursorWhile() opens ProgressMonitorDialog with unmodifyable main taks name
Product: [Eclipse Project] Platform Reporter: Marcin Krzysztof Dabrowski <marcin.dabrowski>
Component: UIAssignee: Tod Creasey <Tod_Creasey>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: ognen.ivanovski, ramon.grunder, titanandrews
Version: 3.2Keywords: helpwanted
Target Milestone: 3.4   
Hardware: PC   
OS: Windows XP   
Whiteboard: hasPatch
Attachments:
Description Flags
Example zip none

Description Marcin Krzysztof Dabrowski CLA 2006-09-08 08:52:14 EDT
3.2 and 3.3M1

When ProgressManager.busyCursorWhile() method is called it after some time it opens ProgresMonitorDialog with unmodifyable main taks name.

Running this code:
PlatformUI.getWorkbench().getProgressService().
    busyCursorWhile(new IRunnableWithProgress() {
        public void run(IProgressMonitor monitor) {
          monitor.beginTask("Long running action", 100);
         // do long runing action logic
        }
    });
shows ProgresMonitorDialog with default main task name:
"Operation in progress...".

But running this code:
ProgressMonitorDialog pd = new ProgressMonitorDialog(window.getShell());
pd.run(true, true, new IRunnableWithProgress() {
    public void run(IProgressMonitor monitor) throws
        InvocationTargetException, InterruptedException {
      monitor.beginTask("Long running action", 100);
      // do long runing action logic
    }
  });
shows ProgresMonitorDialog with default main task name:
"Long running action".

This bug is not present in 3.1.
Comment 1 Tod Creasey CLA 2007-06-19 15:01:24 EDT
Please feel free to attach a patch should you have a solution in hand
Comment 2 Marcin Krzysztof Dabrowski CLA 2007-07-14 11:18:44 EDT
Today I decided to investigate the source of this bug.
And I think that I found it.

When we use PlatformUI.getWorkbench().getProgressService().busyCursorWhile(),
this method creates ProgressMonitorJobsDialog (subclass of ProgressMonitorDialog) and sets its openOnRun property to false.

Finally the problem is placed in class ProgressMonitorDialog in method 
private void setMessage(String messageString).

There is this statement:
if (messageLabel == null || messageLabel.isDisposed() || !messageLabel.isVisible()) {
   return;
}
which prevents setting task name when messageLabel widget is not created or visible.

ProgressMonitorJobsDialog by default is not opened and became visible before task execution begin, and task name is not set.

So, the resolution is to delete "!messageLabel.isVisible()" condition or to change it to (!messageLabel.isVisible() && openOnRun)
Comment 3 Tod Creasey CLA 2007-07-16 08:15:02 EDT
I'll try and look at this in 3.4
Comment 4 Barry Andrews CLA 2007-08-01 17:53:02 EDT
Is there a work around for this in Eclipse 3.2? I have the same issue.

thanks,

Barry
Comment 5 Tod Creasey CLA 2007-08-02 07:39:31 EDT
There is not currently a workaround for this.
Comment 6 Tod Creasey CLA 2007-09-28 15:50:10 EDT
This is working in 3.4. I will attach a plug-in to demonstrate.
Comment 7 Tod Creasey CLA 2007-09-28 15:50:54 EDT
Created attachment 79424 [details]
Example zip