【发布时间】:2012-12-02 13:30:26
【问题描述】:
这是我将新人添加到静态列表的 Dialog 类
public class DialogInput extends Dialog{
public static List<Person> person = new LinkedList<Person>();
Text txtName;
@Override
protected Control createPartControl(Composite parent){
...
txtName = new Text(parent, SWT.NONE);
}
@Override
protected void okPressed(){
Person p = new Person();
p.setName(txtName.getText());
person.add(p);
}
}
// 另一个文件中的另一个类。
public class MyView extends ViewPart{
public void createPartControl(Composite parent){
// HOW TO GET LIST ?
}
}
【问题讨论】:
-
只需使用
DialogInput.person。你试过了吗?