use of com.intellij.facet.ModifiableFacetModel in project android by JetBrains.
the class ContentRootsModuleSetupStepTest method addNativeAndroidFacet.
@NotNull
private NdkFacet addNativeAndroidFacet(@NotNull IdeModifiableModelsProvider modelsProvider) {
Module module = getModule();
ModifiableFacetModel model = modelsProvider.getModifiableFacetModel(module);
NdkFacetType facetType = NdkFacet.getFacetType();
NdkFacet facet = facetType.createFacet(module, NdkFacet.getFacetName(), facetType.createDefaultConfiguration(), null);
model.addFacet(facet);
return facet;
}
use of com.intellij.facet.ModifiableFacetModel in project android by JetBrains.
the class PostProjectBuildTasksExecutorTest method addAndroidFacet.
private static void addAndroidFacet(@NotNull Module module) {
FacetManager facetManager = FacetManager.getInstance(module);
ModifiableFacetModel facetModel = facetManager.createModifiableModel();
try {
AndroidFacet facet = facetManager.createFacet(AndroidFacet.getFacetType(), AndroidFacet.NAME, null);
facetModel.addFacet(facet);
} finally {
facetModel.commit();
}
}
use of com.intellij.facet.ModifiableFacetModel in project intellij-plugins by JetBrains.
the class AddFacetTest method testAddFacetAfterCreatingManifest.
public void testAddFacetAfterCreatingManifest() {
new WriteAction() {
@Override
protected void run(@NotNull Result result) throws Throwable {
VirtualFile[] roots = ModuleRootManager.getInstance(myModule).getContentRoots();
VirtualFile metaInf = roots[0].createChildDirectory(this, "META-INF");
VirtualFile manifest = metaInf.createChildData(this, "MANIFEST.MF");
VfsUtil.saveText(manifest, "Manifest-Version: 1.0\n" + "Bundle-ManifestVersion: 2\n" + "Bundle-Name: Test\n" + "Bundle-SymbolicName: test\n" + "Bundle-Version: 1.0.0\n");
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
}
}.execute();
new WriteAction() {
@Override
protected void run(@NotNull Result result) throws Throwable {
ModifiableFacetModel model = FacetManager.getInstance(myModule).createModifiableModel();
OsmorcFacet facet = new OsmorcFacet(myModule);
facet.getConfiguration().setManifestGenerationMode(ManifestGenerationMode.Manually);
model.addFacet(facet);
model.commit();
}
}.execute();
}
use of com.intellij.facet.ModifiableFacetModel in project intellij-community by JetBrains.
the class MvcModuleStructureUtil method updateAuxModuleStructure.
public static void updateAuxModuleStructure(Module auxModule, Collection<VirtualFile> pluginDirs, MvcFramework framework) {
final MvcProjectStructure structure = framework.createProjectStructure(auxModule, true);
Pair<Collection<Consumer<ModifiableRootModel>>, Collection<Consumer<ModifiableFacetModel>>> actions = getUpdateProjectStructureActions(pluginDirs, structure);
for (final ContentEntry root : ModuleRootManager.getInstance(auxModule).getContentEntries()) {
if (!pluginDirs.contains(root.getFile())) {
actions.first.add(removeStaleContentEntries(pluginDirs));
break;
}
}
if (!actions.first.isEmpty()) {
actions.first.add(exportDefaultLibrary(structure.getUserLibraryName()));
}
if (!actions.first.isEmpty()) {
final ModifiableRootModel model = ModuleRootManager.getInstance(auxModule).getModifiableModel();
for (final Consumer<ModifiableRootModel> pluginsUpdateAction : actions.first) {
pluginsUpdateAction.consume(model);
}
model.commit();
}
if (!actions.second.isEmpty()) {
final ModifiableFacetModel model = FacetManager.getInstance(auxModule).createModifiableModel();
for (Consumer<ModifiableFacetModel> action : actions.second) {
action.consume(model);
}
model.commit();
}
}
use of com.intellij.facet.ModifiableFacetModel in project intellij-community by JetBrains.
the class BuildoutConfigurable method removeFacet.
private void removeFacet(BuildoutFacet facet) {
final ModifiableFacetModel model = FacetManager.getInstance(myModule).createModifiableModel();
model.removeFacet(facet);
ApplicationManager.getApplication().runWriteAction(() -> model.commit());
}
Aggregations