📄 openurlwindow.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: OpenUrlWindow.java
package org.gudy.azureus2.ui.swt;
import com.aelitis.azureus.core.AzureusCore;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.config.*;
import org.gudy.azureus2.core3.internat.MessageText;
import org.gudy.azureus2.core3.torrentdownloader.TorrentDownloaderCallBackInterface;
import org.gudy.azureus2.core3.util.UrlUtils;
import org.gudy.azureus2.ui.swt.components.shell.ShellFactory;
// Referenced classes of package org.gudy.azureus2.ui.swt:
// Utils, FileDownloadWindow
public class OpenUrlWindow
{
protected static String CONFIG_REFERRER_DEFAULT;
protected static String last_referrer = null;
public OpenUrlWindow(AzureusCore azureus_core, Shell parent, String linkURL, String referrer)
{
this(azureus_core, parent, linkURL, referrer, null);
}
public OpenUrlWindow(final AzureusCore azureus_core, final Shell parent, String linkURL, String referrer, final TorrentDownloaderCallBackInterface listener)
{
final Shell shell = ShellFactory.createShell(parent, 0x10870);
shell.setText(MessageText.getString("openUrl.title"));
Utils.setShellIcon(shell);
GridLayout layout = new GridLayout();
layout.numColumns = 3;
shell.setLayout(layout);
Label label = new Label(shell, 0);
label.setText(MessageText.getString("openUrl.url"));
GridData gridData = new GridData();
label.setLayoutData(gridData);
final Text url = new Text(shell, 2048);
gridData = new GridData(768);
gridData.widthHint = 400;
gridData.horizontalSpan = 2;
url.setLayoutData(gridData);
if (linkURL == null)
Utils.setTextLinkFromClipboard(shell, url, true);
else
url.setText(linkURL);
url.setSelection(url.getText().length());
Label help_label = new Label(shell, 0);
help_label.setText(MessageText.getString("openUrl.url.info"));
gridData = new GridData();
gridData.horizontalSpan = 3;
help_label.setLayoutData(gridData);
Label space = new Label(shell, 0);
gridData = new GridData();
gridData.horizontalSpan = 3;
space.setLayoutData(gridData);
Label referrer_label = new Label(shell, 0);
referrer_label.setText(MessageText.getString("openUrl.referrer"));
gridData = new GridData();
referrer_label.setLayoutData(gridData);
final Combo referrer_combo = new Combo(shell, 2048);
gridData = new GridData(768);
gridData.widthHint = 150;
gridData.grabExcessHorizontalSpace = true;
referrer_combo.setLayoutData(gridData);
final StringList referrers = COConfigurationManager.getStringListParameter("url_open_referrers");
for (StringIterator iter = referrers.iterator(); iter.hasNext(); referrer_combo.add(iter.next()));
if (referrer != null && referrer.length() > 0)
referrer_combo.setText(referrer);
else
if (last_referrer != null)
referrer_combo.setText(last_referrer);
Label referrer_info = new Label(shell, 0);
referrer_info.setText(MessageText.getString("openUrl.referrer.info"));
Label labelSeparator = new Label(shell, 258);
gridData = new GridData(776);
gridData.horizontalSpan = 3;
labelSeparator.setLayoutData(gridData);
Composite panel = new Composite(shell, 0);
layout = new GridLayout();
layout.numColumns = 3;
panel.setLayout(layout);
gridData = new GridData(904);
gridData.horizontalSpan = 3;
gridData.grabExcessHorizontalSpace = true;
panel.setLayoutData(gridData);
new Label(panel, 0);
Button ok = new Button(panel, 8);
gridData = new GridData(904);
gridData.widthHint = 70;
gridData.grabExcessHorizontalSpace = true;
ok.setLayoutData(gridData);
ok.setText(MessageText.getString("Button.ok"));
ok.addListener(13, new Listener() {
final Combo val$referrer_combo;
final StringList val$referrers;
final Text val$url;
final AzureusCore val$azureus_core;
final Shell val$parent;
final TorrentDownloaderCallBackInterface val$listener;
final Shell val$shell;
final OpenUrlWindow this$0;
public void handleEvent(Event e)
{
OpenUrlWindow.last_referrer = referrer_combo.getText().trim();
if (!referrers.contains(OpenUrlWindow.last_referrer))
{
referrers.add(OpenUrlWindow.last_referrer);
COConfigurationManager.setParameter("url_open_referrers", referrers);
COConfigurationManager.save();
}
COConfigurationManager.setParameter(OpenUrlWindow.CONFIG_REFERRER_DEFAULT, OpenUrlWindow.last_referrer);
COConfigurationManager.save();
String url_str = url.getText();
url_str = UrlUtils.parseHTMLforURL(url_str);
if (url_str == null)
url_str = url.getText();
new FileDownloadWindow(azureus_core, parent, url_str, OpenUrlWindow.last_referrer, null, listener);
shell.dispose();
}
{
this$0 = OpenUrlWindow.this;
referrer_combo = combo;
referrers = stringlist;
url = text;
azureus_core = azureuscore;
parent = shell1;
listener = torrentdownloadercallbackinterface;
shell = shell2;
super();
}
});
shell.setDefaultButton(ok);
Button cancel = new Button(panel, 8);
gridData = new GridData(128);
gridData.grabExcessHorizontalSpace = false;
gridData.widthHint = 70;
cancel.setLayoutData(gridData);
cancel.setText(MessageText.getString("Button.cancel"));
cancel.addListener(13, new Listener() {
final Shell val$shell;
final OpenUrlWindow this$0;
public void handleEvent(Event e)
{
shell.dispose();
}
{
this$0 = OpenUrlWindow.this;
shell = shell1;
super();
}
});
shell.addListener(31, new Listener() {
final Shell val$shell;
final OpenUrlWindow this$0;
public void handleEvent(Event e)
{
if (e.character == '\033')
shell.dispose();
}
{
this$0 = OpenUrlWindow.this;
shell = shell1;
super();
}
});
Point p = shell.computeSize(-1, -1);
if (p.x > 800)
p.x = 800;
shell.setSize(p);
Utils.createURLDropTarget(shell, url);
Utils.centreWindow(shell);
shell.open();
}
static
{
CONFIG_REFERRER_DEFAULT = "openUrl.referrer.default";
last_referrer = COConfigurationManager.getStringParameter(CONFIG_REFERRER_DEFAULT, "");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -