Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "FAQ Why should I use the new progress service?"

 
m
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Eclipse 3.0 introduced a central new workbench <i>progress service</i>.
+
Eclipse 3.0 introduced a central new workbench <i>progress service</i>. This service combines the advantages of busy cursors and Progress dialogs by switching from one to the other, depending on the length of the long-running task. The service also handles a further wrinkle caused by the introduction of background jobs.  It is now possible for a short-running task to become blocked by a longer-running job  running in the background, owing to contention for various resources.  When this happens, the progress service opens a richer Progress dialog with a details area showing all running background jobs. This allows the user to see what is happening and to cancel either the foreground or the background task, depending on which is more important.
This service combines the advantages
+
of busy cursors and Progress dialogs by switching from one to the
+
other, depending on the length of the long-running task. The service
+
also handles a further wrinkle caused by the introduction of background
+
jobs.  It is now possible for a short-running task to become blocked
+
by a longer-running job  running in the background, owing to
+
contention for various resources.  When this happens, the progress
+
service opens a richer Progress dialog with a details area showing all
+
running background jobs. This allows the user to see what
+
  
is happening
+
The service is used much like the SWT <tt>BusyIndicator</tt>.  Simply pass an <tt>IRunnableWithProgress</tt> instance to the <tt>busyCursorWhile</tt> method.  The UI will prevent further user input and report progress feedback until the runnable completes. Note that the runnable executes in a non-UI thread, so you will have to use <tt>asyncExec</tt> or <tt>syncExec</tt> to execute any code within the runnable that requires access to UI widgets:
and to cancel either the foreground or the background task,
+
depending on which is more important.
+
  
 
The service is used much like the SWT <tt>BusyIndicator</tt>.  Simply pass
 
an <tt>IRunnableWithProgress</tt> instance to the
 
<tt>busyCursorWhile</tt> method.  The UI will prevent further
 
user input and report progress feedback until the runnable completes.
 
Note that the runnable executes in a non-UI thread, so you will
 
have to use <tt>asyncExec</tt> or <tt>syncExec</tt> to execute
 
any code within the runnable that requires access to UI widgets:
 
 
<pre>
 
<pre>
 
   IWorkbench wb = PlatformUI.getWorkbench();
 
   IWorkbench wb = PlatformUI.getWorkbench();
Line 32: Line 13:
 
</pre>
 
</pre>
  
 
+
This progress service was introduced to unify a number of progress-reporting mechanisms in Eclipse 2.1. JFace provides a Progress Monitor dialog, SWT provides a busy indicator, and the workbench provides a progress indicator on the status line. Each of these mechanisms has its own advantages and disadvantages.  The busy cursor is the least obtrusive and works well for tasks that typically take a second or less.  The Progress dialog provides much more information and allows the user to cancel but is visually distracting, especially on short tasks as it pops up over the user&#146;s work. The status line progress monitor is a bit less obtrusive but doesn&#146;t give an obvious indication that the UI is not accepting further input, and the space for presenting progress indication is very constrained. The new progress service tries to achieve a balance by automatically adapting between a busy cursor and a dialog, depending on the situation.
This progress service was introduced to unify a number of  
+
progress-reporting mechanisms in Eclipse 2.1. JFace  
+
provides a Progress Monitor dialog, SWT provides
+
a busy indicator, and the workbench provides a progress indicator on the
+
status line. Each of these mechanisms has its own advantages and  
+
disadvantages.  The busy cursor is the least obtrusive and works well
+
for tasks that typically take a second or less.  The Progress dialog provides
+
much more information and allows the user to cancel but is visually
+
distracting, especially on short tasks as it pops up over the user&#146;s work.
+
The status line progress monitor is a bit less obtrusive but doesn&#146;t give
+
an obvious indication that the UI is not accepting further input, and
+
the space for presenting progress indication is very constrained. The new
+
progress service tries to achieve a balance by automatically adapting
+
between a busy cursor and a dialog, depending on the situation.
+
 
+
  
 
== See Also: ==
 
== See Also: ==
 +
*[[FAQ Why do I get an invalid thread access exception?]]
 +
*[[FAQ How do I switch from using a Progress dialog to the Progress view?]]
 +
*[[FAQ Actions, commands, operations, jobs: What does it all mean?]]
 +
*[[FAQ What are IWorkspaceRunnable, IRunnableWithProgress, and WorkspaceModifyOperation?]]
  
[[FAQ_Why_do_I_get_an_invalid_thread_access_exception%3F]]
+
{{Template:FAQ_Tagline}}
 
+
[[FAQ_How_do_I_switch_from_using_a_Progress_dialog_to_the_Progress_view%3F]]
+
 
+
[[FAQ_Actions%2C_commands%2C_operations%2C_jobs%3A_What_does_it_all_mean%3F]]
+
 
+
[[FAQ_What_are_%3Ctt%3EIWorkspaceRunnable%3C%2Ftt%3E%2C_%3Ctt%3EIRunnableWithProgress%3C%2Ftt%3E%2C_and_%3Ctt%3EWorkspaceModifyOperation%3C%2Ftt%3E%3F]]
+
 
+
<hr><font size=-2>This FAQ was originally published in [http://www.eclipsefaq.org Official Eclipse 3.0 FAQs]. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the [http://www.eclipse.org/legal/epl-v10.html Eclipse Public License v1.0].</font>
+

Latest revision as of 22:26, 26 June 2006

Eclipse 3.0 introduced a central new workbench progress service. This service combines the advantages of busy cursors and Progress dialogs by switching from one to the other, depending on the length of the long-running task. The service also handles a further wrinkle caused by the introduction of background jobs. It is now possible for a short-running task to become blocked by a longer-running job running in the background, owing to contention for various resources. When this happens, the progress service opens a richer Progress dialog with a details area showing all running background jobs. This allows the user to see what is happening and to cancel either the foreground or the background task, depending on which is more important.

The service is used much like the SWT BusyIndicator. Simply pass an IRunnableWithProgress instance to the busyCursorWhile method. The UI will prevent further user input and report progress feedback until the runnable completes. Note that the runnable executes in a non-UI thread, so you will have to use asyncExec or syncExec to execute any code within the runnable that requires access to UI widgets:

   IWorkbench wb = PlatformUI.getWorkbench();
   IProgressService ps = wb.getProgressService();
   ps.busyCursorWhile(new IRunnableWithProgress() {
      public void run(IProgressMonitor pm) {
         ... do some long running task
      }
   });

This progress service was introduced to unify a number of progress-reporting mechanisms in Eclipse 2.1. JFace provides a Progress Monitor dialog, SWT provides a busy indicator, and the workbench provides a progress indicator on the status line. Each of these mechanisms has its own advantages and disadvantages. The busy cursor is the least obtrusive and works well for tasks that typically take a second or less. The Progress dialog provides much more information and allows the user to cancel but is visually distracting, especially on short tasks as it pops up over the user&#146;s work. The status line progress monitor is a bit less obtrusive but doesn&#146;t give an obvious indication that the UI is not accepting further input, and the space for presenting progress indication is very constrained. The new progress service tries to achieve a balance by automatically adapting between a busy cursor and a dialog, depending on the situation.

See Also:


This FAQ was originally published in Official Eclipse 3.0 FAQs. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the Eclipse Public License v1.0.

Back to the top