Search in sources :

Example 1 with FacetTreeModel

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

the class ProjectFacetsConfigurator method getTreeModel.

public FacetTreeModel getTreeModel(Module module) {
    FacetTreeModel treeModel = myTreeModels.get(module);
    if (treeModel == null) {
        treeModel = new FacetTreeModel();
        myTreeModels.put(module, treeModel);
    }
    return treeModel;
}
Also used : FacetTreeModel(com.intellij.facet.impl.ui.FacetTreeModel)

Example 2 with FacetTreeModel

use of com.intellij.facet.impl.ui.FacetTreeModel 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 3 with FacetTreeModel

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

the class FacetEditorFacadeImpl method nodeHasFacetOfType.

@Override
public boolean nodeHasFacetOfType(final FacetInfo facet, FacetTypeId typeId) {
    final Module selectedModule = getSelectedModule();
    if (selectedModule == null) {
        return false;
    }
    final FacetTreeModel facetTreeModel = getFacetConfigurator().getTreeModel(selectedModule);
    return facetTreeModel.hasFacetOfType(facet, typeId);
}
Also used : Module(com.intellij.openapi.module.Module) FacetTreeModel(com.intellij.facet.impl.ui.FacetTreeModel)

Example 4 with FacetTreeModel

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

the class ProjectFacetsConfigurator method hasFacetOfType.

public boolean hasFacetOfType(Module module, @Nullable Facet parent, FacetTypeId<?> typeId) {
    final FacetTreeModel treeModel = getTreeModel(module);
    final FacetInfo parentInfo = getFacetInfo(parent);
    return treeModel.hasFacetOfType(parentInfo, typeId);
}
Also used : FacetTreeModel(com.intellij.facet.impl.ui.FacetTreeModel)

Aggregations

FacetTreeModel (com.intellij.facet.impl.ui.FacetTreeModel)4 FacetEditorImpl (com.intellij.facet.impl.ui.FacetEditorImpl)1 Module (com.intellij.openapi.module.Module)1