本文整理汇总了Java中com.intellij.facet.FacetManager类的典型用法代码示例。如果您正苦于以下问题:Java FacetManager类的具体用法?Java FacetManager怎么用?Java FacetManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FacetManager类属于com.intellij.facet包,在下文中一共展示了FacetManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addRootsFromModule
import com.intellij.facet.FacetManager; //导入依赖的package包/类
private static void addRootsFromModule(Module module, Collection<String> pythonPathList) {
// for Jython
final CompilerModuleExtension extension = CompilerModuleExtension.getInstance(module);
if (extension != null) {
final VirtualFile path = extension.getCompilerOutputPath();
if (path != null) {
pythonPathList.add(path.getPath());
}
final VirtualFile pathForTests = extension.getCompilerOutputPathForTests();
if (pathForTests != null) {
pythonPathList.add(pathForTests.getPath());
}
}
//additional paths from facets (f.e. buildout)
final Facet[] facets = FacetManager.getInstance(module).getAllFacets();
for (Facet facet : facets) {
if (facet instanceof PythonPathContributingFacet) {
List<String> more_paths = ((PythonPathContributingFacet)facet).getAdditionalPythonPath();
if (more_paths != null) pythonPathList.addAll(more_paths);
}
}
}
示例2: setupFacet
import com.intellij.facet.FacetManager; //导入依赖的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);
}
示例3: 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;
}
示例4: 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;
}
示例5: cleanUpAndroidModuleWithoutVariants
import com.intellij.facet.FacetManager; //导入依赖的package包/类
private static void cleanUpAndroidModuleWithoutVariants(@NotNull Module module) {
// Remove Android facet, otherwise the IDE will try to build the module, and fail. The facet may have been added in a previous
// successful commit.
AndroidFacet facet = AndroidFacet.getInstance(module);
if (facet != null) {
ModifiableFacetModel facetModel = FacetManager.getInstance(module).createModifiableModel();
facetModel.removeFacet(facet);
facetModel.commit();
}
// Clear all source and exclude folders.
ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
ModifiableRootModel rootModel = moduleRootManager.getModifiableModel();
for (ContentEntry contentEntry : rootModel.getContentEntries()) {
contentEntry.clearSourceFolders();
contentEntry.clearExcludeFolders();
}
rootModel.commit();
}
示例6: 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;
}
示例7: 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();
}
}
示例8: 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());
}
示例9: 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());
}
示例10: setUp
import com.intellij.facet.FacetManager; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
AndroidTestCaseHelper.removeExistingAndroidSdks();
myAndroidSdkPath = AndroidTestCaseHelper.getAndroidSdkPath();
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
FacetManager facetManager = FacetManager.getInstance(myModule);
ModifiableFacetModel model = facetManager.createModifiableModel();
try {
model.addFacet(facetManager.createFacet(AndroidFacet.getFacetType(), AndroidFacet.NAME, null));
} finally {
model.commit();
}
}
});
AndroidFacet facet = AndroidFacet.getInstance(myModule);
assertNotNull(facet);
facet.getProperties().ALLOW_USER_CONFIGURATION = false;
}
示例11: 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();
}
}
}
示例12: setupJpaSupport
import com.intellij.facet.FacetManager; //导入依赖的package包/类
@Override
public void setupJpaSupport(@NotNull Module module, @NotNull VirtualFile persistenceXml) {
JpaFacet facet = FacetManager.getInstance(module).getFacetByType(JpaFacet.ID);
if (facet == null) {
final JpaFacet jpaFacet =
FacetManager.getInstance(module)
.addFacet(
JpaFacetType.getInstance(),
JpaFacetType.getInstance().getDefaultFacetName(),
null);
jpaFacet
.getDescriptorsContainer()
.getConfiguration()
.replaceConfigFile(
JavaeePersistenceDescriptorsConstants.PERSISTENCE_XML_META_DATA,
persistenceXml.getUrl());
}
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:19,代码来源:AppEngineStandardUltimateWebIntegration.java
示例13: testAppEngine_defaultManagedLibrariesSelected
import com.intellij.facet.FacetManager; //导入依赖的package包/类
public void testAppEngine_defaultManagedLibrariesSelected() {
AppEngineStandardLibraryPanel libraryPanel =
new AppEngineStandardLibraryPanel(true /*enabled*/);
LibraryEx library = mock(LibraryEx.class);
when(library.getTable()).thenReturn(ProjectLibraryTable.getInstance(myModule.getProject()));
when(library.getExcludedRoots()).thenReturn(new VirtualFile[0]);
when(library.getName()).thenReturn("javax.servlet:servlet-api:2.5");
setupAppEngine(libraryPanel, library);
addSupport();
assertNull(FacetManager.getInstance(myModule).getFacetByType(WebFacet.ID));
final String moduleName = myModule.getName();
ArtifactsTestUtil.assertLayout(
myProject,
moduleName,
"<root>\n"
+ " WEB-INF/\n"
+ " classes/\n"
+ " module:"
+ moduleName
+ "\n"
+ " lib/\n"
+ " lib:javax.servlet:servlet-api:2.5(project)\n");
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:27,代码来源:AppEngineStandardSupportProviderTest.java
示例14: addSupport
import com.intellij.facet.FacetManager; //导入依赖的package包/类
@Override
public void addSupport(
@NotNull Module module,
@NotNull ModifiableRootModel rootModel,
@NotNull ModifiableModelsProvider modifiableModelsProvider) {
FacetType<AppEngineFlexibleFacet, AppEngineFlexibleFacetConfiguration> facetType =
AppEngineFlexibleFacet.getFacetType();
AppEngineFlexibleFacet facet =
FacetManager.getInstance(module)
.addFacet(facetType, facetType.getPresentableName(), null /* underlyingFacet */);
StartupManagerEx startupManger = StartupManagerEx.getInstanceEx(module.getProject());
if (!startupManger.postStartupActivityPassed()) {
startupManger.registerPostStartupActivity(
() -> addAppEngineFlexibleSupport(rootModel, facet));
} else {
addAppEngineFlexibleSupport(rootModel, facet);
}
CloudSdkService sdkService = CloudSdkService.getInstance();
if (!sdkService
.validateCloudSdk(cloudSdkPanel.getCloudSdkDirectoryText())
.contains(CloudSdkValidationResult.MALFORMED_PATH)) {
sdkService.setSdkHomePath(cloudSdkPanel.getCloudSdkDirectoryText());
}
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:27,代码来源:AppEngineFlexibleSupportProvider.java
示例15: testAddSupportPostStartup
import com.intellij.facet.FacetManager; //导入依赖的package包/类
public void testAddSupportPostStartup() {
Module module = createModule("testModule");
doNothing()
.when(supportConfigurable)
.addAppEngineFlexibleSupport(
any(ModifiableRootModel.class), any(AppEngineFlexibleFacet.class));
new WriteAction() {
@Override
protected void run(@NotNull Result result) throws Throwable {
supportConfigurable.addSupport(
module, mock(ModifiableRootModel.class), mock(ModifiableModelsProvider.class));
}
}.execute();
assertNotNull(FacetManager.getInstance(module).getFacetByType(AppEngineFlexibleFacetType.ID));
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:19,代码来源:AppEngineFlexibleSupportConfigurableTest.java