How to use TextFieldWithHistory in SettingsEditor

My plugin is adding 'run configuration' by extending the default one.

public class WFApplicationConfigurable extends SettingsEditorGroup {


public WFApplicationConfigurable(Project project) {

addEditor("Configuration", new ApplicationConfigurable2(project));
addEditor("WF", new WFSpecificConfigurable(project));
addEditor("Code Coverage", new WFCoverageConfigurable(project));
addEditor("Logs", new LogConfigurationPanel());
}

}
WFSpecificConfigurable is the tab i added
In this tab i'm using TextFieldWithHistorycomponent to i can save history of user choice
My problem is that i can't find the point in which i need to call the method addCurrentTextToHistory.
I dig in intellij code and i found that the right place to do it is when 'OK' button is pressed.
But i'm only one tab in the configuration dialog, and can't find the way to listen to the event telling me that the 'OK' button was pressed.

Please help.
Regards Boaz

8 comments

Hello Boaz,

BN> My plugin is adding 'run configuration' by extending the default
BN> one.
BN>
BN> public class WFApplicationConfigurable extends SettingsEditorGroup {
BN>
BN> public WFApplicationConfigurable(Project project) {
BN>
BN> addEditor("Configuration", new
BN> ApplicationConfigurable2(project));
BN> addEditor("WF", new WFSpecificConfigurable(project));
BN> addEditor("Code Coverage", new
BN> WFCoverageConfigurable(project));
BN> addEditor("Logs", new LogConfigurationPanel());
BN> }
BN> }
BN>
BN> WFSpecificConfigurable is the tab i added
BN>
BN> In this tab i'm using TextFieldWithHistorycomponent to i can
BN> save history of user choice
BN>
BN> My problem is that i can't find the point in which i need to call
BN> the method addCurrentTextToHistory.
BN>
BN> I dig in intellij code and i found that the right place to do it is
BN> when 'OK' button is pressed.
BN>
BN> But i'm only one tab in the configuration dialog, and can't find the
BN> way to listen to the event telling me that the 'OK' button was
BN> pressed.

But of course you do know when 'OK' is pressed - that's when Configurable.apply()
is called.

--
Dmitry Jemerov
Software Developer
http://www.jetbrains.com/
"Develop with Pleasure!"


0

You can look sample code in Plugin Packer plugin.

0

Thanks for the quick answer, but:

my configuration editor is implementing 'SettingsEditor' and not 'Configurable'

@Override
public SettingsEditor getConfigurationEditor() {

return new WFApplicationConfigurable(getProject());
}

Do i miss something ?
Regards, Boaz

0

Thanks, i Will try.
Regards, Boaz

0

Hello Boaz,

BN> Thanks for the quick answer, but:
BN>
BN> my configuration editor is implementing 'SettingsEditor' and
BN> not 'Configurable'
BN>
BN> @Override
BN> public SettingsEditor getConfigurationEditor() {
BN> return new WFApplicationConfigurable(getProject());
BN> }

Sorry, I didn't look at the code really well. I believe you can use SettingsEditor.applyTo()
as the place to save the history.

--
Dmitry Jemerov
Software Developer
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Tnanks.
You doing it in PluginPackerDialog.doOKAction().

No such luck to me.

Any way, ???????????

0

Sorry i'm being nagger.

apparently, 'applyTo()' is looked good place (and this is the place i started from), but this method is invoked on any stroke in editor (i guess record changes in the configuration).

Is there any change that something is missing from the framework ? can i asked you to look on this more deeply.

Many thanks
Boaz

0

Please sign in to leave a comment.