DialogWrapper validation

I think I have done all the right things, and my class extending DialogWrapper is working for the most part, execpt for the validation part. I override doValidate() which returns ValidationInfo when needed and null when everything is OK. I have put init() last in my constructor of my class which extends DialogWrapper. Validation works with the standard OK button, but I override createActions() which returns two of my own actions (Which extend DialogWrapper.DialogWrapperExitAction) and the cancelAction. And those two actions do not trigger any validation.

My action class is surprisingly simple, since the exitcode is checked after the dialog is closed. Here's what it looks like:

private class AddAction extends DialogWrapperExitAction {
        public AddAction() {
            super("Add", EXIT_ADD);
            putValue(DEFAULT_ACTION, Boolean.TRUE);
        }
    }


EXIT_ADD is NEXT_USER_EXIT_CODE + 2

Do I miss something here?

1
2 comments

Hmm, no answers yet. Perhaps my question was too vague :). Let me try this then: how do I let DialogWrapper trigger doValidate() when I return custom actions from createActions() ?

0

On doAction() method of the custom action, calling startTrackingValidation() or initValidation() worked for me to show the error.


Not sure, whether it is correct or not. Not able to find any related example or documentation.

0

Please sign in to leave a comment.