use of com.intellij.facet.FacetManager 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.FacetManager in project kotlin by JetBrains.
the class AbstractAndroidQuickFixMultiFileTest method addAndroidFacet.
private void addAndroidFacet() {
FacetManager facetManager = FacetManager.getInstance(myModule);
AndroidFacet facet = facetManager.createFacet(AndroidFacet.getFacetType(), "Android", null);
final ModifiableFacetModel facetModel = facetManager.createModifiableModel();
facetModel.addFacet(facet);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
facetModel.commit();
}
});
}
use of com.intellij.facet.FacetManager 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);
}
use of com.intellij.facet.FacetManager in project google-cloud-intellij by GoogleCloudPlatform.
the class AppEngineUtil method createModuleDeploymentSources.
/**
* Creates a list of module deployment sources available for deployment to App Engine:
*
* <p>Maven based deployment sources are included for both flexible and standard projects if
* applicable.
*
* <p>User browsable jar/war deployment sources are included only if there are no App Engine
* standard modules.
*
* @return a list of {@link ModuleDeploymentSource}'s
*/
public static List<ModuleDeploymentSource> createModuleDeploymentSources(@NotNull Project project) {
AppEngineProjectService projectService = AppEngineProjectService.getInstance();
List<ModuleDeploymentSource> moduleDeploymentSources = Lists.newArrayList();
boolean hasStandardModules = false;
for (Module module : ModuleManager.getInstance(project).getModules()) {
FacetManager facetManager = FacetManager.getInstance(module);
if (facetManager.getFacetByType(AppEngineStandardFacetType.ID) != null || facetManager.getFacetByType(AppEngineFlexibleFacetType.ID) != null) {
AppEngineEnvironment environment = projectService.getModuleAppEngineEnvironment(module).orElseThrow(() -> new RuntimeException("No environment."));
if (ModuleType.is(module, JavaModuleType.getModuleType()) && projectService.isJarOrWarMavenBuild(module)) {
moduleDeploymentSources.add(createMavenBuildDeploymentSource(project, module, environment));
}
if (environment.isStandard() || environment.isFlexCompat()) {
hasStandardModules = true;
}
}
}
if (!hasStandardModules) {
moduleDeploymentSources.add(createUserSpecifiedPathDeploymentSource(project));
}
return moduleDeploymentSources;
}
use of com.intellij.facet.FacetManager in project intellij by bazelbuild.
the class BlazePythonSyncPlugin method removeFacet.
private static void removeFacet(Module workspaceModule) {
FacetManager manager = FacetManager.getInstance(workspaceModule);
ModifiableFacetModel facetModel = manager.createModifiableModel();
LibraryContributingFacet<?> facet = manager.findFacet(PythonFacetUtil.getFacetId(), "Python");
if (facet != null) {
facetModel.removeFacet(facet);
facetModel.commit();
}
}
Aggregations