/***
 * Image/J Plugins
 * Copyright (C) 2002-2005 Jarek Sacha
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Latest release available at http://sourceforge.net/projects/ij-plugins/
 */
package net.sf.ij_plugins.util.progress;

import ij.IJ;

import javax.swing.*;
import java.lang.reflect.InvocationTargetException;

/**
 * Simple adapter for attaching a {@link ProgressReporter} to ImageJ's progress bar.
 * <p/>
 * Example use:
 * <pre>
 *   final ProgressReporter r = ...;
 *   final IJProgressBarAdapter progressBarAdapter = new IJProgressBarAdapter()
 *   r.addProgressListener(progressBarAdapter);
 *   ...
 *   r.removeProgressListener(progressBarAdapter);
 * </pre>
 * Always remember to remove listeners when processing is done to avoid memory leaks.
 *
 * @author Jarek Sacha
 * @version $Revision: 1.2 $
 */
public class IJProgressBarAdapter implements ProgressListener {
    public void progressNotification(final ProgressEvent e) {
        if (SwingUtilities.isEventDispatchThread()) {
            IJ.showStatus(e.getMessage());
            IJ.showProgress(e.getProgress());
        } else {
            try {
                SwingUtilities.invokeAndWait(new Runnable() {
                    public void run() {
                        IJ.showStatus(e.getMessage());
                        IJ.showProgress(e.getProgress());
                    }
                });
            } catch (InterruptedException ex) {
                IJ.log("InterruptedException " + ex.getMessage());
            } catch (InvocationTargetException ex) {
                IJ.log("InvocationTargetException" + ex.getMessage());
            }
        }
    }
}

@@ -1,12 +1,10 @@
 /*
-**
 %0A * Imag
@@ -40,17 +40,17 @@
 2002-200
-5
+8
  Jarek S
@@ -871,16 +871,19 @@
 lugins/%0A
+ *%0A
  */%0Apack
@@ -1248,16 +1248,17 @@
 dapter()
+;
 %0A *   r.
@@ -1484,37 +1484,8 @@
 cha%0A
- * @version $Revision: 1.2 $%0A
  */%0A

Correct type in example code.