IntelliJ plugin for a custom run configuration, problem with settings editor

Answered

Hi, 

I am trying to implement a custom Run Configuration as IntelliJ plugin.

The basic idea is to have a customized Java Application run configuration with additional options. These options are a list of custom objects, which have a boolean, a key and a value.

For this I added a JBTable to a custom SettingsEditorFragment and this list is persisted in my own subclass of JvmMainMethodRunConfigurationOptions. Basically everything works out fine, I can edit my options, can use them and options are persisted.

My only problem is that change detection does not work correctly.

Adding / Removing a line in my JBTable correctly triggers the “Apply” button becoming active.

But changing the content of single line in my JBTable does not (though these changes are persisted correctly). So I guess I am missing some trigger when the content of such a line changes. 

Can you give me a hint for this?

PS: the current code for my plugin is available here: https://github.com/markusstoll/IntelliJWOPlugin

Regards, Markus

0
3 comments

Hi,

The Apply button is refreshed every 500 ms by applying the changes in the component to a temporary settings object, and comparing it to the snapshot created at the moment of opening the editor.

It seems that comparing the snapshot and temporary object doesn't detect any changes. I suggest setting a breakpoint at:

myConfig.getOptions().setWoOptions(component.getComponent().getKeyValueOptions());

and debugging why.

0

Hi Karol and thank your for taking a look into my problem.

I did debug this and I can confirm that woOptionsProperty in my WORunConfigurationOptions is updated immediately after clicking a change and its holding the correct updated value.

Can you name the breakpoint where the change detection is comparing the two snapshots, so I can look into details there?

 

Regards

Markus

0

Hi Karol, 

your explanation how things work was enough to fix the problem. Your change detection works based on an object snapshot, so changing a value in a custom object is changing the snapshot as well. To solve this I have to clone my item on changing and by doing that, things work fine

Thanks!

Markus

 

1

Please sign in to leave a comment.