⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 updateprogresswindow.java

📁 java 文件下载器。可自定义
💻 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:   UpdateProgressWindow.java

package org.gudy.azureus2.ui.swt.update;

import java.util.ArrayList;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.internat.MessageText;
import org.gudy.azureus2.core3.util.AERunnable;
import org.gudy.azureus2.plugins.update.*;
import org.gudy.azureus2.ui.swt.Messages;
import org.gudy.azureus2.ui.swt.Utils;
import org.gudy.azureus2.ui.swt.components.shell.ShellFactory;

/**
 * @deprecated Class UpdateProgressWindow is deprecated
 */

public class UpdateProgressWindow
	implements UpdateManagerListener
{

	protected Display display;
	protected Shell window;
	protected StyledText text_area;
	protected UpdateManager manager;
	protected ArrayList current_instances;

	public UpdateProgressWindow()
	{
		current_instances = new ArrayList();
	}

	public static void show(UpdateCheckInstance instances[], Shell shell)
	{
		if (instances.length == 0)
		{
			return;
		} else
		{
			(new UpdateProgressWindow()).showSupport(instances, shell);
			return;
		}
	}

	protected void showSupport(UpdateCheckInstance instances[], Shell shell)
	{
		manager = instances[0].getManager();
		display = shell.getDisplay();
		window = ShellFactory.createShell(display, 0x10870);
		Messages.setLanguageText(window, "updater.progress.window.title");
		Utils.setShellIcon(shell);
		FormLayout layout = new FormLayout();
		try
		{
			layout.spacing = 5;
		}
		catch (NoSuchFieldError e) { }
		layout.marginHeight = 5;
		layout.marginWidth = 5;
		window.setLayout(layout);
		text_area = new StyledText(window, 2816);
		text_area.setEditable(false);
		Button btnOk = new Button(window, 8);
		Button btnAbort = new Button(window, 8);
		FormData formData = new FormData();
		formData.left = new FormAttachment(0, 0);
		formData.right = new FormAttachment(100, 0);
		formData.top = new FormAttachment(0, 0);
		formData.bottom = new FormAttachment(90, 0);
		text_area.setLayoutData(formData);
		Label info_label = new Label(window, 0);
		Messages.setLanguageText(info_label, "updater.progress.window.info");
		formData = new FormData();
		formData.top = new FormAttachment(text_area);
		formData.right = new FormAttachment(btnAbort);
		formData.left = new FormAttachment(0, 0);
		info_label.setLayoutData(formData);
		Messages.setLanguageText(btnAbort, "Button.abort");
		formData = new FormData();
		formData.right = new FormAttachment(btnOk);
		formData.bottom = new FormAttachment(100, 0);
		formData.width = 70;
		btnAbort.setLayoutData(formData);
		btnAbort.addListener(13, new Listener() {

			final UpdateProgressWindow this$0;

			public void handleEvent(Event e)
			{
				manager.removeListener(UpdateProgressWindow.this);
				for (int i = 0; i < current_instances.size(); i++)
					((UpdateCheckInstance)current_instances.get(i)).cancel();

				window.dispose();
			}

			
			{
				this$0 = UpdateProgressWindow.this;
				super();
			}
		});
		Messages.setLanguageText(btnOk, "Button.ok");
		formData = new FormData();
		formData.right = new FormAttachment(95, 0);
		formData.bottom = new FormAttachment(100, 0);
		formData.width = 70;
		btnOk.setLayoutData(formData);
		btnOk.addListener(13, new Listener() {

			final UpdateProgressWindow this$0;

			public void handleEvent(Event e)
			{
				manager.removeListener(UpdateProgressWindow.this);
				window.dispose();
			}

			
			{
				this$0 = UpdateProgressWindow.this;
				super();
			}
		});
		window.setDefaultButton(btnOk);
		window.addListener(31, new Listener() {

			final UpdateProgressWindow this$0;

			public void handleEvent(Event e)
			{
				if (e.character == '\033')
				{
					manager.removeListener(UpdateProgressWindow.this);
					window.dispose();
				}
			}

			
			{
				this$0 = UpdateProgressWindow.this;
				super();
			}
		});
		manager.addListener(this);
		window.setSize(620, 450);
		window.layout();
		Utils.centreWindow(window);
		window.open();
		for (int i = 0; i < instances.length; i++)
			addInstance(instances[i]);

	}

	protected void log(UpdateCheckInstance instance, String str)
	{
		String name = instance.getName();
		if (MessageText.keyExists(name))
			name = MessageText.getString(name);
		log((new StringBuilder()).append(name).append(" - ").append(str).toString());
	}

	protected void log(UpdateChecker checker, String str)
	{
		log((new StringBuilder()).append("    ").append(checker.getComponent().getName()).append(" - ").append(str).toString());
	}

	protected void log(final String str)
	{
		try
		{
			if (!display.isDisposed())
				display.asyncExec(new AERunnable() {

					final String val$str;
					final UpdateProgressWindow this$0;

					public void runSupport()
					{
						if (!text_area.isDisposed())
							text_area.append((new StringBuilder()).append(str).append("\n").toString());
					}

			
			{
				this$0 = UpdateProgressWindow.this;
				str = s;
				super();
			}
				});
		}
		catch (Throwable e) { }
	}

	public void checkInstanceCreated(UpdateCheckInstance instance)
	{
		addInstance(instance);
	}

	protected void addInstance(final UpdateCheckInstance instance)
	{
		if (!display.isDisposed())
			display.asyncExec(new AERunnable() {

				final UpdateCheckInstance val$instance;
				final UpdateProgressWindow this$0;

				public void runSupport()
				{
					if (display.isDisposed() || window.isDisposed())
						return;
					if (!current_instances.contains(instance))
					{
						current_instances.add(instance);
						log(instance, "added");
						instance.addListener(new UpdateCheckInstanceListener() {

							final 5 this$1;

							public void cancelled(UpdateCheckInstance instance)
							{
								log(instance, "cancelled");
							}

							public void complete(UpdateCheckInstance instance)
							{
								log(instance, "complete");
							}

					
					{
						this$1 = 5.this;
						super();
					}
						});
						UpdateChecker checkers[] = instance.getCheckers();
						for (int i = 0; i < checkers.length; i++)
						{
							final UpdateChecker checker = checkers[i];
							log(checker, "added");
							checker.addListener(new UpdateCheckerListener() {

								final 5 this$1;

								public void completed(UpdateChecker checker)
								{
									log(checker, "completed");
								}

								public void failed(UpdateChecker checker)
								{
									log(checker, "failed");
								}

								public void cancelled(UpdateChecker checker)
								{
									log(checker, "cancelled");
								}

					
					{
						this$1 = 5.this;
						super();
					}
							});
							checker.addProgressListener(new UpdateProgressListener() {

								final UpdateChecker val$checker;
								final 5 this$1;

								public void reportProgress(String str)
								{
									log(checker, (new StringBuilder()).append("    ").append(str).toString());
								}

					
					{
						this$1 = 5.this;
						checker = updatechecker;
						super();
					}
							});
						}

					}
				}

			
			{
				this$0 = UpdateProgressWindow.this;
				instance = updatecheckinstance;
				super();
			}
			});
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -