本文整理汇总了Java中com.intellij.openapi.module.Module类的典型用法代码示例。如果您正苦于以下问题:Java Module类的具体用法?Java Module怎么用?Java Module使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Module类属于com.intellij.openapi.module包,在下文中一共展示了Module类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findDeepestExactMatch
import com.intellij.openapi.module.Module; //导入依赖的package包/类
@Nullable
@Override
public MetadataNode findDeepestExactMatch(Project project, Module module,
List<String> containerElements) {
if (moduleNameToSanitisedRootSearchIndex.containsKey(module.getName())) {
String[] pathSegments =
containerElements.stream().flatMap(element -> stream(toPathSegments(element)))
.toArray(String[]::new);
MetadataNode searchStartNode = moduleNameToSanitisedRootSearchIndex.get(module.getName())
.get(MetadataNode.sanitize(pathSegments[0]));
if (searchStartNode != null) {
if (pathSegments.length > 1) {
return searchStartNode.findDeepestMatch(pathSegments, 1, true);
}
return searchStartNode;
}
}
return null;
}
示例2: getIjModule
import com.intellij.openapi.module.Module; //导入依赖的package包/类
public static Module getIjModule( PsiElement element )
{
Module module = ModuleUtil.findModuleForPsiElement( element );
if( module != null )
{
return module;
}
ManifoldPsiClass javaFacadePsiClass = element.getContainingFile().getUserData( ManifoldPsiClass.KEY_MANIFOLD_PSI_CLASS );
if( javaFacadePsiClass != null )
{
return javaFacadePsiClass.getModule();
}
return null;
}
示例3: getAndroidSdkPath
import com.intellij.openapi.module.Module; //导入依赖的package包/类
public static String getAndroidSdkPath(Project project) {
ModuleManager manager = ModuleManager.getInstance(project);
String androidSdkPath = null;
for (Module module : manager.getModules()) {
if (androidSdkPath != null) {
break;
}
Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
if (sdk != null && sdk.getHomePath() != null) {
File file = new File(sdk.getHomePath());
String[] contents = file.list();
if (contents != null) {
for (String path : contents) {
if (path.equals("build-tools")) {
androidSdkPath = sdk.getHomePath();
break;
}
}
}
}
}
return androidSdkPath;
}
示例4: dependencyChainContains
import com.intellij.openapi.module.Module; //导入依赖的package包/类
private static boolean dependencyChainContains( Module ijModule, String path, List<Module> visited )
{
if( !visited.contains( ijModule ) )
{
visited.add( ijModule );
ModuleRootManager rootManager = ModuleRootManager.getInstance( ijModule );
for( Module dep : rootManager.getDependencies() )
{
if( getDirectClassPaths( dep ).contains( path ) || dependencyChainContains( dep, path, visited ) )
{
return true;
}
}
}
return false;
}
示例5: isInterfaceMadeStructuralByExtension
import com.intellij.openapi.module.Module; //导入依赖的package包/类
private boolean isInterfaceMadeStructuralByExtension( PsiClass psiExtentionInterface )
{
Module module = ManProject.getIjModule( psiExtentionInterface );
if( module != null )
{
if( isInterfaceMadeStructuralByExtension( psiExtentionInterface, ManProject.getModule( module ) ) )
{
return true;
}
}
else
{
ManProject manProject = ManProject.manProjectFrom( psiExtentionInterface.getProject() );
for( ManModule manModule : manProject.getModules() )
{
if( isInterfaceMadeStructuralByExtension( psiExtentionInterface, manModule ) )
{
return true;
}
}
}
return false;
}
示例6: getClassPaths
import com.intellij.openapi.module.Module; //导入依赖的package包/类
public static List<IDirectory> getClassPaths( Module ijModule )
{
List<String> paths = getDirectClassPaths( ijModule );
for( Iterator<String> it = paths.iterator(); it.hasNext(); )
{
String url = it.next();
if( dependencyChainContains( ijModule, url, new ArrayList<>() ) )
{
it.remove();
}
}
List<IDirectory> dirs = new ArrayList<>();
for( String path : paths )
{
dirs.add( manProjectFrom( ijModule ).getFileSystem().getIDirectory( new File( path ) ) );
}
return dirs;
}
示例7: configureModuleDependencies
import com.intellij.openapi.module.Module; //导入依赖的package包/类
private void configureModuleDependencies(
@NotNull final HybrisModuleDescriptor moduleDescriptor,
@NotNull final Module module,
@NotNull final Collection<Module> allModules,
@NotNull final Set<HybrisModuleDescriptor> extModules,
final @NotNull IdeModifiableModelsProvider modifiableModelsProvider
) {
final ModifiableRootModel rootModel = modifiableModelsProvider.getModifiableRootModel(module);
for (HybrisModuleDescriptor dependency : moduleDescriptor.getDependenciesTree()) {
if (moduleDescriptor instanceof OotbHybrisModuleDescriptor) {
if (extModules.contains(dependency)) {
continue;
}
}
Optional<Module> targetDependencyModule = findModuleByNameIgnoreCase(allModules, dependency.getName());
final ModuleOrderEntry moduleOrderEntry = targetDependencyModule.isPresent()
? rootModel.addModuleOrderEntry(targetDependencyModule.get())
: rootModel.addInvalidModuleEntry(dependency.getName());
moduleOrderEntry.setExported(true);
moduleOrderEntry.setScope(DependencyScope.COMPILE);
}
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:26,代码来源:DefaultModulesDependenciesConfigurator.java
示例8: moveGradleModulesToGroup
import com.intellij.openapi.module.Module; //导入依赖的package包/类
private void moveGradleModulesToGroup(
final Project project,
final List<Module> gradleModules,
final String[] gradleGroup
) {
final ModifiableModuleModel modifiableModuleModel = ModuleManager.getInstance(project).getModifiableModel();
for (Module module : gradleModules) {
if (module == null) {
// https://youtrack.jetbrains.com/issue/IDEA-177512
continue;
}
module.setOption(HybrisConstants.DESCRIPTOR_TYPE, HybrisModuleDescriptorType.GRADLE.name());
modifiableModuleModel.setModuleGroupPath(module, gradleGroup);
}
AccessToken token = null;
try {
token = ApplicationManager.getApplication().acquireWriteActionLock(getClass());
modifiableModuleModel.commit();
} finally {
if (token != null) {
token.finish();
}
}
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:26,代码来源:DefaultGradleConfigurator.java
示例9: createModule
import com.intellij.openapi.module.Module; //导入依赖的package包/类
@NotNull
@Override
public Module createModule(@NotNull ModifiableModuleModel moduleModel) throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, JDOMException, ConfigurationException {
Module baseModule = super.createModule(moduleModel);
Project project = baseModule.getProject();
EduProjectGenerator generator = new EduProjectGenerator();
if (myCourse == null) {
File courseRoot = StudyUtils.getBundledCourseRoot(DEFAULT_COURSE_NAME, EduKotlinKoansModuleBuilder.class);
final Course course = generator.addLocalCourse(FileUtil.join(courseRoot.getPath(), DEFAULT_COURSE_NAME));
if (course == null) {
LOG.info("Failed to find course " + DEFAULT_COURSE_NAME);
return baseModule;
}
}
myCourse.setLanguage("kotlin");
EduModuleBuilderUtils.createCourseFromCourseInfo(moduleModel, project, generator, myCourse, getModuleFileDirectory());
return baseModule;
}
示例10: getParameters
import com.intellij.openapi.module.Module; //导入依赖的package包/类
@NotNull
public Parameters getParameters() {
if (parameters == null) {
parameters = new Parameters();
parameters.existingModuleNames = new HashSet<>();
if (isUpdate()) {
Project project = getCurrentProject();
if (project != null) {
for (Module module : ModuleManager.getInstance(project).getModules()) {
parameters.existingModuleNames.add(module.getName());
}
}
}
}
return parameters;
}
示例11: commit
import com.intellij.openapi.module.Module; //导入依赖的package包/类
@Nullable
@Override
public List<Module> commit(Project project,
ModifiableModuleModel modifiableModuleModel,
ModulesProvider modulesProvider,
ModifiableArtifactModel modifiableArtifactModel) {
logger.debug("Initializing module builder instance.");
ProcessingModuleBuilder processingModuleBuilder = new ProcessingModuleBuilder();
processingModuleBuilder.setGenerateTemplateSketchClass(false);
logger.debug("Creating modules for project '" + project + "' at path '" + getParameters().projectCreationRoot + "'.");
List<Module> modules = processingModuleBuilder.commit(project, modifiableModuleModel, modulesProvider);
Collection<VirtualFile> importablePdeFiles = new LinkedList<>(getParameters().importablePdeFiles);
logger.info("Identified a total of " + importablePdeFiles.size() + " PDE files for import from '" + getParameters().root + "'.");
ImportSketchClasses importSketchClasses = new ImportSketchClasses(this, project, modules, importablePdeFiles);
DumbService.getInstance(project).smartInvokeLater(importSketchClasses);
return modules;
}
示例12: removeOldProjectData
import com.intellij.openapi.module.Module; //导入依赖的package包/类
private static void removeOldProjectData(@NotNull final Project project) {
final ModifiableModuleModel moduleModel = ModuleManager.getInstance(project).getModifiableModel();
for (Module module : moduleModel.getModules()) {
moduleModel.disposeModule(module);
}
final LibraryTable.ModifiableModel libraryModel = ProjectLibraryTable.getInstance(project).getModifiableModel();
for (Library library : libraryModel.getLibraries()) {
libraryModel.removeLibrary(library);
}
ApplicationManager.getApplication().runWriteAction(() -> {
moduleModel.commit();
libraryModel.commit();
});
final GradleSupport gradleSupport = GradleSupport.getInstance();
if (gradleSupport != null) {
gradleSupport.clearLinkedProjectSettings(project);
}
final AntConfigurationBase antConfiguration = AntConfigurationBase.getInstance(project);
for (AntBuildFile antBuildFile : antConfiguration.getBuildFiles()) {
antConfiguration.removeBuildFile(antBuildFile);
}
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:27,代码来源:ProjectRefreshAction.java
示例13: fromFQN
import com.intellij.openapi.module.Module; //导入依赖的package包/类
@Nullable
public static ModuleDepDiagramItem fromFQN(@NotNull final String fqn, @NotNull final Project project) {
String moduleName = null;
boolean customExtension = false;
if (fqn.startsWith(MODULE_PREFIX)) {
moduleName = fqn.substring(MODULE_PREFIX.length());
customExtension = false;
} else if (fqn.startsWith(CUSTOM_MODULE_PREFIX)) {
moduleName = fqn.substring(CUSTOM_MODULE_PREFIX.length());
customExtension = true;
}
if (moduleName == null) {
return new ModuleDepDiagramItem(null, false);
}
final Module module = ModuleManager.getInstance(project).findModuleByName(moduleName);
return module == null ? null : new ModuleDepDiagramItem(module, customExtension);
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:19,代码来源:ModuleDepDiagramItem.java
示例14: createAdaptedEdges
import com.intellij.openapi.module.Module; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@NotNull
private List<ModuleDepDiagramEdge> createAdaptedEdges(@NotNull final Collection<ModulesUmlEdge> edges) {
final DiagramProvider provider = getBuilder().getProvider();
return edges
.stream()
.map(modulesUmlEdge -> {
final Module from = modulesUmlEdge.getSource().getIdentifyingElement().getModule();
final ModuleDepDiagramItem fromItem = new ModuleDepDiagramItem(from, isCustomExtension(from));
final Module to = modulesUmlEdge.getTarget().getIdentifyingElement().getModule();
final ModuleDepDiagramItem toItem = new ModuleDepDiagramItem(to, isCustomExtension(to));
return new ModuleDepDiagramEdge(
new ModuleDepDiagramNode(fromItem, provider),
new ModuleDepDiagramNode(toItem, provider),
modulesUmlEdge.getRelationship()
);
}).collect(Collectors.toList());
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:22,代码来源:ModuleDepDiagramDataModel.java
示例15: isCustomExtensionFile
import com.intellij.openapi.module.Module; //导入依赖的package包/类
public static boolean isCustomExtensionFile(@NotNull final VirtualFile file, @NotNull final Project project) {
final Module module = ModuleUtilCore.findModuleForFile(file, project);
if (null == module) {
return false;
}
final String descriptorTypeName = module.getOptionValue(HybrisConstants.DESCRIPTOR_TYPE);
if (descriptorTypeName == null) {
if (shouldCheckFilesWithoutHybrisSettings(project)) {
return estimateIsCustomExtension(file);
}
return false;
}
final HybrisModuleDescriptorType descriptorType = HybrisModuleDescriptorType.valueOf(descriptorTypeName);
return descriptorType == HybrisModuleDescriptorType.CUSTOM;
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:19,代码来源:TypeSystemValidationUtils.java