当前位置: 首页>>代码示例>>Java>>正文


Java ModifiableFacetModel.addFacet方法代码示例

本文整理汇总了Java中com.intellij.facet.ModifiableFacetModel.addFacet方法的典型用法代码示例。如果您正苦于以下问题:Java ModifiableFacetModel.addFacet方法的具体用法?Java ModifiableFacetModel.addFacet怎么用?Java ModifiableFacetModel.addFacet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.facet.ModifiableFacetModel的用法示例。


在下文中一共展示了ModifiableFacetModel.addFacet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupFacet

import com.intellij.facet.ModifiableFacetModel; //导入方法依赖的package包/类
static void setupFacet(Module module, @NotNull BuildoutFacetConfiguration config) {
  //TODO: refactor, see other python facets
  FacetManager facetManager = FacetManager.getInstance(module);
  final ModifiableFacetModel model = facetManager.createModifiableModel();
  BuildoutFacetType facetType = BuildoutFacetType.getInstance();
  BuildoutFacet facet = facetManager.createFacet(facetType, facetType.getDefaultFacetName(), config, null);
  model.addFacet(facet);

  new WriteAction() {
    protected void run(@NotNull final Result result) throws Throwable {
      model.commit();
    }
  }.execute();
  facet.updatePaths();
  BuildoutFacet.attachLibrary(module);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:BuildoutFacetConfigurator.java

示例2: addAndroidFacet

import com.intellij.facet.ModifiableFacetModel; //导入方法依赖的package包/类
@NotNull
public static AndroidFacet addAndroidFacet(final Module module, @NotNull VirtualFile contentRoot,
                                           boolean library) {
  final FacetManager facetManager = FacetManager.getInstance(module);
  ModifiableFacetModel model = facetManager.createModifiableModel();
  AndroidFacet facet = model.getFacetByType(AndroidFacet.ID);

  if (facet == null) {
    facet = facetManager.createFacet(AndroidFacet.getFacetType(), "Android", null);
    AndroidFacetConfiguration configuration = facet.getConfiguration();
    configuration.init(module, contentRoot);
    if (library) {
      configuration.getState().LIBRARY_PROJECT = true;
    }
    model.addFacet(facet);
  }
  model.commit();

  return facet;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:AndroidUtils.java

示例3: setAndGetJavaGradleFacet

import com.intellij.facet.ModifiableFacetModel; //导入方法依赖的package包/类
@NotNull
private static JavaGradleFacet setAndGetJavaGradleFacet(Module module) {
  JavaGradleFacet facet = JavaGradleFacet.getInstance(module);
  if (facet != null) {
    return facet;
  }

  // Module does not have Android-Gradle facet. Create one and add it.
  FacetManager facetManager = FacetManager.getInstance(module);
  ModifiableFacetModel model = facetManager.createModifiableModel();
  try {
    facet = facetManager.createFacet(JavaGradleFacet.getFacetType(), JavaGradleFacet.NAME, null);
    model.addFacet(facet);
  }
  finally {
    model.commit();
  }
  return facet;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:DependenciesModuleCustomizer.java

示例4: customizeModule

import com.intellij.facet.ModifiableFacetModel; //导入方法依赖的package包/类
@Override
public void customizeModule(@NotNull Project project,
                            @NotNull Module module,
                            @NotNull IdeModifiableModelsProvider modelsProvider,
                            @Nullable IdeaAndroidProject androidProject) {
  if (androidProject == null) {
    removeAllFacetsOfType(AndroidFacet.ID, modelsProvider.getModifiableFacetModel(module));
  }
  else {
    AndroidFacet facet = AndroidFacet.getInstance(module);
    if (facet != null) {
      configureFacet(facet, androidProject);
    }
    else {
      // Module does not have Android facet. Create one and add it.
      ModifiableFacetModel model = modelsProvider.getModifiableFacetModel(module);
      final AndroidFacetType facetType = AndroidFacet.getFacetType();
      facet = facetType.createFacet(module, AndroidFacet.NAME, facetType.createDefaultConfiguration(), null);
      model.addFacet(facet);
      configureFacet(facet, androidProject);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:AndroidFacetModuleCustomizer.java

示例5: addAndroidFacet

import com.intellij.facet.ModifiableFacetModel; //导入方法依赖的package包/类
public static AndroidFacet addAndroidFacet(Module module, String sdkPath, String platformDir, boolean addSdk) {
  FacetManager facetManager = FacetManager.getInstance(module);
  AndroidFacet facet = facetManager.createFacet(AndroidFacet.getFacetType(), "Android", null);

  if (addSdk) {
    addAndroidSdk(module, sdkPath, platformDir);
  }
  final ModifiableFacetModel facetModel = facetManager.createModifiableModel();
  facetModel.addFacet(facet);
  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    @Override
    public void run() {
      facetModel.commit();
    }
  });
  return facet;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:AndroidTestCase.java

示例6: setUpLibModule

import com.intellij.facet.ModifiableFacetModel; //导入方法依赖的package包/类
private void setUpLibModule() {
  FacetManager facetManager = FacetManager.getInstance(myLibModule);
  ModifiableFacetModel facetModel = facetManager.createModifiableModel();
  try {
    AndroidFacet androidFacet = createFacet(facetManager, true);
    androidFacet.setIdeaAndroidProject(myLib);
    facetModel.addFacet(androidFacet);

    AndroidGradleFacet gradleFacet = facetManager.createFacet(AndroidGradleFacet.getFacetType(), AndroidGradleFacet.NAME, null);
    gradleFacet.getConfiguration().GRADLE_PROJECT_PATH = myLibGradlePath;
    facetModel.addFacet(gradleFacet);
  }
  finally {
    facetModel.commit();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ConflictSetTest.java

示例7: testRemoveAllFacetsWithAndroidFacets

import com.intellij.facet.ModifiableFacetModel; //导入方法依赖的package包/类
public void testRemoveAllFacetsWithAndroidFacets() throws Exception {
  FacetManager facetManager = FacetManager.getInstance(myModule);
  ModifiableFacetModel model = facetManager.createModifiableModel();
  try {
    AndroidFacet facet = facetManager.createFacet(AndroidFacet.getFacetType(), AndroidFacet.NAME, null);
    model.addFacet(facet);
  }
  finally {
    model.commit();
  }

  assertEquals(1, facetManager.getFacetsByType(AndroidFacet.ID).size());

  Facets.removeAllFacetsOfType(myModule, AndroidFacet.ID);

  assertEquals(0, facetManager.getFacetsByType(AndroidFacet.ID).size());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:FacetsTest.java

示例8: createAndroidFacet

import com.intellij.facet.ModifiableFacetModel; //导入方法依赖的package包/类
public static void createAndroidFacet(Module module) {
  AndroidFacet facet = AndroidFacet.getInstance(module);
  if (facet != null) {
    configureFacet(facet);
  } else {
    // Module does not have Android facet. Create one and add it.
    FacetManager facetManager = FacetManager.getInstance(module);
    ModifiableFacetModel model = facetManager.createModifiableModel();
    try {
      facet = facetManager.createFacet(AndroidFacet.getFacetType(), AndroidFacet.NAME, null);
      model.addFacet(facet);
      configureFacet(facet);
    } finally {
      model.commit();
    }
  }
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:18,代码来源:AndroidFacetModuleCustomizer.java

示例9: configure

import com.intellij.facet.ModifiableFacetModel; //导入方法依赖的package包/类
@Override
public void configure(
    @NotNull final ModifiableFacetModel modifiableFacetModel,
    @NotNull final HybrisModuleDescriptor moduleDescriptor,
    @NotNull final Module javaModule,
    @NotNull final ModifiableRootModel modifiableRootModel
) {
    final File webRoot = moduleDescriptor.getWebRoot();
    if (null == webRoot) {
        return;
    }

    WebFacet webFacet = modifiableFacetModel.getFacetByType(WebFacet.ID);

    if (webFacet == null) {
        final FacetType<WebFacet, FacetConfiguration> webFacetType = FacetTypeRegistry.getInstance().findFacetType(
            WebFacet.ID
        );

        if (!webFacetType.isSuitableModuleType(ModuleType.get(javaModule))) {
            return;
        }

        webFacet = FacetManager.getInstance(javaModule).createFacet(
            webFacetType, webFacetType.getDefaultFacetName(), null
        );

        modifiableFacetModel.addFacet(webFacet);

    } else {
        webFacet.removeAllWebRoots();
        webFacet.getDescriptorsContainer().getConfiguration().removeConfigFiles(
            DeploymentDescriptorsConstants.WEB_XML_META_DATA
        );
    }

    webFacet.setWebSourceRoots(modifiableRootModel.getSourceRootUrls(false));
    webFacet.addWebRootNoFire(VfsUtil.pathToUrl(FileUtil.toSystemIndependentName(webRoot.getAbsolutePath())), "/");
    this.setupFacetDeploymentDescriptor(webFacet, moduleDescriptor);
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:41,代码来源:WebFacetConfigurator.java

示例10: setMuleFacet

import com.intellij.facet.ModifiableFacetModel; //导入方法依赖的package包/类
public void setMuleFacet(Module module) {
    MuleFacetType type = (MuleFacetType)FacetTypeRegistry.getInstance().findFacetType(MuleFacet.ID);
    MuleFacetConfiguration configuration = type.createDefaultConfiguration();
    configuration.setPathToSdk(MuleSdkManager.getInstance().findFromVersion(muleVersion).getMuleHome());
    Facet facet = type.createFacet(module, type.getPresentableName(), configuration, null);
    ModifiableFacetModel model = FacetManager.getInstance(module).createModifiableModel();
    model.addFacet(facet);
    model.commit();
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:10,代码来源:MuleMavenModuleBuilder.java

示例11: addSupport

import com.intellij.facet.ModifiableFacetModel; //导入方法依赖的package包/类
public void addSupport(@NotNull Module module, @NotNull ModifiableRootModel model, @Nullable Library library) {
  final FacetManager facetManager = FacetManager.getInstance(module);
  ModifiableFacetModel facetModel = facetManager.createModifiableModel();
  LuaFacet facet = facetManager.createFacet(LuaFacetType.getInstance(), "Lua", null);
  facet.getConfiguration().setSdk(mySdkComboBox.getSelectedSdk());
  facetModel.addFacet(facet);
  facetModel.commit();
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:9,代码来源:LuaFrameworkSupportConfigurable.java

示例12: addSupport

import com.intellij.facet.ModifiableFacetModel; //导入方法依赖的package包/类
public void addSupport(@NotNull Module module, @NotNull ModifiableRootModel model, @Nullable Library library) {
  final FacetManager facetManager = FacetManager.getInstance(module);
  ModifiableFacetModel facetModel = facetManager.createModifiableModel();
  PythonFacet facet = facetManager.createFacet(PythonFacetType.getInstance(), "Python", null);
  facet.getConfiguration().setSdk(mySdkComboBox.getSelectedSdk());
  facetModel.addFacet(facet);
  facetModel.commit();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:PythonFrameworkSupportConfigurable.java

示例13: getOrCreatePythonFacet

import com.intellij.facet.ModifiableFacetModel; //导入方法依赖的package包/类
@Nullable
private static LibraryContributingFacet<?> getOrCreatePythonFacet(
    BlazeContext context, Module module) {
  LibraryContributingFacet<?> facet = findPythonFacet(module);
  if (facet != null && facetHasSdk(facet)) {
    return facet;
  }
  FacetManager manager = FacetManager.getInstance(module);
  ModifiableFacetModel facetModel = manager.createModifiableModel();
  if (facet != null) {
    // we can't modify in place, IntelliJ has no hook to trigger change events. Instead we create
    // a new facet.
    facetModel.removeFacet(facet);
  }
  Sdk sdk = getOrCreatePythonSdk();
  if (sdk == null) {
    String msg =
        "Unable to find a Python SDK installed.\n"
            + "After configuring a suitable SDK in the \"Project Structure\" dialog, "
            + "sync the project again.";
    IssueOutput.error(msg).submit(context);
    return null;
  }
  facet = manager.createFacet(PythonFacetUtil.getTypeInstance(), "Python", null);
  facetModel.addFacet(facet);
  facetModel.commit();
  return facet;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:29,代码来源:BlazePythonSyncPlugin.java

示例14: testIsCacheMissingModelsWhenCacheHasAndroidModel

import com.intellij.facet.ModifiableFacetModel; //导入方法依赖的package包/类
public void testIsCacheMissingModelsWhenCacheHasAndroidModel() {
  FacetManager facetManager = FacetManager.getInstance(myModule);
  ModifiableFacetModel model = facetManager.createModifiableModel();
  try {
    model.addFacet(facetManager.createFacet(AndroidGradleFacet.getFacetType(), AndroidGradleFacet.NAME, null));
    model.addFacet(facetManager.createFacet(AndroidFacet.getFacetType(), AndroidFacet.NAME, null));
  } finally {
    model.commit();
  }

  myCachedModule.createChild(IDE_GRADLE_PROJECT, createMock(IdeaGradleProject.class));
  myCachedModule.createChild(IDE_ANDROID_PROJECT, createMock(IdeaAndroidProject.class));
  assertFalse(GradleProjectImporter.isCacheMissingModels(myCachedProject, myProject));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:GradleProjectImporterTest.java

示例15: testGetGradleBuildFileFromModuleWithGradleFacet

import com.intellij.facet.ModifiableFacetModel; //导入方法依赖的package包/类
public void testGetGradleBuildFileFromModuleWithGradleFacet() {
  GradleProject project = createMock(GradleProject.class);
  expect(project.getPath()).andReturn(myModule.getName());

  //noinspection unchecked
  DomainObjectSet<? extends GradleTask> tasks = createMock(DomainObjectSet.class);
  project.getTasks();
  expectLastCall().andReturn(tasks);

  expect(tasks.isEmpty()).andReturn(true);
  replay(project, tasks);

  IdeaGradleProject gradleProject = IdeaGradleProject.newIdeaGradleProject(myModule.getName(), project, myBuildFile, "2.2.1");

  FacetManager facetManager = FacetManager.getInstance(myModule);
  ModifiableFacetModel model = facetManager.createModifiableModel();
  try {
    AndroidGradleFacet facet = facetManager.createFacet(AndroidGradleFacet.getFacetType(), AndroidGradleFacet.NAME, null);
    model.addFacet(facet);
    facet.setGradleProject(gradleProject);
  }
  finally {
    model.commit();
  }

  VirtualFile buildFile = GradleUtil.getGradleBuildFile(myModule);
  assertIsGradleBuildFile(buildFile);

  verify(project, tasks);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:GradleUtilIdeaTest.java


注:本文中的com.intellij.facet.ModifiableFacetModel.addFacet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。