Reputation: 933
This is the Dialog class where I add new person to a static List
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);
}
}
// ANOTHER CLASS in a different file.
public class MyView extends ViewPart{
public void createPartControl(Composite parent){
// HOW TO GET LIST ?
}
}
Upvotes: 0
Views: 385
Reputation: 33534
Try this:
public class MyView extends ViewPart{
public void createPartControl(Composite parent){
List<String> pList = DialogInput.person;
}
}
Upvotes: 0
Reputation: 41955
public class MyView extends ViewPart{
public void createPartControl(Composite parent){
// HOW TO GET LIST ?
List<Person> personList = DialogInput.person;
}
}
Upvotes: 1