use of com.intellij.facet.ModifiableFacetModel 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.ModifiableFacetModel 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();
}
}
use of com.intellij.facet.ModifiableFacetModel in project android by JetBrains.
the class ConflictSetTest method setUpMainModuleAsApp.
private void setUpMainModuleAsApp() {
FacetManager facetManager = FacetManager.getInstance(myModule);
ModifiableFacetModel facetModel = facetManager.createModifiableModel();
try {
AndroidFacet facet = createFacet(facetManager, PROJECT_TYPE_APP);
facet.setAndroidModel(myApp);
facetModel.addFacet(facet);
} finally {
facetModel.commit();
}
}
use of com.intellij.facet.ModifiableFacetModel in project intellij-plugins by JetBrains.
the class RubyMotionFacetConfigurator method configure.
public static void configure(VirtualFile baseDir, Module module) {
final RubyMotionFacet existingFacet = RubyMotionFacet.getInstance(module);
if (existingFacet != null) {
return;
}
FacetManager facetManager = FacetManager.getInstance(module);
final ModifiableFacetModel model = facetManager.createModifiableModel();
RubyMotionFacetType facetType = RubyMotionFacetType.getInstance();
RubyMotionFacetConfiguration configuration = ProjectFacetManager.getInstance(module.getProject()).createDefaultConfiguration(facetType);
//configuration.setProjectRootPath(baseDir.getPath());
VirtualFile testFolder = baseDir.findChild("spec");
final ModifiableRootModel rootModel = ModuleRootManager.getInstance(module).getModifiableModel();
if (testFolder != null) {
//configuration.setTestPath(testFolder.getPath());
addTestSources(testFolder, rootModel);
}
VirtualFile libFolder = baseDir.findChild("app");
if (libFolder != null) {
//configuration.setLibPath(libFolder.getPath());
}
RubyMotionFacet.updateMotionLibrary(rootModel);
IdeaInternalUtil.runInsideWriteAction(new ActionRunner.InterruptibleRunnable() {
public void run() throws Exception {
rootModel.commit();
}
});
RubyMotionFacet facet = facetManager.createFacet(facetType, facetType.getDefaultFacetName(), configuration, null);
model.addFacet(facet);
new WriteAction() {
protected void run(@NotNull final Result result) throws Throwable {
model.commit();
}
}.execute();
RubyMotionUtilExt.createMotionRunConfiguration(module);
}
Aggregations