'null' when trying to set run configuration by own plugin in idea
Answered
I am trying to set my own configuration plugin in idea.
As example I use this guide https://www.jetbrains.org/intellij/sdk/docs/tutorials/run_configurations.html
After trying to run this plugin I see this err: "@NotNull method test/DemoSettingsEditor.createEditor must not return null"
Stack:
@NotNull method test/DemoSettingsEditor.createEditor must not return null
java.lang.IllegalStateException: @NotNull method test/DemoSettingsEditor.createEditor must not return null
at test.DemoSettingsEditor.$$$reportNull$$$0(DemoSettingsEditor.java)
at test.DemoSettingsEditor.createEditor(DemoSettingsEditor.java:33)
at com.intellij.openapi.options.SettingsEditor.getComponent(SettingsEditor.java:107)
at com.intellij.execution.impl.ConfigurationSettingsEditor$ConfigToSettingsWrapper.createEditor(ConfigurationSettingsEditor.java:309)
at com.intellij.openapi.options.SettingsEditor.getComponent(SettingsEditor.java:107)
at com.intellij.openapi.options.GroupSettingsBuilder.doCreateComponent(GroupSettingsBuilder.java:55)
at com.intellij.openapi.options.GroupSettingsBuilder.createCompoundEditor(GroupSettingsBuilder.java:47)
at com.intellij.openapi.options.CompositeSettingsEditor.createEditor(CompositeSettingsEditor.java:100)
at com.intellij.openapi.options.SettingsEditor.getComponent(SettingsEditor.java:107)
at com.intellij.execution.impl.ConfigurationSettingsEditorWrapper.createEditor(ConfigurationSettingsEditorWrapper.java:84)
at com.intellij.openapi.options.SettingsEditor.getComponent(SettingsEditor.java:107)
at com.intellij.openapi.options.SettingsEditorConfigurable.<init>(SettingsEditorConfigurable.java:38)
at com.intellij.execution.impl.BaseRCSettingsConfigurable.<init>(BaseRCSettingsConfigurable.java:17)
at com.intellij.execution.impl.TemplateConfigurable.<init>(TemplateConfigurable.java:14)
at com.intellij.execution.impl.RunConfigurable.showTemplateConfigurable(RunConfigurable.kt:322)
at com.intellij.execution.impl.RunConfigurable.access$showTemplateConfigurable(RunConfigurable.kt:75)
at com.intellij.execution.impl.RunConfigurable$initTree$3.valueChanged(RunConfigurable.kt:260)
at javax.swing.JTree.fireValueChanged(JTree.java:2934)
at javax.swing.JTree$TreeSelectionRedirector.valueChanged(JTree.java:3398)
at javax.swing.tree.DefaultTreeSelectionModel.fireValueChanged(DefaultTreeSelectionModel.java:635)
at com.intellij.ui.treeStructure.Tree$MySelectionModel.fireValueChanged(Tree.java:672)
at javax.swing.tree.DefaultTreeSelectionModel.notifyPathChange(DefaultTreeSelectionModel.java:1093)
at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPaths(DefaultTreeSelectionModel.java:294)
at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPath(DefaultTreeSelectionModel.java:188)
at javax.swing.JTree.setSelectionPath(JTree.java:1641)
at javax.swing.plaf.basic.BasicTreeUI.selectPathForEvent(BasicTreeUI.java:2393)
at javax.swing.plaf.basic.BasicTreeUI$Handler.handleSelection(BasicTreeUI.java:3609)
at javax.swing.plaf.basic.BasicTreeUI$Handler.mousePressedDND(BasicTreeUI.java:3586)
at javax.swing.plaf.basic.BasicTreeUI$Handler.mousePressed(BasicTreeUI.java:3545)
at com.intellij.util.ui.MouseEventAdapter.mousePressed(MouseEventAdapter.java:33)
at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:279)
at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:279)
at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:279)
at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:279)
at java.awt.Component.processMouseEvent(Component.java:6536)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at com.intellij.ui.treeStructure.Tree.processMouseEvent(Tree.java:424)
at java.awt.Component.processEvent(Component.java:6304)
at java.awt.Container.processEvent(Container.java:2239)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2297)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4532)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
at java.awt.Container.dispatchEventImpl(Container.java:2283)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
at java.awt.EventQueue$4.run(EventQueue.java:733)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:781)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:718)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:109)
at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:190)
at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:235)
at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:233)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:233)
at java.awt.Dialog.show(Dialog.java:1084)
at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog.show(DialogWrapperPeerImpl.java:698)
at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.show(DialogWrapperPeerImpl.java:430)
at com.intellij.openapi.ui.DialogWrapper.invokeShow(DialogWrapper.java:1690)
at com.intellij.openapi.ui.DialogWrapper.show(DialogWrapper.java:1639)
at com.intellij.execution.actions.EditRunConfigurationsAction.actionPerformed(EditRunConfigurationsAction.java:47)
at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:255)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:272)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.lambda$null$2(ActionManagerImpl.java:1343)
at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:195)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.lambda$tryToExecuteNow$3(ActionManagerImpl.java:1300)
at com.intellij.openapi.wm.impl.FocusManagerImpl.lambda$doWhenFocusSettlesDown$2(FocusManagerImpl.java:199)
at com.intellij.util.ui.UIUtil.invokeLaterIfNeeded(UIUtil.java:3094)
at com.intellij.ide.IdeEventQueue.ifFocusEventsInTheQueue(IdeEventQueue.java:183)
at com.intellij.ide.IdeEventQueue.executeWhenAllFocusEventsLeftTheQueue(IdeEventQueue.java:132)
at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:190)
at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:196)
at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.doWhenFocusSettlesDown(IdeFocusManagerImpl.java:63)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.tryToExecuteNow(ActionManagerImpl.java:1299)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.lambda$tryToExecute$1(ActionManagerImpl.java:1284)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.tryToExecute(ActionManagerImpl.java:1287)
at com.intellij.execution.actions.RunConfigurationsComboBoxAction.performWhenButton(RunConfigurationsComboBoxAction.java:163)
at com.intellij.execution.actions.RunConfigurationsComboBoxAction.access$000(RunConfigurationsComboBoxAction.java:34)
at com.intellij.execution.actions.RunConfigurationsComboBoxAction$1.fireActionPerformed(RunConfigurationsComboBoxAction.java:140)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
at javax.swing.AbstractButton.doClick(AbstractButton.java:356)
at com.intellij.openapi.actionSystem.ex.ComboBoxAction$ComboBoxButton$1.mousePressed(ComboBoxAction.java:155)
at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:280)
at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:279)
This is code from tutorial:
public class PrismRunConfigurationEditor extends SettingsEditor<PrismRunConfiguration> {
private JPanel jPanel;
private LabeledComponent<ComponentWithBrowseButton> myMainClass;
@Override
protected void resetEditorFrom(final PrismRunConfiguration runConfiguration) {
}
@Override
protected void applyEditorTo(final PrismRunConfiguration runConfiguration) throws ConfigurationException {
}
@NotNull
@Override
protected JComponent createEditor() {
System.out.println("createEditor: " + jPanel);
return jPanel;
}
private void createUIComponents() {
myMainClass = new LabeledComponent<ComponentWithBrowseButton>();
myMainClass.setComponent(new TextFieldWithBrowseButton());
}
}
if I set jPanel to new JPanel() all will works fine
public class PrismRunConfigurationEditor extends SettingsEditor<PrismRunConfiguration> {
private JPanel jPanel = new JPanel();
private LabeledComponent<ComponentWithBrowseButton> myMainClass;
@Override
protected void resetEditorFrom(final PrismRunConfiguration runConfiguration) {
}
@Override
protected void applyEditorTo(final PrismRunConfiguration runConfiguration) throws ConfigurationException {
}
@NotNull
@Override
protected JComponent createEditor() {
System.out.println("createEditor: " + jPanel);
return jPanel;
}
private void createUIComponents() {
myMainClass = new LabeledComponent<ComponentWithBrowseButton>();
myMainClass.setComponent(new TextFieldWithBrowseButton());
}
}
But seems it is not right way.
Please sign in to leave a comment.
Did you create an UI form that is bound to PrismRunConfigurationEditor?
Thx, my mistake
I am hitting the same error, you say "Did you create an UI form that is bound to PrismRunConfigurationEditor?" and the documentation says the same thing, and whilst I know that this is the issue, the comment is a very throw away comment like this should be known how to do this and how to confirm that this is done correctly.
I have a form in my project, but if it is bound to something, I have no idea. What does "bound to" mean? how do I know if it is bound ? there is some kind of implicit magic here that is causing a disconnect between these puzzle pieces, perhaps naming of the files, i have no idea.
It would be really useful and less time consuming for noobs if this kind of magic was not skirted over.
Thanks
If you create a GUI designer form, it is probably bound to a class that models its properties - see https://www.jetbrains.com/help/idea/binding-the-form-and-components-to-code.html
Thanks Yann,
This is helpful, I don't know if you can update the following page, but think it would be really useful to include this information there,
https://www.jetbrains.org/intellij/sdk/docs/tutorials/run_configurations.html
And here too.
https://github.com/JetBrains/intellij-sdk-docs/tree/master/code_samples/run_configuration
Thanks John, will do