How to display form validation errors in settings panel

Answered

As in question, I need to add some validation to plugin settings form.

Is there any API to do such thing?

1
6 comments
Avatar
Permanently deleted user
Official comment

There is the apply method in your configurable that throws an exception:

https://sites.google.com/site/malenkov/java/150403

 

This method is called when you press OK or Apply.

If the exception is thrown its content is shown under the settings page:

--No such API, you need to manage error messages on your own--

Update: not correct, in fact API exists, see the answer provided by Sergey Malenkov 

-2

Thanks a lot Sergey. Can I invoke SwingWorker on Apply action? and display SwingWorker job result on other place as message (or in the settings window, but I think it not possible)

0
Avatar
Permanently deleted user

Nope, because without exception the Settings dialog will be closed.

1
Avatar
Permanently deleted user

I meant closed by OK. Apply does not close the dialog, but you cannot destinguish OK and Apply via API.

0

Hi @...

is this still valid ?
Or is it possible to directly have the validation to be triggered before pressing the apply button ?

I tried doing something like described here : https://jetbrains.design/intellij/principles/validation_errors/

but it seems that the validation tooltip never shows :/ 
Or do I need something special to make it work on the settings panel ?

In worse case I'll do like said in this topic. But I found it nicer to warn the user directly without waiting him to click on apply :) 

1

Please sign in to leave a comment.