JComponent () { List<SettingsEditorFragment<Settings, ?>> fragments = new ArrayList<>(myFragments); fragments.sort(Comparator.comparingInt(SettingsEditorFragment::getPriority)); SettingsEditorFragment<Settings, ?> beforeRun = ContainerUtil.find(fragments, fragment -> fragment.isBeforeRun()); SettingsEditorFragment<Settings, ?> header = ContainerUtil.find(fragments, fragment -> fragment.isHeader()); List<SettingsEditorFragment<Settings, ?>> commandLine = ContainerUtil.filter(fragments, fragment -> fragment.isCommandLine()); List<SettingsEditorFragment<Settings, ?>> subGroups = ContainerUtil.filter(fragments, fragment -> !fragment.getChildren().isEmpty()); List<SettingsEditorFragment<Settings, ?>> tags = ContainerUtil.filter(fragments, it -> it.isTag()); fragments.remove(beforeRun); fragments.remove(header); fragments.removeAll(commandLine); fragments.removeAll(subGroups); fragments.removeAll(tags); if (myMain == null) { myPanel.setBorder(JBUI.Borders.emptyLeft(5)); addLine(new JSeparator()); } addBeforeRun(beforeRun); addHeader(header); myGroupInset = myMain == null ? 0 : LEFT_INSET; if (myMain != null && myMain.component() != null) { addLine(myMain.component()); } addCommandLinePanel(commandLine); addFragments(fragments); addTagPanel(tags); addSubGroups(subGroups); myGroupInset = 0; if (myMain == null) { myConstraints.weighty = 1; myPanel.add(new JPanel(), myConstraints); } return myPanel; }