In an Eclipse RCP editor, what is the best way to handle missing mandatory fields?

advertisements

On an Eclipse RCP application, I'm building an Editor in which some fields are mandatory.

If the user saves the editor with theses fields not filled, what is the best way/practice to handle this ?

(my first guess is to show an error dialog if theses fields are empty in doSave() method but I'm not sure it's the "eclipse" way to deal with this kind of problem)


I agree with VonC and would disable the "Save" button, as long as the user has filed all the important fields. Showig a warning which fields the user has to fill would help a lot.

EDIT:

Create a component which added himself as change listener. When someone changes the component, you can check whether the input is correct. Create a window whith all the self-checking components and add the window as listener to all the components.

When somebody change a compounent you can directly check if the input is valid and the user can step to the next page or save the page.

In RCP (Example FieldEditorPreferencePage) a lot of components have the doSave() and isValid() methods. In isValid() you can check all the components you can find in the window and in doSave(), you sould check the isValid() state, when it is not done automatically, and do some additional save actions.