void (ModifiableModelsProvider modifiableModelsProvider, final Module module) { final ModifiableFacetModel model = modifiableModelsProvider.getFacetModifiableModel(module); final String name = UniqueNameGenerator.generateUniqueName(myFacetType.getDefaultFacetName(), s -> model.findFacet(myFacetType.getId(), s) == null); final F facet = FacetManager.getInstance(module).createFacet(myFacetType, name, myConfiguration, findUnderlyingFacet(module)); model.addFacet(facet); modifiableModelsProvider.commitFacetModifiableModel(module, model); final ModifiableRootModel rootModel = modifiableModelsProvider.getModuleModifiableModel(module); myDetector.setupFacet(facet, rootModel); modifiableModelsProvider.commitModuleModifiableModel(rootModel); }