📄 categoryadderwindow.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: CategoryAdderWindow.java
package org.gudy.azureus2.ui.swt;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.category.Category;
import org.gudy.azureus2.core3.category.CategoryManager;
import org.gudy.azureus2.core3.internat.MessageText;
import org.gudy.azureus2.core3.util.Constants;
import org.gudy.azureus2.core3.util.Debug;
import org.gudy.azureus2.ui.swt.components.ControlUtils;
import org.gudy.azureus2.ui.swt.components.shell.ShellFactory;
// Referenced classes of package org.gudy.azureus2.ui.swt:
// Messages, Utils
public class CategoryAdderWindow
{
private Category newCategory;
public CategoryAdderWindow(Display display)
{
newCategory = null;
final Shell shell = ShellFactory.createShell(display, 0x10860);
shell.setText(MessageText.getString("CategoryAddWindow.title"));
Utils.setShellIcon(shell);
GridLayout layout = new GridLayout();
shell.setLayout(layout);
Label label = new Label(shell, 0);
Messages.setLanguageText(label, "CategoryAddWindow.message");
GridData gridData = new GridData();
gridData.widthHint = 200;
label.setLayoutData(gridData);
final Text category = new Text(shell, 2048);
gridData = new GridData();
gridData.widthHint = 300;
category.setLayoutData(gridData);
Composite panel = new Composite(shell, 0);
RowLayout rLayout = new RowLayout();
rLayout.marginTop = 0;
rLayout.marginLeft = 0;
rLayout.marginBottom = 0;
rLayout.marginRight = 0;
try
{
rLayout.fill = true;
}
catch (NoSuchFieldError e) { }
rLayout.spacing = ControlUtils.getButtonMargin();
panel.setLayout(rLayout);
gridData = new GridData();
gridData.horizontalAlignment = Constants.isOSX ? 0x1000008 : 0x1000000;
panel.setLayoutData(gridData);
Button ok;
Button cancel;
if (Constants.isOSX)
{
cancel = createAlertButton(panel, "Button.cancel");
ok = createAlertButton(panel, "Button.ok");
} else
{
ok = createAlertButton(panel, "Button.ok");
cancel = createAlertButton(panel, "Button.cancel");
}
ok.addListener(13, new Listener() {
final Text val$category;
final Shell val$shell;
final CategoryAdderWindow this$0;
public void handleEvent(Event event)
{
try
{
if (category.getText() != "")
newCategory = CategoryManager.createCategory(category.getText());
shell.dispose();
}
catch (Exception e)
{
Debug.printStackTrace(e);
}
}
{
this$0 = CategoryAdderWindow.this;
category = text;
shell = shell1;
super();
}
});
cancel.addListener(13, new Listener() {
final Shell val$shell;
final CategoryAdderWindow this$0;
public void handleEvent(Event event)
{
shell.dispose();
}
{
this$0 = CategoryAdderWindow.this;
shell = shell1;
super();
}
});
shell.setDefaultButton(ok);
shell.pack();
Utils.createURLDropTarget(shell, category);
Utils.centreWindow(shell);
shell.open();
do
{
if (shell.isDisposed())
break;
if (!display.readAndDispatch())
display.sleep();
} while (true);
}
private static Button createAlertButton(Composite panel, String localizationKey)
{
Button button = new Button(panel, 8);
button.setText(MessageText.getString(localizationKey));
RowData rData = new RowData();
rData.width = Math.max(ControlUtils.getDialogButtonMinWidth(), button.computeSize(-1, -1).x);
button.setLayoutData(rData);
return button;
}
public Category getNewCategory()
{
return newCategory;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -