use of com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl in project android by JetBrains.
the class ModuleDisposerTest method testDisposeModulesAndMarkImlFilesForDeletion.
public void testDisposeModulesAndMarkImlFilesForDeletion() {
// This module should be disposed.
Module libModule = createModule("lib");
File libImlFilePath = new File(toSystemDependentName(libModule.getModuleFilePath()));
Project project = getProject();
IdeModifiableModelsProvider modelsProvider = new IdeModifiableModelsProviderImpl(project);
myModuleDisposer.disposeModulesAndMarkImlFilesForDeletion(Collections.singletonList(libModule), project, modelsProvider);
// Apply changes
ApplicationManager.getApplication().runWriteAction(modelsProvider::commit);
// Make sure module "lib" was disposed and its .iml file was deleted.
assertTrue(Disposer.isDisposed(libModule));
verify(myDisposedModules, times(1)).markImlFilesForDeletion(Collections.singletonList(libImlFilePath));
}
use of com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl in project android by JetBrains.
the class ModuleDisposerTest method testDisposeModulesAndMarkImlFilesForDeletionWithNoModules.
public void testDisposeModulesAndMarkImlFilesForDeletionWithNoModules() {
Project project = getProject();
IdeModifiableModelsProvider modelsProvider = new IdeModifiableModelsProviderImpl(project);
myModuleDisposer.disposeModulesAndMarkImlFilesForDeletion(Collections.emptyList(), project, modelsProvider);
// Apply changes
ApplicationManager.getApplication().runWriteAction(modelsProvider::commit);
//noinspection unchecked
verify(myDisposedModules, never()).markImlFilesForDeletion(anyList());
}
use of com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl 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.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl in project android by JetBrains.
the class GradleModuleSetupTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
initMocks(this);
Project project = getProject();
IdeComponents.replaceService(project, GradleSyncState.class, mySyncState);
String moduleName = "app";
myModule = createModule(moduleName);
IdeaProjectStub projectModel = new IdeaProjectStub(project.getName());
myModuleModel = projectModel.addModule(moduleName, "task1", "task2");
mySyncSummary = new GradleSyncSummary(project);
when(mySyncState.getSummary()).thenReturn(mySyncSummary);
myModelsProvider = new IdeModifiableModelsProviderImpl(project);
myModuleSetup = new GradleModuleSetup();
}
use of com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl 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());
}
Aggregations