本文整理汇总了Java中com.intellij.openapi.module.ModuleType类的典型用法代码示例。如果您正苦于以下问题:Java ModuleType类的具体用法?Java ModuleType怎么用?Java ModuleType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ModuleType类属于com.intellij.openapi.module包,在下文中一共展示了ModuleType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isAvailable
import com.intellij.openapi.module.ModuleType; //导入依赖的package包/类
@Override
protected boolean isAvailable(DataContext dataContext) {
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
final Module module = LangDataKeys.MODULE.getData(dataContext);
final ModuleType moduleType = module == null ? null : ModuleType.get(module);
final boolean isGravModule = moduleType instanceof GravModuleType || moduleType instanceof WebModuleTypeBase;
final boolean pluginEnabled = GravProjectComponent.isEnabled(project);
if (!pluginEnabled) return false;
if (dataContext.getData(PlatformDataKeys.NAVIGATABLE) instanceof PsiDirectory) {
PsiDirectory psiDirectory = (PsiDirectory) dataContext.getData(PlatformDataKeys.NAVIGATABLE);
String themeFolder = psiDirectory.getParent().getVirtualFile().getName();
themeName = psiDirectory.getName();
GravFileTypes.setModuleName(themeName);
boolean isThemeFolder = themeFolder.equalsIgnoreCase("themes");
return super.isAvailable(dataContext) && isGravModule && isThemeFolder;
} else {
return false;
}
}
示例2: createModule
import com.intellij.openapi.module.ModuleType; //导入依赖的package包/类
@Override
public Module createModule(String moduleName, ModuleType moduleType) {
Module module = moduleModel.findModuleByName(moduleName);
if (module == null) {
File imlFile = new File(imlDirectory, moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION);
removeImlFile(imlFile);
module = moduleModel.newModule(imlFile.getPath(), moduleType.getId());
module.setOption(EXTERNAL_SYSTEM_ID_KEY, EXTERNAL_SYSTEM_ID_VALUE);
}
module.setOption(Module.ELEMENT_TYPE, moduleType.getId());
ModifiableRootModel modifiableModel =
ModuleRootManager.getInstance(module).getModifiableModel();
modules.put(module.getName(), modifiableModel);
modifiableModel.clear();
modifiableModel.inheritSdk();
CompilerModuleExtension compilerSettings =
modifiableModel.getModuleExtension(CompilerModuleExtension.class);
if (compilerSettings != null) {
compilerSettings.inheritCompilerOutputPath(false);
}
return module;
}
示例3: createModuleFromTestData
import com.intellij.openapi.module.ModuleType; //导入依赖的package包/类
protected Module createModuleFromTestData(final String dirInTestData, final String newModuleFileName, final ModuleType moduleType,
final boolean addSourceRoot)
throws IOException {
final File dirInTestDataFile = new File(dirInTestData);
assertTrue(dirInTestDataFile.isDirectory());
final File moduleDir = createTempDirectory();
FileUtil.copyDir(dirInTestDataFile, moduleDir);
final Module module = createModule(moduleDir + "/" + newModuleFileName, moduleType);
final VirtualFile root = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(moduleDir);
assertNotNull(root);
new WriteCommandAction.Simple(module.getProject()) {
@Override
protected void run() throws Throwable {
root.refresh(false, true);
}
}.execute().throwException();
if (addSourceRoot) {
PsiTestUtil.addSourceContentToRoots(module, root);
}
else {
PsiTestUtil.addContentRoot(module, root);
}
return module;
}
示例4: postConfigFacets
import com.intellij.openapi.module.ModuleType; //导入依赖的package包/类
public void postConfigFacets() {
MavenUtil.invokeAndWaitWriteAction(myModule.getProject(), new Runnable() {
public void run() {
if (myModule.isDisposed()) return;
final ModuleType moduleType = ModuleType.get(myModule);
for (final MavenImporter importer : getSuitableImporters()) {
final MavenProjectChanges changes;
if (myMavenProjectChanges == null) {
if (importer.processChangedModulesOnly()) continue;
changes = MavenProjectChanges.NONE;
}
else {
changes = myMavenProjectChanges;
}
if (importer.getModuleType() == moduleType) {
importer.postProcess(myModule, myMavenProject, changes, myModifiableModelsProvider);
}
}
}
});
}
示例5: createGroupTemplates
import com.intellij.openapi.module.ModuleType; //导入依赖的package包/类
private static List<ArchivedProjectTemplate> createGroupTemplates(Element groupElement) {
return ContainerUtil.mapNotNull(groupElement.getChildren(TEMPLATE), new NullableFunction<Element, ArchivedProjectTemplate>() {
@Override
public ArchivedProjectTemplate fun(final Element element) {
if (!checkRequiredPlugins(element)) {
return null;
}
final ModuleType moduleType = ModuleTypeManager.getInstance().findByID(element.getChildText("moduleType"));
final String path = element.getChildText("path");
final String description = element.getChildTextTrim("description");
String name = element.getChildTextTrim("name");
RemoteProjectTemplate template = new RemoteProjectTemplate(name, element, moduleType, path, description);
template.populateFromElement(element);
return template;
}
});
}
示例6: isVisible
import com.intellij.openapi.module.ModuleType; //导入依赖的package包/类
public static boolean isVisible(FacetEditorFacade editor, final FacetType<?, ?> type) {
final ModuleType moduleType = editor.getSelectedModuleType();
if (moduleType == null || !type.isSuitableModuleType(moduleType)) {
return false;
}
final FacetTypeId<?> underlyingTypeId = type.getUnderlyingFacetType();
final FacetInfo selectedFacet = editor.getSelectedFacetInfo();
if (selectedFacet == null) {
return underlyingTypeId == null && canAddFacet(null, type, editor);
}
final FacetTypeId selectedFacetType = selectedFacet.getFacetType().getId();
if (selectedFacetType == underlyingTypeId) {
return canAddFacet(selectedFacet, type, editor);
}
final FacetInfo parent = editor.getParent(selectedFacet);
if (!canAddFacet(parent, type, editor)) {
return false;
}
return parent == null && underlyingTypeId == null || parent != null && parent.getFacetType().getId() == underlyingTypeId;
}
示例7: preConfigFacets
import com.intellij.openapi.module.ModuleType; //导入依赖的package包/类
public void preConfigFacets() {
MavenUtil.invokeAndWaitWriteAction(myModule.getProject(), new Runnable() {
public void run() {
if (myModule.isDisposed()) return;
final ModuleType moduleType = ModuleType.get(myModule);
for (final MavenImporter importer : getSuitableImporters()) {
final MavenProjectChanges changes;
if (myMavenProjectChanges == null) {
if (importer.processChangedModulesOnly()) continue;
changes = MavenProjectChanges.NONE;
}
else {
changes = myMavenProjectChanges;
}
if (importer.getModuleType() == moduleType) {
importer.preProcess(myModule, myMavenProject, changes, myModifiableModelsProvider);
}
}
}
});
}
示例8: isVisible
import com.intellij.openapi.module.ModuleType; //导入依赖的package包/类
private boolean isVisible() {
final Module module = getSelectedModule();
if (module == null || !myProvider.isEnabledForModuleType(ModuleType.get(module))) {
return false;
}
final ProjectFacetsConfigurator facetsProvider = myModuleStructureConfigurable.getFacetConfigurator();
if (!myProvider.canAddSupport(module, facetsProvider)) {
return false;
}
final String underlyingFrameworkTypeId = myFrameworkType.getUnderlyingFrameworkTypeId();
if (underlyingFrameworkTypeId == null) return true;
final FrameworkSupportInModuleProvider underlyingProvider = FrameworkSupportUtil.findProvider(underlyingFrameworkTypeId, FrameworkSupportUtil.getAllProviders());
if (underlyingProvider == null) {
LOG.error("framework not found by id " + underlyingFrameworkTypeId);
}
return underlyingProvider.isSupportAlreadyAdded(module, facetsProvider);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:AddFrameworkSupportInProjectStructureAction.java
示例9: doCreateRealModuleIn
import com.intellij.openapi.module.ModuleType; //导入依赖的package包/类
protected static Module doCreateRealModuleIn(String moduleName, final Project project, final ModuleType moduleType) {
final VirtualFile baseDir = project.getBaseDir();
assertNotNull(baseDir);
final File moduleFile = new File(FileUtil.toSystemDependentName(baseDir.getPath()), moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION);
FileUtil.createIfDoesntExist(moduleFile);
myFilesToDelete.add(moduleFile);
return new WriteAction<Module>() {
@Override
protected void run(@NotNull Result<Module> result) throws Throwable {
VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(moduleFile);
assertNotNull(virtualFile);
Module module = ModuleManager.getInstance(project).newModule(virtualFile.getPath(), moduleType.getId());
module.getModuleFile();
result.setResult(module);
}
}.execute().getResultObject();
}
示例10: customizeCellRenderer
import com.intellij.openapi.module.ModuleType; //导入依赖的package包/类
@Override
public void customizeCellRenderer(JTree tree, Object nodeValue, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
final Object value = ((DefaultMutableTreeNode)nodeValue).getUserObject();
if (value instanceof DirectoryChooser.ItemWrapper) {
DirectoryChooser.ItemWrapper wrapper = (DirectoryChooser.ItemWrapper)value;
DirectoryChooser.PathFragment[] fragments = wrapper.getFragments();
for (DirectoryChooser.PathFragment fragment : fragments) {
append(fragment.getText(),
fragment.isCommon() ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
}
setIcon(wrapper.getIcon(myFileIndex));
}
else if (value instanceof Module) {
final Module module = (Module)value;
append(module.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
setIcon(ModuleType.get(module).getIcon());
} else if (value instanceof ModuleGroup) {
append(value.toString(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
setIcon(PlatformIcons.CLOSED_MODULE_GROUP_ICON);
}
}
示例11: updatePythonFacet
import com.intellij.openapi.module.ModuleType; //导入依赖的package包/类
private static void updatePythonFacet(
BlazeContext context,
BlazeProjectData blazeProjectData,
Module workspaceModule,
ModifiableRootModel workspaceModifiableModel) {
if (!blazeProjectData.workspaceLanguageSettings.isLanguageActive(LanguageClass.PYTHON)
|| blazeProjectData.workspaceLanguageSettings.isWorkspaceType(WorkspaceType.PYTHON)) {
removeFacet(workspaceModule);
return;
}
if (ModuleType.get(workspaceModule) instanceof PythonModuleTypeBase) {
return;
}
LibraryContributingFacet<?> pythonFacet = getOrCreatePythonFacet(context, workspaceModule);
if (pythonFacet == null) {
return;
}
Library pythonLib = getFacetLibrary(pythonFacet);
if (pythonLib != null) {
workspaceModifiableModel.addLibraryEntry(pythonLib);
}
}
示例12: doCreateRealModuleIn
import com.intellij.openapi.module.ModuleType; //导入依赖的package包/类
@NotNull
public static Module doCreateRealModuleIn(@NotNull String moduleName,
@NotNull final Project project,
@NotNull final ModuleType moduleType) {
final VirtualFile baseDir = project.getBaseDir();
assertNotNull(baseDir);
final File moduleFile = new File(baseDir.getPath().replace('/', File.separatorChar),
moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION);
FileUtil.createIfDoesntExist(moduleFile);
myFilesToDelete.add(moduleFile);
return new WriteAction<Module>() {
@Override
protected void run(@NotNull Result<Module> result) throws Throwable {
final VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(moduleFile);
assert virtualFile != null;
Module module = ModuleManager.getInstance(project).newModule(virtualFile.getPath(), moduleType.getId());
module.getModuleFile();
result.setResult(module);
}
}.execute().getResultObject();
}
示例13: isEnabled
import com.intellij.openapi.module.ModuleType; //导入依赖的package包/类
@Override
protected boolean isEnabled(@NotNull RootsSelection selection, @NotNull Module module) {
if (!ModuleType.get(module).isSupportedRootType(myRootType) || selection.myHaveSelectedFilesUnderSourceRoots
|| ModuleSourceRootEditHandler.getEditHandler(myRootType) == null) {
return false;
}
if (!selection.mySelectedDirectories.isEmpty()) {
return true;
}
for (SourceFolder root : selection.mySelectedRoots) {
if (!myRootType.equals(root.getRootType())) {
return true;
}
}
return false;
}
示例14: customizeCellRenderer
import com.intellij.openapi.module.ModuleType; //导入依赖的package包/类
@Override
public void customizeCellRenderer(
JTree tree,
Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus
){
final Object userObject = ((DefaultMutableTreeNode)value).getUserObject();
if (!(userObject instanceof MyUserObject)){
if (userObject != null){
append(userObject.toString(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
}
return;
}
MyUserObject node = (MyUserObject)userObject;
Module module = node.getModule();
setIcon(ModuleType.get(module).getIcon());
if (node.isInCycle()){
append(module.getName(), SimpleTextAttributes.ERROR_ATTRIBUTES);
} else {
append(module.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
}
示例15: configure
import com.intellij.openapi.module.ModuleType; //导入依赖的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