JComponent () { myComponent.myNameText.setEnabled(!myBrokenConfiguration); JComponent result = myComponent.getWholePanel(); DataManager.registerDataProvider(result, dataId -> { if (myComponent == null) { return null; // disposed } if (ConfigurationSettingsEditorWrapper.CONFIGURATION_EDITOR_KEY.is(dataId)) { return getEditor(); } if (RUN_ON_TARGET_NAME_KEY.is(dataId)) { return TargetEnvironmentConfigurations.getEffectiveTargetName(myRunOnTargetPanel.getDefaultTargetName(), myProject); } if (RunConfigurationSelector.KEY.is(dataId)) { return new RunConfigurationSelector() { @Override public void select(@NotNull RunConfiguration configuration) { RunnerAndConfigurationSettingsImpl settings = RunManagerImpl.getInstanceImpl(myProject).getSettings(configuration); RunDialog.editConfiguration(myProject, Objects.requireNonNull(settings), ExecutionBundle.message("edit.run.configuration.for.item.dialog.title", configuration.getName())); } }; } return null; }); Dimension size = result.getPreferredSize(); result.setPreferredSize(new Dimension(Math.min(size.width, 800), Math.min(size.height, 600))); return result; }