use of com.intellij.facet.ui.MultipleFacetSettingsEditor in project intellij-community by JetBrains.
the class FacetTypeEditor method createComponent.
@Override
public JComponent createComponent() {
MultipleFacetSettingsEditor allFacetsEditor = createAllFacetsEditor();
if (myAllFacetsEditor != null) {
myAllFacetsEditor.disposeUIResources();
}
myAllFacetsEditor = allFacetsEditor;
myCurrentConfigurables = new ArrayList<>();
if (myDefaultSettingsConfigurable != null) {
myCurrentConfigurables.add(myDefaultSettingsConfigurable);
}
if (myAllFacetsEditor != null) {
myCurrentConfigurables.add(new AllFacetsConfigurable(myAllFacetsEditor));
}
if (myCurrentConfigurables.isEmpty()) {
return new JPanel();
}
if (myCurrentConfigurables.size() == 1) {
return myCurrentConfigurables.get(0).createComponent();
}
myTabbedPane = new TabbedPaneWrapper(myDisposable);
for (Configurable configurable : myCurrentConfigurables) {
myTabbedPane.addTab(configurable.getDisplayName(), configurable.createComponent());
}
return myTabbedPane.getComponent();
}
use of com.intellij.facet.ui.MultipleFacetSettingsEditor in project intellij-community by JetBrains.
the class FacetStructureConfigurable method updateMultiSelection.
public boolean updateMultiSelection(final List<NamedConfigurable> selectedConfigurables, final DetailsComponent detailsComponent) {
FacetType selectedFacetType = null;
List<FacetEditor> facetEditors = new ArrayList<>();
for (NamedConfigurable selectedConfigurable : selectedConfigurables) {
if (selectedConfigurable instanceof FacetConfigurable) {
FacetConfigurable facetConfigurable = (FacetConfigurable) selectedConfigurable;
FacetType facetType = facetConfigurable.getEditableObject().getType();
if (selectedFacetType != null && selectedFacetType != facetType) {
return false;
}
selectedFacetType = facetType;
facetEditors.add(facetConfigurable.getEditor());
}
}
if (facetEditors.size() <= 1 || selectedFacetType == null) {
return false;
}
FacetEditor[] selectedEditors = facetEditors.toArray(new FacetEditor[facetEditors.size()]);
MultipleFacetSettingsEditor editor = selectedFacetType.createMultipleConfigurationsEditor(myProject, selectedEditors);
if (editor == null) {
return false;
}
setSelectedNode(null);
myCurrentMultipleSettingsEditor = editor;
detailsComponent.setText(ProjectBundle.message("multiple.facets.banner.0.1.facets", selectedEditors.length, selectedFacetType.getPresentableName()));
detailsComponent.setContent(editor.createComponent());
return true;
}
Aggregations