use of com.intellij.facet.FacetManager in project android by JetBrains.
the class JavaFacetModuleSetupStep method setAndGetJavaGradleFacet.
@NotNull
private static JavaFacet setAndGetJavaGradleFacet(@NotNull Module module, @NotNull IdeModifiableModelsProvider modelsProvider) {
JavaFacet facet = findFacet(module, modelsProvider, JavaFacet.getFacetTypeId());
if (facet != null) {
return facet;
}
FacetManager facetManager = FacetManager.getInstance(module);
ModifiableFacetModel model = modelsProvider.getModifiableFacetModel(module);
facet = facetManager.createFacet(JavaFacet.getFacetType(), JavaFacet.getFacetName(), null);
model.addFacet(facet);
return facet;
}
use of com.intellij.facet.FacetManager in project android by JetBrains.
the class GradleProjectInfoTest method removeAndroidGradleFacetFromModule.
private void removeAndroidGradleFacetFromModule() {
FacetManager facetManager = FacetManager.getInstance(getModule());
GradleFacet facet = facetManager.findFacet(GradleFacet.getFacetTypeId(), GradleFacet.getFacetName());
if (facet != null) {
ApplicationManager.getApplication().runWriteAction(() -> {
ModifiableFacetModel facetModel = facetManager.createModifiableModel();
facetModel.removeFacet(facet);
facetModel.commit();
});
}
}
use of com.intellij.facet.FacetManager in project android by JetBrains.
the class FacetsTest method testRemoveAllFacetsWithAndroidGradleFacets.
public void testRemoveAllFacetsWithAndroidGradleFacets() throws Exception {
createAndAddGradleFacet(myModule);
FacetManager facetManager = FacetManager.getInstance(myModule);
assertEquals(1, facetManager.getFacetsByType(GradleFacet.getFacetTypeId()).size());
IdeModifiableModelsProvider modelsProvider = new IdeModifiableModelsProviderImpl(getProject());
ModifiableFacetModel facetModel = modelsProvider.getModifiableFacetModel(myModule);
Facets.removeAllFacets(facetModel, GradleFacet.getFacetTypeId());
ApplicationManager.getApplication().runWriteAction(modelsProvider::commit);
assertEquals(0, facetManager.getFacetsByType(GradleFacet.getFacetTypeId()).size());
}
use of com.intellij.facet.FacetManager in project android by JetBrains.
the class FacetsTest method testRemoveAllFacetsWithAndroidFacets.
public void testRemoveAllFacetsWithAndroidFacets() throws Exception {
createAndAddAndroidFacet(myModule);
FacetManager facetManager = FacetManager.getInstance(myModule);
assertEquals(1, facetManager.getFacetsByType(AndroidFacet.ID).size());
IdeModifiableModelsProvider modelsProvider = new IdeModifiableModelsProviderImpl(getProject());
ModifiableFacetModel facetModel = modelsProvider.getModifiableFacetModel(myModule);
Facets.removeAllFacets(facetModel, AndroidFacet.ID);
ApplicationManager.getApplication().runWriteAction(modelsProvider::commit);
assertEquals(0, facetManager.getFacetsByType(AndroidFacet.ID).size());
}
use of com.intellij.facet.FacetManager in project android by JetBrains.
the class ConflictSetTest method setUpLibModule.
private void setUpLibModule() {
FacetManager facetManager = FacetManager.getInstance(myLibModule);
ModifiableFacetModel facetModel = facetManager.createModifiableModel();
try {
AndroidFacet androidFacet = createFacet(facetManager, PROJECT_TYPE_LIBRARY);
androidFacet.setAndroidModel(myLib);
facetModel.addFacet(androidFacet);
GradleFacet gradleFacet = facetManager.createFacet(GradleFacet.getFacetType(), GradleFacet.getFacetName(), null);
gradleFacet.getConfiguration().GRADLE_PROJECT_PATH = myLibGradlePath;
facetModel.addFacet(gradleFacet);
} finally {
facetModel.commit();
}
}
Aggregations