X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BusyIndicator.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BusyIndicator.java index 1b4caa2..111a872 100644 --- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BusyIndicator.java +++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BusyIndicator.java @@ -1,10 +1,10 @@ /** * Copyright (c) 2003 IBM Corporation and others. - * All rights reserved.   This program and the accompanying materials + * All rights reserved. � This program and the accompanying materials * are made available under the terms of the Common Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v10.html - * + �* * Contributors: * IBM - Initial API and implementation */ @@ -19,49 +19,56 @@ import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; + /** * An animated image to show busy status of the Web browser. */ public class BusyIndicator extends Canvas { protected Image[] images; + protected Image image; protected Thread busyThread; + protected boolean stop; /** * BusyWidget constructor comment. - * @param parent org.eclipse.swt.widgets.Composite - * @param style int + * + * @param parent + * org.eclipse.swt.widgets.Composite + * @param style + * int */ public BusyIndicator(Composite parent, int style) { super(parent, style); - + images = ImageResource.getBusyImages(); - + addPaintListener(new PaintListener() { public void paintControl(PaintEvent event) { onPaint(event); } }); - + image = images[0]; } - + public Point computeSize(int wHint, int hHint, boolean changed) { return new Point(25, 25); } - + /** * Creates a thread to animate the image. */ protected synchronized void createBusyThread() { if (busyThread != null) return; - + stop = false; busyThread = new Thread() { protected int count; + public void run() { try { count = 1; @@ -79,7 +86,8 @@ public class BusyIndicator extends Canvas { }); try { sleep(125); - } catch (Exception e) { } + } catch (Exception e) { + } } if (busyThread == null) Display.getDefault().syncExec(new Thread() { @@ -92,42 +100,42 @@ public class BusyIndicator extends Canvas { } } }; - + busyThread.setPriority(Thread.NORM_PRIORITY + 2); busyThread.setDaemon(true); busyThread.start(); } - + public void dispose() { stop = true; busyThread = null; super.dispose(); } - + /** * Return the image or null. */ - public Image getImage() { - return image; - } +// public Image getImage() { +// return image; +// } /** * Returns true if it is currently busy. - * + * * @return boolean */ public boolean isBusy() { return (busyThread != null); } - /* + /* * Process the paint event */ protected void onPaint(PaintEvent event) { Rectangle rect = getClientArea(); if (rect.width == 0 || rect.height == 0) return; - + GC gc = event.gc; if (image != null) gc.drawImage(image, 2, 2); @@ -135,8 +143,9 @@ public class BusyIndicator extends Canvas { /** * Sets the indicators busy count up (true) or down (false) one. - * - * @param busy boolean + * + * @param busy + * boolean */ public synchronized void setBusy(boolean busy) { if (busy) { @@ -151,8 +160,7 @@ public class BusyIndicator extends Canvas { } /** - * Set the image. - * The value null clears it. + * Set the image. The value null clears it. */ public void setImage(Image image) { if (image != this.image && !isDisposed()) {