List<Facet> (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(FacetInfo.EMPTY_ARRAY); 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; }