[space] IDEA-254119: Sign out fully when auth failed and provide way to sign in again
[idea/community.git] / platform / lang-api / src / com / intellij / facet / ModifiableFacetModel.java
index 4664e52adbadfd4f9cff89f22ee675c2217d1a6d..0944f436bebcc9685d2abcfa25883e7aee00168f 100644 (file)
 
 package com.intellij.facet;
 
+import com.intellij.openapi.Disposable;
 import com.intellij.openapi.roots.ProjectModelExternalSource;
-import org.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.ApiStatus;
 import org.jetbrains.annotations.NotNull;
-import com.intellij.openapi.Disposable;
+import org.jetbrains.annotations.Nullable;
 
-/**
- * @author nik
- */
+@ApiStatus.NonExtendable
 public interface ModifiableFacetModel extends FacetModel {
 
-  void addFacet(Facet facet);
-  void addFacet(Facet facet, @Nullable ProjectModelExternalSource externalSource);
-  void removeFacet(Facet facet);
+  void addFacet(Facet<?> facet);
+  void addFacet(Facet<?> facet, @Nullable ProjectModelExternalSource externalSource);
+  void removeFacet(Facet<?> facet);
+
+  /**
+   * Replaces {@code original} facet by {@code replacement}. The only difference with {@code removeFacet(original); addFacet(replacement); }
+   * is that this method preserves order of facets in internal structures to avoid modifications of *.iml files.
+   */
+  @ApiStatus.Internal
+  void replaceFacet(@NotNull Facet<?> original, @NotNull Facet<?> replacement);
 
-  void rename(Facet facet, String newName);
+  void rename(Facet<?> facet, String newName);
 
   @Nullable
-  String getNewName(Facet facet);
+  String getNewName(Facet<?> facet);
 
   void commit();
 
   boolean isModified();
 
-  boolean isNewFacet(Facet facet);
+  boolean isNewFacet(Facet<?> facet);
 
   void addListener(@NotNull Listener listener, @NotNull Disposable parentDisposable);