How to capture event when click child nodes in Setting page

Hi Team,

Im writing a custom plugin and it displays under 'Tool' in Setting dialog. Like following;

Tools
   MyPlugin
      Child Node1
      Child Node2

What I need to do is capture clicking events(whenever child nodes click) and identify which node is clicked and do something accordingly. Current configuratioon in plugin.xml as follows;


<extensions defaultExtensionNs="com.intellij">
    <applicationConfigurable groupId="tools" displayName="MyPlugin" id="myplugin" instance="com.test.MyPluginConfigurable" nonDefaultProject="true">
      <configurable instance="com.test.ChildNod1eSetting" displayName="Child Node1" id="tools.childnode1"/>
      <configurable instance="com.test.ChildNode2Setting" displayName="Child Node2" id="tools.childnode2"/>
    </applicationConfigurable>
</extensions>

UI similer to https://devnet.jetbrains.com/thread/466277?tstart=0

Please share your thoughts regarding this matter.

Thanks,
Navin

7 comments
Comment actions Permalink

What is "do something"?

0
Comment actions Permalink

Hi Yann,

:) Actually it displays ChildNode panels accordigly.

0
Comment actions Permalink

I'm not sure what you want(ed) to achieve here. Or is the issue fixed?


0
Comment actions Permalink

As per the current configurations;

MyPlugin configured to 'MyPluginConfigurable' class which implements 'Configurable'. When user clicks 'MyPlugin' node it displays panel contains two links on right side of 'Setting' dialog(similer to ui in https://devnet.jetbrains.com/thread/466277?tstart=0).

Other two child nodes also configured to relavent classes which implements 'Configurable'.

Whenever user clicks either links or child nodes they landed to relevent Configurable setting pages. If user clicks ChildNode1 or link1, user will land to ChildNod1eSetting configurable page. In each page there is a validation (like user login). what happens here if user cancel the validation user can not get validation dialog again. For a instance if user clicks ChildNode1, then validation dialog appear and user cancel the validation dialog. Then again user clicks ChildNode1 validation dialog should appear but here it won't. user has to close and come again or user has to click other node and revisit ChildNode1.

So Im planning to capture events through 'MyPluginConfigurable'. currently it only captured links events. So i need to capture events when ever user clicks on child node under 'MyPlugin'.

+Tools
   -MyPlugin
      -Child Node1
      -Child Node2

I need to identify which node is clicked. Base on that relevent 'ChildNodeSetting' page display on right side of 'Setting' dialog. Is there anyway that I can separatly identify which node is clicked?

Thanks,
Navin

0
Comment actions Permalink

Hi Navin,

It is not a good idea to show a modal dialog from another modal dialog.
Especially in this case, because it is annoying when you move a selection by arrow keys and stop unexpectedly.

I recommend to create a main component with a login panel if a user is not logged yet.
After successfull logging you may replace this panel in your main component with another panel.

Anyway, if your configurable implements the NoScroll interface,
you may listen for the "visible" property change in your component.
But if your configurable does not implement the NoScroll interface,
you may listen for the "visible" property change in the parent of your component.
In the second case I recommend to add a listener in the addNotify method.

0
Comment actions Permalink

Hi Sergey,

Thanks for your thoughts. Is there way I can capture tree node selection? For a example if i select 'Terminal' node under 'Tools', is there any api method to capture which node is selected?


Thanks,
Navin

0
Comment actions Permalink

There is no public API for this.
You can add  OptionsEditorColleague  via  OptionsEditorContext#addColleague(),
but you cannot get a corresponding instance of  OptionsEditorContext.

0

Please sign in to leave a comment.