JComponent () { final JComponent editorComponent; if (myEditorTabs.length > 1) { final TabbedPaneWrapper tabbedPane = new TabbedPaneWrapper(myDisposable); for (FacetEditorTab editorTab : myEditorTabs) { JComponent c = editorTab.createComponent(); UIUtil.addInsets(c, UIUtil.PANEL_SMALL_INSETS); tabbedPane.addTab(editorTab.getDisplayName(), c); } tabbedPane.addChangeListener(new ChangeListener() { @Override public void stateChanged(@NotNull ChangeEvent e) { myEditorTabs[mySelectedTabIndex].onTabLeaving(); mySelectedTabIndex = tabbedPane.getSelectedIndex(); onTabSelected(myEditorTabs[mySelectedTabIndex]); } }); editorComponent = tabbedPane.getComponent(); myTabbedPane = tabbedPane; } else if (myEditorTabs.length == 1) { editorComponent = myEditorTabs[0].createComponent(); UIUtil.addInsets(editorComponent, JBUI.insets(0, 5, 0, 0)); } else { editorComponent = new JPanel(); } ProjectModelExternalSource externalSource = myContext.getFacet().getExternalSource(); if (externalSource != null) { myErrorPanel.getValidatorsManager().registerValidator(new FacetEditorValidator() { @NotNull @Override public ValidationResult check() { if (isModified()) { String text = ModificationOfImportedModelWarningComponent.getWarningText( JavaUiBundle.message("facet.banner.text", myContext.getFacetName()), externalSource); return new ValidationResult(text); } return ValidationResult.OK; } }, editorComponent); } final JComponent errorComponent = myErrorPanel.getComponent(); UIUtil.addInsets(errorComponent, JBUI.insets(0, 5, 5, 0)); final JPanel panel = new JPanel(new BorderLayout()); panel.add(BorderLayout.CENTER, editorComponent); panel.add(BorderLayout.SOUTH, errorComponent); return panel; }