Looking for examples of ProgressWindow usage

I'm working on a code metrics plugin with a UI modelled on IDEA's inspection panel and inspection toolwindow. The user request metrics be calculated by clicking a menu item, a dialog pops up to allow him to further specify his request (which metrics, what parameters), it churns a while, and a tool-window comes up with his answers neatly formatted and available for graphing. Metrics calculation is not particularly quick, however (~10-20 java files per second)so during the "churns for a while" part of the process, it would be nice if a progress panel would come up, allowing cancellation or backgrounding of the metrics calculations. I would like to use the com.intellij.progress.util.ProgressWindow, so as to keep the L&F of my plugin as close as possible to the inspection panel. Sadly, it doesn't look like ProgressWindow is really "open", and I can't find any documentation on it at all. Does anyone have or know of any code samples using the ProgressWindow?

--Dave Griffith

1 comment

This snippet works:

The following snippet works:

Project project = anActionEvent.getData(PlatformDataKeys.PROJECT);
if (project == null)
Runnable process = new Runnable() {
public void run() {
double i = 0;
ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
while (i <= 9) {
indicator.setFraction(i++ / 10);
try {
} catch (InterruptedException e) {
ProgressManager.getInstance().runProcessWithProgressSynchronously(process, "123",true,project);

Please sign in to leave a comment.