Search in sources :

Example 1 with MultipleFacetSettingsEditor

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();
}
Also used : MultipleFacetSettingsEditor(com.intellij.facet.ui.MultipleFacetSettingsEditor) TabbedPaneWrapper(com.intellij.ui.TabbedPaneWrapper) Configurable(com.intellij.openapi.options.Configurable)

Example 2 with MultipleFacetSettingsEditor

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;
}
Also used : InvalidFacetType(com.intellij.facet.impl.invalid.InvalidFacetType) MultipleFacetSettingsEditor(com.intellij.facet.ui.MultipleFacetSettingsEditor) NamedConfigurable(com.intellij.openapi.ui.NamedConfigurable) FacetEditor(com.intellij.facet.ui.FacetEditor)

Aggregations

MultipleFacetSettingsEditor (com.intellij.facet.ui.MultipleFacetSettingsEditor)2 InvalidFacetType (com.intellij.facet.impl.invalid.InvalidFacetType)1 FacetEditor (com.intellij.facet.ui.FacetEditor)1 Configurable (com.intellij.openapi.options.Configurable)1 NamedConfigurable (com.intellij.openapi.ui.NamedConfigurable)1 TabbedPaneWrapper (com.intellij.ui.TabbedPaneWrapper)1