📄 simpleinstallui.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: SimpleInstallUI.java
package org.gudy.azureus2.ui.swt.update;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.util.AEThread2;
import org.gudy.azureus2.core3.util.Debug;
import org.gudy.azureus2.plugins.update.Update;
import org.gudy.azureus2.plugins.update.UpdateCheckInstance;
import org.gudy.azureus2.plugins.utils.resourcedownloader.ResourceDownloader;
import org.gudy.azureus2.plugins.utils.resourcedownloader.ResourceDownloaderAdapter;
import org.gudy.azureus2.ui.swt.Utils;
// Referenced classes of package org.gudy.azureus2.ui.swt.update:
// UpdateMonitor
public class SimpleInstallUI
{
private UpdateMonitor monitor;
private UpdateCheckInstance instance;
private boolean cancelled;
private ResourceDownloader current_downloader;
protected SimpleInstallUI(UpdateMonitor _monitor, UpdateCheckInstance _instance)
{
monitor = _monitor;
instance = _instance;
try
{
monitor.addDecisionHandler(_instance);
Utils.execSWTThread(new Runnable() {
final SimpleInstallUI this$0;
public void run()
{
try
{
build();
}
catch (Throwable e)
{
Debug.out(e);
instance.cancel();
}
}
{
this$0 = SimpleInstallUI.this;
super();
}
});
}
catch (Throwable e)
{
Debug.out(e);
instance.cancel();
}
}
protected void build()
{
Composite parent = (Composite)instance.getProperty(2);
if (parent != null)
build(parent);
else
throw new RuntimeException("borkeroo");
}
protected void build(Composite parent)
{
parent.setLayout(new FormLayout());
Button cancel_button = new Button(parent, 0);
cancel_button.setText("Cancel");
cancel_button.addListener(13, new Listener() {
final SimpleInstallUI this$0;
public void handleEvent(Event arg0)
{
synchronized (SimpleInstallUI.this)
{
cancelled = true;
if (current_downloader != null)
current_downloader.cancel();
}
instance.cancel();
}
{
this$0 = SimpleInstallUI.this;
super();
}
});
FormData data = new FormData();
data.right = new FormAttachment(100, 0);
data.top = new FormAttachment(0, 0);
data.bottom = new FormAttachment(100, 0);
cancel_button.setLayoutData(data);
Label label = new Label(parent, 0);
label.setText("blah blah ");
data = new FormData();
data.left = new FormAttachment(0, 0);
data.top = new FormAttachment(cancel_button, 0, 0x1000000);
label.setLayoutData(data);
ProgressBar progress = new ProgressBar(parent, 0);
progress.setMinimum(0);
progress.setMaximum(100);
progress.setSelection(0);
data = new FormData();
data.left = new FormAttachment(label, 4);
data.top = new FormAttachment(cancel_button, 0, 0x1000000);
data.right = new FormAttachment(cancel_button, -4);
progress.setLayoutData(data);
parent.layout(true, true);
(new AEThread2(label, progress) {
final Label val$label;
final ProgressBar val$progress;
final SimpleInstallUI this$0;
public void run()
{
Update updates[];
Update arr$[];
int len$;
int i$;
updates = instance.getUpdates();
arr$ = updates;
len$ = arr$.length;
i$ = 0;
_L5:
ResourceDownloader arr$[];
int len$;
int i$;
if (i$ >= len$)
break MISSING_BLOCK_LABEL_194;
Update update = arr$[i$];
String name = update.getName();
int pos = name.indexOf('/');
if (pos >= 0)
name = name.substring(pos + 1);
setLabel(name);
ResourceDownloader downloaders[] = update.getDownloaders();
arr$ = downloaders;
len$ = arr$.length;
i$ = 0;
_L3:
ResourceDownloader downloader;
label0:
{
if (i$ >= len$)
break MISSING_BLOCK_LABEL_188;
downloader = arr$[i$];
synchronized (SimpleInstallUI.this)
{
if (!cancelled)
break label0;
}
return;
}
current_downloader = downloader;
simpleinstallui;
JVM INSTR monitorexit ;
goto _L1
exception;
throw exception;
_L1:
setProgress(0);
downloader.addListener(new ResourceDownloaderAdapter() {
final 3 this$1;
public void reportPercentComplete(ResourceDownloader downloader, int percentage)
{
setProgress(percentage);
}
public void reportAmountComplete(ResourceDownloader resourcedownloader, long l)
{
}
{
this$1 = 3.this;
super();
}
});
downloader.download();
i$++;
if (true) goto _L3; else goto _L2
_L2:
i$++;
if (true) goto _L5; else goto _L4
_L4:
boolean restart_required = false;
for (int i = 0; i < updates.length; i++)
if (updates[i].getRestartRequired() == 2)
restart_required = true;
if (restart_required)
monitor.handleRestart();
break MISSING_BLOCK_LABEL_260;
Throwable e;
e;
Debug.out("Install failed", e);
instance.cancel();
}
protected void setLabel(final String str)
{
Utils.execSWTThread(new Runnable() {
final String val$str;
final 3 this$1;
public void run()
{
if (label != null && !label.isDisposed())
{
label.setText(str);
label.getParent().layout();
}
}
{
this$1 = 3.this;
str = s;
super();
}
});
}
protected void setProgress(final int percent)
{
Utils.execSWTThread(new Runnable() {
final int val$percent;
final 3 this$1;
public void run()
{
if (progress != null && !progress.isDisposed())
progress.setSelection(percent);
}
{
this$1 = 3.this;
percent = i;
super();
}
});
}
{
this$0 = SimpleInstallUI.this;
label = label1;
progress = progressbar;
super(x0, x1);
}
}).start();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -