Search in sources :

Example 1 with FacetEditorImpl

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

the class ProjectFacetsConfigurator method applyEditors.

public void applyEditors() throws ConfigurationException {
    for (Map.Entry<Facet, FacetEditorImpl> entry : myEditors.entrySet()) {
        final FacetEditorImpl editor = entry.getValue();
        if (editor.isModified()) {
            myChangedFacets.add(entry.getKey());
        }
        editor.apply();
    }
}
Also used : FacetEditorImpl(com.intellij.facet.impl.ui.FacetEditorImpl)

Example 2 with FacetEditorImpl

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

the class ProjectFacetsConfigurator method getOrCreateEditor.

@NotNull
public FacetEditorImpl getOrCreateEditor(Facet facet) {
    FacetEditorImpl editor = myEditors.get(facet);
    if (editor == null) {
        final Facet underlyingFacet = facet.getUnderlyingFacet();
        final FacetEditorContext parentContext = underlyingFacet != null ? getOrCreateEditor(underlyingFacet).getContext() : null;
        final FacetEditorContext context = createContext(facet, parentContext);
        editor = new FacetEditorImpl(context, facet.getConfiguration());
        editor.getComponent();
        editor.reset();
        myEditors.put(facet, editor);
    }
    return editor;
}
Also used : FacetEditorImpl(com.intellij.facet.impl.ui.FacetEditorImpl) FacetEditorContext(com.intellij.facet.ui.FacetEditorContext) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with FacetEditorImpl

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

the class ProjectFacetsConfigurator method removeFacet.

public List<Facet> removeFacet(Facet facet) {
    FacetTreeModel treeModel = getTreeModel(facet.getModule());
    FacetInfo facetInfo = myFacet2Info.get(facet);
    if (facetInfo == null)
        return Collections.emptyList();
    final List<Facet> removed = new ArrayList<>();
    List<FacetInfo> childrenList = treeModel.getChildren(facetInfo);
    FacetInfo[] children = childrenList.toArray(new FacetInfo[childrenList.size()]);
    for (FacetInfo child : children) {
        Facet childInfo = myInfo2Facet.get(child);
        if (childInfo != null) {
            removed.addAll(removeFacet(childInfo));
        }
    }
    treeModel.removeFacetInfo(facetInfo);
    getOrCreateModifiableModel(facet.getModule()).removeFacet(facet);
    myChangedFacets.remove(facet);
    if (myCreatedFacets.contains(facet)) {
        Disposer.dispose(facet);
    }
    final FacetEditorImpl facetEditor = myEditors.remove(facet);
    if (facetEditor != null) {
        facetEditor.disposeUIResources();
    }
    myFacet2Info.remove(facet);
    myInfo2Facet.remove(facetInfo);
    removed.add(facet);
    return removed;
}
Also used : FacetEditorImpl(com.intellij.facet.impl.ui.FacetEditorImpl) FacetTreeModel(com.intellij.facet.impl.ui.FacetTreeModel)

Example 4 with FacetEditorImpl

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

the class ProjectFacetsConfigurator method disposeEditors.

public void disposeEditors() {
    for (Facet facet : myFacetsToDispose) {
        Disposer.dispose(facet);
    }
    myFacetsToDispose.clear();
    myCreatedFacets.clear();
    for (FacetEditorImpl editor : myEditors.values()) {
        editor.disposeUIResources();
    }
    myProjectData = null;
}
Also used : FacetEditorImpl(com.intellij.facet.impl.ui.FacetEditorImpl)

Example 5 with FacetEditorImpl

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

the class ProjectFacetsConfigurator method commitFacets.

public void commitFacets() {
    for (ModifiableFacetModel model : myModifiableModels.values()) {
        model.commit();
    }
    for (Map.Entry<Facet, FacetEditorImpl> entry : myEditors.entrySet()) {
        entry.getValue().onFacetAdded(entry.getKey());
    }
    myModifiableModels.clear();
    for (Facet facet : myChangedFacets) {
        Module module = facet.getModule();
        if (!module.isDisposed()) {
            module.getMessageBus().syncPublisher(FacetManager.FACETS_TOPIC).facetConfigurationChanged(facet);
        }
    }
    myChangedFacets.clear();
}
Also used : FacetEditorImpl(com.intellij.facet.impl.ui.FacetEditorImpl) Module(com.intellij.openapi.module.Module)

Aggregations

FacetEditorImpl (com.intellij.facet.impl.ui.FacetEditorImpl)6 FacetTreeModel (com.intellij.facet.impl.ui.FacetTreeModel)1 FacetEditorContext (com.intellij.facet.ui.FacetEditorContext)1 Module (com.intellij.openapi.module.Module)1 Project (com.intellij.openapi.project.Project)1 ModuleStructureConfigurable (com.intellij.openapi.roots.ui.configuration.projectRoot.ModuleStructureConfigurable)1 NotNull (org.jetbrains.annotations.NotNull)1