📄 progresswindow.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: ProgressWindow.java
package org.gudy.azureus2.ui.swt.progress;
import com.aelitis.azureus.core.*;
import com.aelitis.azureus.ui.swt.imageloader.ImageLoader;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.internat.MessageText;
import org.gudy.azureus2.core3.util.*;
import org.gudy.azureus2.ui.swt.Utils;
import org.gudy.azureus2.ui.swt.components.shell.ShellFactory;
import org.gudy.azureus2.ui.swt.mainwindow.SWTThread;
public class ProgressWindow
{
private volatile Shell shell;
private volatile boolean task_complete;
private final String resource;
private Image spinImages[];
protected int curSpinIndex;
public static void register(AzureusCore core)
{
core.addOperationListener(new AzureusCoreOperationListener() {
public boolean operationCreated(AzureusCoreOperation operation)
{
if ((operation.getOperationType() == 2 || operation.getOperationType() == 3) && Utils.isThisThreadSWT() && operation.getTask() != null)
{
new ProgressWindow(operation);
return true;
} else
{
return false;
}
}
});
}
protected ProgressWindow(AzureusCoreOperation operation)
{
RuntimeException error[];
curSpinIndex = 0;
error = (new RuntimeException[] {
null
});
resource = operation.getOperationType() != 2 ? "progress.window.msg.progress" : "progress.window.msg.filemove";
new DelayedEvent("ProgWin", operation.getOperationType() != 2 ? 10L : 1000L, new AERunnable() {
final ProgressWindow this$0;
public void runSupport()
{
if (!task_complete)
Utils.execSWTThread(new Runnable() {
final 2 this$1;
public void run()
{
synchronized (0)
{
if (!task_complete)
{
Shell shell = ShellFactory.createMainShell(0x10860);
showDialog(shell);
}
}
}
{
this$1 = 2.this;
super();
}
}, false);
}
{
this$0 = ProgressWindow.this;
super();
}
});
(new AEThread2(operation, error) {
final AzureusCoreOperation val$operation;
final RuntimeException val$error[];
final ProgressWindow this$0;
public void run()
{
operation.getTask().run(operation);
Utils.execSWTThread(new Runnable() {
final 3 this$1;
public void run()
{
destroy();
}
{
this$1 = 3.this;
super();
}
});
break MISSING_BLOCK_LABEL_101;
RuntimeException e;
e;
error[0] = e;
Utils.execSWTThread(new 1());
break MISSING_BLOCK_LABEL_101;
e;
error[0] = new RuntimeException(e);
Utils.execSWTThread(new 1());
break MISSING_BLOCK_LABEL_101;
Exception exception3;
exception3;
Utils.execSWTThread(new 1());
throw exception3;
}
{
this$0 = ProgressWindow.this;
operation = azureuscoreoperation;
error = aruntimeexception;
super(x0, x1);
}
}).start();
Display display = SWTThread.getInstance().getDisplay();
do
{
if (task_complete || display.isDisposed())
break;
if (!display.readAndDispatch())
display.sleep();
} while (true);
synchronized (this)
{
task_complete = true;
}
try
{
if (shell != null && !shell.isDisposed())
shell.dispose();
}
catch (Throwable e)
{
Debug.printStackTrace(e);
}
break MISSING_BLOCK_LABEL_247;
Exception exception1;
exception1;
synchronized (this)
{
task_complete = true;
}
try
{
if (shell != null && !shell.isDisposed())
shell.dispose();
}
catch (Throwable e)
{
Debug.printStackTrace(e);
}
throw exception1;
if (error[0] != null)
throw error[0];
else
return;
}
public ProgressWindow(Shell _parent, String _resource, int _style, int _delay_millis)
{
curSpinIndex = 0;
resource = _resource;
final Shell shell = new Shell(_parent, _style);
if (_delay_millis <= 0)
showDialog(shell);
else
new DelayedEvent("ProgWin", _delay_millis, new AERunnable() {
final Shell val$shell;
final ProgressWindow this$0;
public void runSupport()
{
if (!task_complete)
Utils.execSWTThread(new Runnable() {
final 4 this$1;
public void run()
{
synchronized (0)
{
if (!task_complete)
showDialog(shell);
}
}
{
this$1 = 4.this;
super();
}
}, false);
}
{
this$0 = ProgressWindow.this;
shell = shell1;
super();
}
});
}
protected void showDialog(Shell _shell)
{
shell = _shell;
shell.setText(MessageText.getString("progress.window.title"));
Utils.setShellIcon(shell);
shell.addListener(21, new Listener() {
final ProgressWindow this$0;
public void handleEvent(Event event)
{
event.doit = false;
}
{
this$0 = ProgressWindow.this;
super();
}
});
GridLayout layout = new GridLayout();
layout.numColumns = 2;
shell.setLayout(layout);
spinImages = ImageLoader.getInstance().getImages("working");
if (spinImages.length == 0 || spinImages == null)
{
new Label(shell, 0);
} else
{
Rectangle spinBounds = spinImages[0].getBounds();
final Canvas canvas = new Canvas(0, spinBounds) {
final Rectangle val$spinBounds;
final ProgressWindow this$0;
public Point computeSize(int wHint, int hHint, boolean changed)
{
return new Point(spinBounds.width, spinBounds.height);
}
{
this$0 = ProgressWindow.this;
spinBounds = rectangle;
super(x0, x1);
}
};
canvas.addPaintListener(new PaintListener() {
final ProgressWindow this$0;
public void paintControl(PaintEvent e)
{
e.gc.drawImage(spinImages[curSpinIndex], 0, 0);
}
{
this$0 = ProgressWindow.this;
super();
}
});
Utils.execSWTThreadLater(100, new AERunnable() {
final Canvas val$canvas;
final ProgressWindow this$0;
public void runSupport()
{
if (canvas == null || canvas.isDisposed())
return;
canvas.redraw();
canvas.update();
if (curSpinIndex == spinImages.length - 1)
curSpinIndex = 0;
else
curSpinIndex++;
Utils.execSWTThreadLater(100, this);
}
{
this$0 = ProgressWindow.this;
canvas = canvas1;
super();
}
});
}
Label label = new Label(shell, 0);
label.setText(MessageText.getString(resource));
GridData gridData = new GridData();
label.setLayoutData(gridData);
shell.pack();
Composite parent = shell.getParent();
if (parent != null)
Utils.centerWindowRelativeTo(shell, parent);
else
Utils.centreWindow(shell);
shell.open();
}
public void destroy()
{
synchronized (this)
{
task_complete = true;
}
try
{
if (shell != null && !shell.isDisposed())
shell.dispose();
}
catch (Throwable e)
{
Debug.printStackTrace(e);
}
if (spinImages != null)
{
ImageLoader.getInstance().releaseImage("working");
spinImages = null;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -