📄 uiexitutilsswt.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: UIExitUtilsSWT.java
package org.gudy.azureus2.ui.swt;
import com.aelitis.azureus.core.util.CopyOnWriteList;
import com.aelitis.azureus.ui.swt.UIFunctionsManagerSWT;
import com.aelitis.azureus.ui.swt.UIFunctionsSWT;
import java.util.*;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.gudy.azureus2.core3.config.COConfigurationManager;
import org.gudy.azureus2.core3.download.*;
import org.gudy.azureus2.core3.global.GlobalManager;
import org.gudy.azureus2.core3.internat.MessageText;
import org.gudy.azureus2.core3.security.SESecurityManager;
import org.gudy.azureus2.core3.tracker.client.TRTrackerScraperResponse;
import org.gudy.azureus2.core3.util.*;
import org.gudy.azureus2.ui.swt.shells.MessageBoxShell;
// Referenced classes of package org.gudy.azureus2.ui.swt:
// PasswordWindow, Utils
public class UIExitUtilsSWT
{
public static interface canCloseListener
{
public abstract boolean canClose();
}
private static boolean skipCloseCheck = false;
private static CopyOnWriteList listeners = new CopyOnWriteList();
public UIExitUtilsSWT()
{
}
public static void addListener(canCloseListener l)
{
listeners.add(l);
}
public static void setSkipCloseCheck(boolean b)
{
skipCloseCheck = b;
}
public static boolean canClose(GlobalManager globalManager, boolean bForRestart)
{
if (skipCloseCheck)
return true;
Shell mainShell = UIFunctionsManagerSWT.getUIFunctionsSWT().getMainShell();
if (mainShell != null && (!mainShell.isVisible() || mainShell.getMinimized()) && COConfigurationManager.getBooleanParameter("Password enabled") && !PasswordWindow.showPasswordWindow(Display.getCurrent()))
return false;
if (COConfigurationManager.getBooleanParameter("confirmationOnExit") && !getExitConfirmation(bForRestart))
return false;
for (Iterator i$ = listeners.iterator(); i$.hasNext();)
{
canCloseListener listener = (canCloseListener)i$.next();
if (!listener.canClose())
return false;
}
if (globalManager != null)
{
ArrayList listUnfinished = new ArrayList();
Object dms[] = globalManager.getDownloadManagers().toArray();
for (int i = 0; i < dms.length; i++)
{
DownloadManager dm = (DownloadManager)dms[i];
if (dm.getState() != 60 || !dm.getDownloadState().isOurContent() || dm.getStats().getAvailability() >= 2.0F)
continue;
TRTrackerScraperResponse scrape = dm.getTrackerScrapeResponse();
int numSeeds = scrape.getSeeds();
long seedingStartedOn = dm.getStats().getTimeStartedSeeding();
if (numSeeds > 0 && seedingStartedOn > 0L && scrape.getScrapeStartTime() > seedingStartedOn)
numSeeds--;
if (numSeeds == 0)
listUnfinished.add(dm);
}
if (listUnfinished.size() > 0)
{
List flistUnfinished = listUnfinished;
boolean allowQuit;
if (listUnfinished.size() == 1)
allowQuit = Utils.execSWTThreadWithBool("quitSeeding", new AERunnableBoolean(flistUnfinished) {
final List val$flistUnfinished;
public boolean runSupport()
{
String title = MessageText.getString("Content.alert.notuploaded.title");
String text = MessageText.getString("Content.alert.notuploaded.text", new String[] {
((DownloadManager)flistUnfinished.get(0)).getDisplayName(), MessageText.getString("Content.alert.notuploaded.quit")
});
MessageBoxShell mb = new MessageBoxShell(Utils.findAnyShell(), title, text, new String[] {
MessageText.getString("UpdateWindow.quit"), MessageText.getString("Content.alert.notuploaded.button.abort")
}, 1, null, null, false, 0);
mb.setRelatedObject((DownloadManager)flistUnfinished.get(0));
return mb.open() == 0;
}
{
flistUnfinished = list;
super();
}
}, 0L);
else
allowQuit = Utils.execSWTThreadWithBool("quitSeeding", new AERunnableBoolean(flistUnfinished) {
final List val$flistUnfinished;
public boolean runSupport()
{
String sList = "";
for (int i = 0; i < flistUnfinished.size() && i < 5; i++)
{
DownloadManager dm = (DownloadManager)flistUnfinished.get(i);
if (sList != "")
sList = (new StringBuilder()).append(sList).append("\n").toString();
sList = (new StringBuilder()).append(sList).append(dm.getDisplayName()).toString();
}
String title = MessageText.getString("Content.alert.notuploaded.multi.title");
String text = MessageText.getString("Content.alert.notuploaded.multi.text", new String[] {
(new StringBuilder()).append("").append(flistUnfinished.size()).toString(), MessageText.getString("Content.alert.notuploaded.quit"), sList
});
MessageBoxShell mb = new MessageBoxShell(Utils.findAnyShell(), title, text, new String[] {
MessageText.getString("UpdateWindow.quit"), MessageText.getString("Content.alert.notuploaded.button.abort")
}, 1, null, null, false, 0);
return mb.open() == 0;
}
{
flistUnfinished = list;
super();
}
}, 0L);
return allowQuit;
}
}
return true;
}
private static boolean getExitConfirmation(boolean for_restart)
{
int result = Utils.openMessageBox(Utils.findAnyShell(), 200, for_restart ? "MainWindow.dialog.restartconfirmation" : "MainWindow.dialog.exitconfirmation", (String[])null);
return result == 64;
}
public static void uiShutdown()
{
if (SystemProperties.isJavaWebStartInstance())
{
Thread close = new AEThread("JWS Force Terminate") {
public void runSupport()
{
try
{
Thread.sleep(2500L);
}
catch (Throwable e)
{
Debug.printStackTrace(e);
}
SESecurityManager.exitVM(1);
}
};
close.setDaemon(true);
close.start();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -