本文整理汇总了Java中com.intellij.facet.FacetManager.createModifiableModel方法的典型用法代码示例。如果您正苦于以下问题:Java FacetManager.createModifiableModel方法的具体用法?Java FacetManager.createModifiableModel怎么用?Java FacetManager.createModifiableModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.facet.FacetManager
的用法示例。
在下文中一共展示了FacetManager.createModifiableModel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addAndroidFacet
import com.intellij.facet.FacetManager; //导入方法依赖的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;
}
示例2: setAndGetJavaGradleFacet
import com.intellij.facet.FacetManager; //导入方法依赖的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;
}
示例3: addAndroidFacet
import com.intellij.facet.FacetManager; //导入方法依赖的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;
}
示例4: setUpLibModule
import com.intellij.facet.FacetManager; //导入方法依赖的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();
}
}
示例5: testRemoveAllFacetsWithAndroidFacets
import com.intellij.facet.FacetManager; //导入方法依赖的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());
}
示例6: testRemoveAllFacetsWithAndroidGradleFacets
import com.intellij.facet.FacetManager; //导入方法依赖的package包/类
public void testRemoveAllFacetsWithAndroidGradleFacets() throws Exception {
FacetManager facetManager = FacetManager.getInstance(myModule);
ModifiableFacetModel model = facetManager.createModifiableModel();
try {
AndroidGradleFacet facet = facetManager.createFacet(AndroidGradleFacet.getFacetType(), AndroidGradleFacet.NAME, null);
model.addFacet(facet);
}
finally {
model.commit();
}
assertEquals(1, facetManager.getFacetsByType(AndroidGradleFacet.TYPE_ID).size());
Facets.removeAllFacetsOfType(myModule, AndroidGradleFacet.TYPE_ID);
assertEquals(0, facetManager.getFacetsByType(AndroidGradleFacet.TYPE_ID).size());
}
示例7: createAndroidFacet
import com.intellij.facet.FacetManager; //导入方法依赖的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();
}
}
}
示例8: addSupport
import com.intellij.facet.FacetManager; //导入方法依赖的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();
}
示例9: addSupport
import com.intellij.facet.FacetManager; //导入方法依赖的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();
}
示例10: removeFacet
import com.intellij.facet.FacetManager; //导入方法依赖的package包/类
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();
}
}
示例11: getOrCreatePythonFacet
import com.intellij.facet.FacetManager; //导入方法依赖的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;
}
示例12: testIsCacheMissingModelsWhenCacheHasAndroidModel
import com.intellij.facet.FacetManager; //导入方法依赖的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));
}
示例13: testIsCacheMissingModelsWhenCacheHasJavaModel
import com.intellij.facet.FacetManager; //导入方法依赖的package包/类
public void testIsCacheMissingModelsWhenCacheHasJavaModel() {
FacetManager facetManager = FacetManager.getInstance(myModule);
ModifiableFacetModel model = facetManager.createModifiableModel();
try {
model.addFacet(facetManager.createFacet(AndroidGradleFacet.getFacetType(), AndroidGradleFacet.NAME, null));
model.addFacet(facetManager.createFacet(JavaGradleFacet.getFacetType(), JavaGradleFacet.NAME, null));
} finally {
model.commit();
}
myCachedModule.createChild(IDE_GRADLE_PROJECT, createMock(IdeaGradleProject.class));
myCachedModule.createChild(IDE_JAVA_PROJECT, createMock(IdeaJavaProject.class));
assertFalse(GradleProjectImporter.isCacheMissingModels(myCachedProject, myProject));
}
示例14: testIsCacheMissingModelsWhenCacheIsMissingAndroidModel
import com.intellij.facet.FacetManager; //导入方法依赖的package包/类
public void testIsCacheMissingModelsWhenCacheIsMissingAndroidModel() {
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));
assertTrue(GradleProjectImporter.isCacheMissingModels(myCachedProject, myProject));
}
示例15: testIsCacheMissingModelsWhenCacheIsMissingJavaModel
import com.intellij.facet.FacetManager; //导入方法依赖的package包/类
public void testIsCacheMissingModelsWhenCacheIsMissingJavaModel() {
FacetManager facetManager = FacetManager.getInstance(myModule);
ModifiableFacetModel model = facetManager.createModifiableModel();
try {
model.addFacet(facetManager.createFacet(AndroidGradleFacet.getFacetType(), AndroidGradleFacet.NAME, null));
model.addFacet(facetManager.createFacet(JavaGradleFacet.getFacetType(), JavaGradleFacet.NAME, null));
} finally {
model.commit();
}
myCachedModule.createChild(IDE_GRADLE_PROJECT, createMock(IdeaGradleProject.class));
assertTrue(GradleProjectImporter.isCacheMissingModels(myCachedProject, myProject));
}