Setting dialog open twice

Hi Team,
   For my plugin development, I configured my plugin to display like in following image (under Tools catergory Test)

Settings_Test.png

----- plugin.xml -----
<extensions defaultExtensionNs="com.intellij">
    <applicationConfigurable groupId="tools" displayName="Test" id="test" instance="com.intellij.plugin.ui.settings.TestConfigurable" nonDefaultProject="true">
      <configurable instance="com.intellij.plugin.ui.settings.Test1" displayName="Test1" id="tools.test1"/>
      <configurable instance="com.intellij.plugin.ui.settings.Test2" displayName="Test2" id="tools.test2"/>
    </applicationConfigurable>

  </extensions>


When click on a hyperlink (where mouse pointer in above image Test1 or Test2), it will open new Setting dialog and display content of Test1 rather than displaying in same Setting dialog. Refer following image;

setting_test2.png
code used for Test1 click event;
ShowSettingsUtil.getInstance().showSettingsDialog(null, "Test1"); //also tried with pasing a project object

It display right content for the selection, but in seperate new window :(

Please help

Thanks,
Navin

3 comments
Comment actions Permalink

You can try the following code:

 
import com.intellij.openapi.options.ex.Settings; // this is a class to communicate with the Setting dialog

DataContext context = DataManager.getInstance().getDataContextFromFocus().getResult(); // or another way to receive data context
if (context != null) {
  Settings settings = Settings.KEY.getData(context);
  if (settings != null) {
    settings.select(settings.find(...));
  }
}


There are two methods to find a configurable:

settings.find(String id) - uses SearchableConfigurable#getId of fully-qualified class name
settings.find(Class<?> type) - checks that a configurable instance is assignable to the specified class or interface
2
Comment actions Permalink

I forgot to say that you can use ShowSettingsUtil.getInstance().showSettingsDialog if settings is null.
It may be useful for links from other places.

0
Comment actions Permalink

Thank you. Given code solve my issue. thank you again.

Thanks,
Navin

0

Please sign in to leave a comment.