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);


Do I miss something here?


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() ?


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.


Please sign in to leave a comment.