當前位置: 首頁>>代碼示例>>Java>>正文


Java Module類代碼示例

本文整理匯總了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;
}
 
開發者ID:1tontech,項目名稱:intellij-spring-assistant,代碼行數:20,代碼來源:SuggestionIndexServiceImpl.java

示例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;
}
 
開發者ID:manifold-systems,項目名稱:manifold-ij,代碼行數:17,代碼來源:ManProject.java

示例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;
}
 
開發者ID:andreyfomenkov,項目名稱:green-cat,代碼行數:27,代碼來源:Utils.java

示例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;
}
 
開發者ID:manifold-systems,項目名稱:manifold-ij,代碼行數:18,代碼來源:ManProject.java

示例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;
}
 
開發者ID:manifold-systems,項目名稱:manifold-ij,代碼行數:24,代碼來源:ExtensionClassAnnotator.java

示例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;
}
 
開發者ID:manifold-systems,項目名稱:manifold-ij,代碼行數:19,代碼來源:ManProject.java

示例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;
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:19,代碼來源:EduKotlinKoansModuleBuilder.java

示例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;
}
 
開發者ID:mistodev,項目名稱:processing-idea,代碼行數:18,代碼來源:ProcessingImportBuilder.java

示例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;
}
 
開發者ID:mistodev,項目名稱:processing-idea,代碼行數:25,代碼來源:ProcessingImportBuilder.java

示例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


注:本文中的com.intellij.openapi.module.Module類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。