Dialog randomly in background

I'm quite new to building GUIs with Intellij.
I've created a JDialog form which asks the user for some selection using a JComboBox.
The model in the combo box is set after a network request.

Unfortunately very often (in the majority of cases) the dialog is only shown for a split second then it switches to the background and is hidden by the Intellij window.
Here's my code when I show the dialog:

final SelectComponentForm form = new SelectComponentForm();

ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
    public void
run() {
        // ... fetch necessary resources ...
}, "Fetch Components", false, null);

form.setModel(components); // just sets the model of the combobox

Can somebody try and help me understand why the dialog is hidden after a split second?
I tried wrapping it in a ApplicationManager.getApplication().invokeLater(); call but this doesn't help.
My network calls results are cached - it seems to work better when they are not, e.g. when the synchronous task finishes faster the problem occurs more often.

Thanks in advance,

Comment actions Permalink

You need to use the DialogWrapper class as a base class for dialogs in IntelliJ IDEA plugins. See https://confluence.jetbrains.com/display/IDEADEV/IntelliJ+IDEA+DialogWrapper for more information.

Comment actions Permalink

Hi Dmitry,
thanks for the quick and helpful reply. Can't this be documented a bit more clearly in the Plugin Development main page?
I think the whole documentation could use an overhaul.


Comment actions Permalink

Obviously we cannot include all the information on the main page. The document that I've sent you is linked from the main page, as well as all the other documentation that we have.


Please sign in to leave a comment.