isModified is not called after I've changed a text value.

I have following scenario.

I’ve wrote a plugin that have a project component. On configuration panel, among other fields it has a textbox and a button attached to it. When the button is pressed a custom dialog appears. Based on user actions on that custom dialog the value of the text box may change.

My problem is that the even after the text box is changed the <Apply> button is not enable. I’ve checked and the isModified() isn’t called. If I change focus to other component isModified methods gets called and Apply button becomes enabled.

So, my question is: how can I convince idea to check if the configuration was modified?

Actually I'm using a import com.intellij.ui.FieldPanel to implement the textbox + button thing.See the code snippet below:

I’m using idea IU-94.633

        packageIncludesField = new JTextField();
        
        ActionListener packageIncludesListener = new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {




                Map<String, Boolean> packagesData = new TreeMap<String, Boolean>();



                SelectPackagesForm dialog = new SelectPackagesForm(packagesData);
                dialog.pack();
                dialog.setLocationRelativeTo(findParentWindow(packageIncludesField));
                dialog.setVisible(true);
                if (dialog.isOK()) {
                    packageIncludesField.setText(dialog.getSelectedPackagesAsString());
                }

// various things to make intellj enable <Apply> button
                packageIncludesField.requestFocus();
                rootComponent.requestFocus();
//                boolean isModified = happyTrailsIdeaProjectComponent.isModified();
//                LOG.info(String.format("isModified = %s", isModified));
                cacherImplementation.setText(cacherImplementation.getText());
                dialog.dispose();
            }
        };
        final FieldPanel packageIncludesFieldPanel = new FieldPanel(packageIncludesField, null, null,
                packageIncludesListener, null);
        
        BoxLayout layout = new BoxLayout(packageIncludesPanel, BoxLayout.Y_AXIS);
        this.packageIncludesPanel.setLayout(layout);
        this.packageIncludesPanel.add(packageIncludesFieldPanel, BorderLayout.CENTER);


1 comment

Figured out myself. I sholdn't use Dialog but com.intellij.openapi.ui.DialogWrapper

0

Please sign in to leave a comment.