| [news.eclipse.platform.swt] Re: Retrieve String from Open File Dialogue |
Define a field at the class level:
pubilc class Foo {
....
String test;
....
private void someMethod() {
Button button = new Button(...);
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
....
test = fd.open();
....
}
});
}
System.out.println("Here is my string: " + test);
....
}
Ali.
Hey,
I wan to retrieve a file location within an app, and save the locatoin as a string.
From a SWT Shell I have a button that calls FileDialog(s, SWT.OPEN)
The button has a SelectionListener so when it's pushed the the filedialog opens.
The only thing is I want to use the fd.open() part in the original SWT shell but it's wrapped in the listener so I can't access it? Get it out of the wrapper?
Thanks for your help,
Gaff