📄 stringlistchooser.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: StringListChooser.java
package org.gudy.azureus2.ui.swt.components;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.internat.MessageText;
import org.gudy.azureus2.core3.util.AERunnable;
import org.gudy.azureus2.core3.util.Debug;
import org.gudy.azureus2.ui.swt.Utils;
import org.gudy.azureus2.ui.swt.components.shell.ShellFactory;
public class StringListChooser
{
private Display display;
private Shell shell;
private Label label;
private Combo combo;
private String result;
public StringListChooser(final Shell parentShell)
{
result = null;
display = parentShell.getDisplay();
if (display == null || display.isDisposed())
{
return;
} else
{
display.syncExec(new Runnable() {
final Shell val$parentShell;
final StringListChooser this$0;
public void run()
{
createShell(parentShell);
}
{
this$0 = StringListChooser.this;
parentShell = shell1;
Object();
}
});
return;
}
}
private void createShell(Shell parentShell)
{
shell = ShellFactory.createShell(display, 0x10860);
Utils.setShellIcon(shell);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
shell.setLayout(layout);
label = new Label(shell, 64);
combo = new Combo(shell, 8);
Button ok = new Button(shell, 8);
ok.addListener(13, new Listener() {
final StringListChooser this$0;
public void handleEvent(Event arg0)
{
result = combo.getText();
shell.dispose();
}
{
this$0 = StringListChooser.this;
Object();
}
});
ok.setText(MessageText.getString("Button.ok"));
Button cancel = new Button(shell, 8);
cancel.addListener(13, new Listener() {
final StringListChooser this$0;
public void handleEvent(Event arg0)
{
result = null;
shell.dispose();
}
{
this$0 = StringListChooser.this;
Object();
}
});
cancel.setText(MessageText.getString("Button.cancel"));
shell.addListener(12, new Listener() {
final StringListChooser this$0;
public void handleEvent(Event event)
{
}
{
this$0 = StringListChooser.this;
Object();
}
});
GridData data = new GridData(768);
data.horizontalSpan = 2;
data.heightHint = 30;
label.setLayoutData(data);
data = new GridData(768);
data.horizontalSpan = 2;
combo.setLayoutData(data);
data = new GridData();
data.widthHint = 80;
data.grabExcessHorizontalSpace = true;
data.grabExcessVerticalSpace = true;
data.verticalAlignment = 0x1000008;
data.horizontalAlignment = 0x1000008;
ok.setLayoutData(data);
data = new GridData();
data.grabExcessVerticalSpace = true;
data.verticalAlignment = 0x1000008;
data.widthHint = 80;
cancel.setLayoutData(data);
shell.setSize(300, 150);
shell.layout();
Utils.centerWindowRelativeTo(shell, parentShell);
}
public void setTitle(final String title)
{
Utils.execSWTThread(new AERunnable() {
final String val$title;
final StringListChooser this$0;
public void runSupport()
{
if (display == null || display.isDisposed())
{
return;
} else
{
shell.setText(title);
return;
}
}
{
this$0 = StringListChooser.this;
title = s;
AERunnable();
}
});
}
public void setText(final String text)
{
Utils.execSWTThread(new AERunnable() {
final String val$text;
final StringListChooser this$0;
public void runSupport()
{
if (display == null || display.isDisposed())
{
return;
} else
{
label.setText(text.replaceAll("&", "&&"));
return;
}
}
{
this$0 = StringListChooser.this;
text = s;
AERunnable();
}
});
}
public void addOption(final String option)
{
Utils.execSWTThread(new AERunnable() {
final String val$option;
final StringListChooser this$0;
public void runSupport()
{
if (display == null || display.isDisposed())
return;
combo.add(option);
if (combo.getItemCount() == 1)
combo.setText(option);
}
{
this$0 = StringListChooser.this;
option = s;
AERunnable();
}
});
}
public String open()
{
if (display == null || display.isDisposed())
{
return null;
} else
{
Utils.execSWTThread(new AERunnable() {
final StringListChooser this$0;
public void runSupport()
{
if (display == null || display.isDisposed())
return;
try
{
shell.open();
do
{
if (shell.isDisposed())
break;
if (!display.readAndDispatch())
display.sleep();
} while (true);
}
catch (Throwable e)
{
Debug.printStackTrace(e);
}
}
{
this$0 = StringListChooser.this;
AERunnable();
}
});
return result;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -