Reputation: 2635
I am using an org.eclipse.ui.forms.FormDialog-derived class to query users of my RCP-Application for input. This is a modal dialog which is closed after the user clicked the OK-Button. I have created member-variables for the Text-widgets and trying to get the user's input with getText() after the user has clicked the OK-Button (and therefore has closed the dialog).
Unfortunately the widgets are disposed when the dialog closes (so, with clicking the OK-Button), and there is no way to call getText() on the Text-Widgets anymore.
I was wondering how others solve this use-case?
Upvotes: 0
Views: 652
Reputation: 12718
Simply extend Dialog.okPressed()
in your code to retrieve the current values before the dialogis closed...
Upvotes: 2
Reputation: 9535
Use a datamodel, e.g. simple Pojos to store user-inputs. This model is bound via the Eclipse Databinding to your Ui, e.g. to a Textfield and is synchronized every time the user modifies the value of the textfield. Take a look at the tutorial how to integrate databinding in your application, see http://www.vogella.de/articles/EclipseDataBinding/article.html
Upvotes: 1