Search in sources :

Example 1 with FacetEditor

use of com.intellij.facet.ui.FacetEditor in project intellij-community by JetBrains.

the class MultipleFacetEditorHelperImpl method bind.

@Override
public void bind(@NotNull JComboBox common, @NotNull FacetEditor[] editors, @NotNull NotNullFunction<FacetEditor, JComboBox> fun) {
    List<JComboBox> componentsList = new ArrayList<>();
    for (FacetEditor editor : editors) {
        componentsList.add(fun.fun(editor));
    }
    CombobBoxBinding binding = new CombobBoxBinding(common, componentsList);
    myBindings.add(binding);
}
Also used : ArrayList(java.util.ArrayList) FacetEditor(com.intellij.facet.ui.FacetEditor)

Example 2 with FacetEditor

use of com.intellij.facet.ui.FacetEditor in project intellij-community by JetBrains.

the class MultipleFacetEditorHelperImpl method bind.

@Override
public void bind(@NotNull JTextField common, @NotNull FacetEditor[] editors, @NotNull NotNullFunction<FacetEditor, JTextField> fun) {
    List<JTextField> componentsList = new ArrayList<>();
    for (FacetEditor editor : editors) {
        componentsList.add(fun.fun(editor));
    }
    TextFieldBinding binding = new TextFieldBinding(common, componentsList);
    myBindings.add(binding);
}
Also used : ArrayList(java.util.ArrayList) FacetEditor(com.intellij.facet.ui.FacetEditor)

Example 3 with FacetEditor

use of com.intellij.facet.ui.FacetEditor in project intellij-community by JetBrains.

the class MultipleFacetEditorHelperImpl method bind.

@Override
public void bind(@NotNull ThreeStateCheckBox common, @NotNull FacetEditor[] editors, @NotNull NotNullFunction<FacetEditor, JCheckBox> fun) {
    List<JCheckBox> checkBoxesList = new ArrayList<>();
    for (FacetEditor editor : editors) {
        checkBoxesList.add(fun.fun(editor));
    }
    CheckBoxBinding checkBoxBinding = new CheckBoxBinding(common, checkBoxesList);
    myBindings.add(checkBoxBinding);
}
Also used : ArrayList(java.util.ArrayList) FacetEditor(com.intellij.facet.ui.FacetEditor)

Example 4 with FacetEditor

use of com.intellij.facet.ui.FacetEditor 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)

Example 5 with FacetEditor

use of com.intellij.facet.ui.FacetEditor in project intellij-community by JetBrains.

the class FacetTypeEditor method createAllFacetsEditor.

@Nullable
private MultipleFacetSettingsEditor createAllFacetsEditor() {
    ProjectFacetsConfigurator facetsConfigurator = myContext.myModulesConfigurator.getFacetsConfigurator();
    List<Facet> facets = new ArrayList<>();
    for (Module module : myContext.getModules()) {
        facets.addAll(facetsConfigurator.getFacetsByType(module, myFacetType.getId()));
    }
    if (!facets.isEmpty()) {
        final FacetEditor[] editors = new FacetEditor[facets.size()];
        for (int i = 0; i < facets.size(); i++) {
            editors[i] = facetsConfigurator.getOrCreateEditor(facets.get(i));
        }
        return myFacetType.createMultipleConfigurationsEditor(myProject, editors);
    }
    return null;
}
Also used : ArrayList(java.util.ArrayList) FacetEditor(com.intellij.facet.ui.FacetEditor) ProjectFacetsConfigurator(com.intellij.facet.impl.ProjectFacetsConfigurator) Module(com.intellij.openapi.module.Module) Facet(com.intellij.facet.Facet) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

FacetEditor (com.intellij.facet.ui.FacetEditor)5 ArrayList (java.util.ArrayList)4 Facet (com.intellij.facet.Facet)1 ProjectFacetsConfigurator (com.intellij.facet.impl.ProjectFacetsConfigurator)1 InvalidFacetType (com.intellij.facet.impl.invalid.InvalidFacetType)1 MultipleFacetSettingsEditor (com.intellij.facet.ui.MultipleFacetSettingsEditor)1 Module (com.intellij.openapi.module.Module)1 NamedConfigurable (com.intellij.openapi.ui.NamedConfigurable)1 Nullable (org.jetbrains.annotations.Nullable)1