当前位置: 首页>>代码示例>>Java>>正文


Java MultiMap.create方法代码示例

本文整理汇总了Java中com.intellij.util.containers.MultiMap.create方法的典型用法代码示例。如果您正苦于以下问题:Java MultiMap.create方法的具体用法?Java MultiMap.create怎么用?Java MultiMap.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.util.containers.MultiMap的用法示例。


在下文中一共展示了MultiMap.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: stripAndMerge

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
boolean stripAndMerge(Collection<DfaMemoryStateImpl> group,
                           Function<DfaMemoryStateImpl, DfaMemoryStateImpl> stripper) {
  if (group.size() <= 1) return false;

  boolean hasMerges = false;
  MultiMap<DfaMemoryStateImpl, DfaMemoryStateImpl> strippedToOriginals = MultiMap.create();
  for (DfaMemoryStateImpl original : group) {
    strippedToOriginals.putValue(stripper.fun(original), original);
  }
  for (Map.Entry<DfaMemoryStateImpl, Collection<DfaMemoryStateImpl>> entry : strippedToOriginals.entrySet()) {
    Collection<DfaMemoryStateImpl> merged = entry.getValue();
    if (merged.size() > 1) {
      myRemovedStates.addAll(merged);
      myMerged.add(entry.getKey());
      hasMerges = true;
    }
  }
  return hasMerges;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:StateMerger.java

示例2: createOutputToArtifactMap

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
public static MultiMap<String, Artifact> createOutputToArtifactMap(final Project project) {
  final MultiMap<String, Artifact> result = MultiMap.create(FileUtil.PATH_HASHING_STRATEGY);
  new ReadAction() {
    protected void run(@NotNull final Result r) {
      for (Artifact artifact : ArtifactManager.getInstance(project).getArtifacts()) {
        String outputPath = artifact.getOutputFilePath();
        if (!StringUtil.isEmpty(outputPath)) {
          result.putValue(outputPath, artifact);
        }
      }
    }
  }.execute();


  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ArtifactCompilerUtil.java

示例3: RootIndex

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
public RootIndex(@NotNull Project project, @NotNull InfoCache cache) {
  myProject = project;
  myInfoCache = cache;
  final RootInfo info = buildRootInfo(project);

  MultiMap<String, VirtualFile> rootsByPackagePrefix = MultiMap.create();
  Set<VirtualFile> allRoots = info.getAllRoots();
  for (VirtualFile root : allRoots) {
    List<VirtualFile> hierarchy = getHierarchy(root, allRoots, info);
    Pair<DirectoryInfo, String> pair = hierarchy != null
                                       ? calcDirectoryInfo(root, hierarchy, info)
                                       : new Pair<DirectoryInfo, String>(NonProjectDirectoryInfo.IGNORED, null);
    cacheInfos(root, root, pair.first);
    rootsByPackagePrefix.putValue(pair.second, root);
    myPackagePrefixByRoot.put(root, pair.second);
  }
  myPackageDirectoryCache = new PackageDirectoryCache(rootsByPackagePrefix) {
    @Override
    protected boolean isPackageDirectory(@NotNull VirtualFile dir, @NotNull String packageName) {
      return getInfoForFile(dir).isInProject() && packageName.equals(getPackageName(dir));
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:RootIndex.java

示例4: collectVariables

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
/**
 * @return map: scope -> variables defined in the scope
 */
@NotNull
private static MultiMap<PsiElement, GrVariable> collectVariables(@NotNull GroovyPsiElement scope) {
  final MultiMap<PsiElement, GrVariable> scopes = MultiMap.create();
  scope.accept(new GroovyRecursiveElementVisitor() {
    @Override
    public void visitVariable(GrVariable variable) {
      super.visitVariable(variable);
      if (!(variable instanceof PsiField) && variable.hasModifierProperty(PsiModifier.FINAL)) {
        final PsiElement varScope = findScope(variable);
        if (varScope != null) {
          scopes.putValue(varScope, variable);
        }
      }
    }
  });
  return scopes;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:GrFinalVariableAccessInspection.java

示例5: create

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@NotNull
private static MultiMap<String, ArchivedProjectTemplate> create(@NotNull Element element) throws IOException, JDOMException {
  MultiMap<String, ArchivedProjectTemplate> map = MultiMap.create();
  for (ArchivedProjectTemplate template : createGroupTemplates(element)) {
    map.putValue(template.getCategory(), template);
  }
  return map;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:RemoteTemplatesFactory.java

示例6: getCommitsAround

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@NotNull
private static MultiMap<VirtualFile, Integer> getCommitsAround(int selectedRow,
                                                               @NotNull GraphTableModel model,
                                                               int above,
                                                               int below) {
  MultiMap<VirtualFile, Integer> commits = MultiMap.create();
  for (int row = Math.max(0, selectedRow - above); row < selectedRow + below && row < model.getRowCount(); row++) {
    Integer hash = model.getCommitIdAtRow(row);
    VirtualFile root = model.getRoot(row);
    commits.putValue(root, hash);
  }
  return commits;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:AbstractDataGetter.java

示例7: groupRootsByVcs

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@NotNull
private static MultiMap<VcsKey, VirtualFile> groupRootsByVcs(@NotNull Map<VirtualFile, VcsLogProvider> providers) {
  MultiMap<VcsKey, VirtualFile> result = MultiMap.create();
  for (Map.Entry<VirtualFile, VcsLogProvider> entry : providers.entrySet()) {
    VirtualFile root = entry.getKey();
    VcsKey vcs = entry.getValue().getSupportedVcs();
    result.putValue(vcs, root);
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:VcsLogRepoSizeCollector.java

示例8: createNodes

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@NotNull
public List<ExternalSystemNode<?>> createNodes(@NotNull ExternalProjectsView externalProjectsView,
                                               @Nullable ExternalSystemNode<?> parent,
                                               @NotNull DataNode<?> dataNode) {
  final List<ExternalSystemNode<?>> result = new SmartList<ExternalSystemNode<?>>();
  final MultiMap<Key<?>, DataNode<?>> groups = ExternalSystemApiUtil.group(dataNode.getChildren());
  for (ExternalSystemViewContributor contributor : ExternalSystemViewContributor.EP_NAME.getExtensions()) {
    Set<Key<?>> keys = ContainerUtil.newTreeSet(contributor.getKeys());

    final MultiMap<Key<?>, DataNode<?>> dataNodes = MultiMap.create();
    for (Key<?> key : keys) {
      final Collection<DataNode<?>> values = groups.get(key);
      if(key != null) {
        dataNodes.put(key, values);
      }
    }

    if (dataNodes.isEmpty()) continue;

    final List<ExternalSystemNode<?>> childNodes = contributor.createNodes(externalProjectsView, dataNodes);
    result.addAll(childNodes);

    if (parent == null) continue;

    for (ExternalSystemNode childNode : childNodes) {
      childNode.setParent(parent);
    }
  }

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:ExternalProjectsViewImpl.java

示例9: computeOrphanData

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@NotNull
@Override
public Computable<Collection<I>> computeOrphanData(@NotNull final Collection<DataNode<E>> toImport,
                                                   @NotNull final ProjectData projectData,
                                                   @NotNull final Project project,
                                                   @NotNull final IdeModifiableModelsProvider modelsProvider) {
  return new Computable<Collection<I>>() {
    @Override
    public Collection<I> compute() {
      MultiMap<String /*module name*/, String /*dep name*/> byModuleName = MultiMap.create();
      for (DataNode<E> node : toImport) {
        final AbstractDependencyData data = node.getData();
        byModuleName.putValue(data.getOwnerModule().getInternalName(), data.getInternalName());
      }

      List<I> orphanEntries = ContainerUtil.newSmartList();
      for (Module module : modelsProvider.getModules(projectData)) {
        for (OrderEntry entry : modelsProvider.getOrderEntries(module)) {
          //noinspection unchecked
          if (getOrderEntryType().isInstance(entry) &&
              !byModuleName.get(entry.getOwnerModule().getName()).contains(getOrderEntryName((I)entry))) {
            //noinspection unchecked
            orphanEntries.add((I)entry);
          }
        }
      }

      return orphanEntries;
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:AbstractDependencyDataService.java

示例10: groupByRootWithCheck

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@Nullable
private MultiMap<Repo, VcsFullCommitDetails> groupByRootWithCheck(@NotNull Project project, @NotNull List<VcsFullCommitDetails> commits) {
  MultiMap<Repo, VcsFullCommitDetails> map = MultiMap.create();
  for (VcsFullCommitDetails commit : commits) {
    Repo root = getRepositoryForRoot(project, commit.getRoot());
    if (root == null) { // commit from some other VCS
      return null;
    }
    map.putValue(root, commit);
  }
  return map;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:VcsLogAction.java

示例11: PostfixTemplatesConfigurable

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public PostfixTemplatesConfigurable() {
  PostfixTemplatesSettings settings = PostfixTemplatesSettings.getInstance();
  if (settings == null) {
    throw new RuntimeException("Can't retrieve postfix template settings");
  }

  myTemplatesSettings = settings;

  LanguageExtensionPoint[] extensions = new ExtensionPointName<LanguageExtensionPoint>(LanguagePostfixTemplate.EP_NAME).getExtensions();


  templateMultiMap = MultiMap.create();
  for (LanguageExtensionPoint extension : extensions) {
    List<PostfixTemplate> postfixTemplates =
      ContainerUtil.newArrayList(((PostfixTemplateProvider)extension.getInstance()).getTemplates());
    if (postfixTemplates.isEmpty()) {
      continue;
    }

    ContainerUtil.sort(postfixTemplates, TEMPLATE_COMPARATOR);

    templateMultiMap.putValues(extension.getKey(), postfixTemplates);
  }

  myPostfixTemplatesEnabled.addChangeListener(new ChangeListener() {
    @Override
    public void stateChanged(ChangeEvent e) {
      updateComponents();
    }
  });
  myShortcutComboBox.addItem(TAB);
  myShortcutComboBox.addItem(SPACE);
  myShortcutComboBox.addItem(ENTER);

  myDescriptionPanel.setLayout(new BorderLayout());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:PostfixTemplatesConfigurable.java

示例12: getCustomTemplatesLookupItems

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
public static MultiMap<String, CustomLiveTemplateLookupElement> getCustomTemplatesLookupItems(@NotNull Editor editor,
                                                                                              @NotNull PsiFile file,
                                                                                              int offset) {
  final MultiMap<String, CustomLiveTemplateLookupElement> result = MultiMap.create();
  CustomTemplateCallback customTemplateCallback = new CustomTemplateCallback(editor, file);
  for (CustomLiveTemplate customLiveTemplate : TemplateManagerImpl.listApplicableCustomTemplates(editor, file, false)) {
    if (customLiveTemplate instanceof CustomLiveTemplateBase) {
      String customTemplatePrefix = ((CustomLiveTemplateBase)customLiveTemplate).computeTemplateKeyWithoutContextChecking(customTemplateCallback);
      if (customTemplatePrefix != null) {
        result.putValues(customTemplatePrefix, ((CustomLiveTemplateBase)customLiveTemplate).getLookupElements(file, editor, offset));
      }
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ListTemplatesHandler.java

示例13: computeCompilersToRunAndInvalidateLocalAttributesMap

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@NotNull
private MultiMap<Module, AndroidAutogeneratorMode> computeCompilersToRunAndInvalidateLocalAttributesMap() {
  if (myProject.isDisposed()) {
    return MultiMap.emptyInstance();
  }
  final MultiMap<Module, AndroidAutogeneratorMode> result = MultiMap.create();
  final Set<Module> modulesToInvalidateAttributeDefs = new HashSet<Module>();

  for (VirtualFile file : myFiles) {
    final Module module = ModuleUtilCore.findModuleForFile(file, myProject);

    if (module == null || module.isDisposed()) {
      continue;
    }
    final AndroidFacet facet = AndroidFacet.getInstance(module);

    if (facet == null) {
      continue;
    }
    final VirtualFile parent = file.getParent();
    final VirtualFile gp = parent != null ? parent.getParent() : null;
    final VirtualFile resourceDir = AndroidRootUtil.getResourceDir(facet);

    if (gp != null &&
        Comparing.equal(gp, resourceDir) &&
        ResourceFolderType.VALUES.getName().equals(AndroidCommonUtils.getResourceTypeByDirName(parent.getName()))) {
      modulesToInvalidateAttributeDefs.add(module);
    }
    final List<AndroidAutogeneratorMode> modes = computeCompilersToRunAndInvalidateLocalAttributesMap(facet, file);

    if (modes.size() > 0) {
      result.putValues(module, modes);
    }
  }
  invalidateAttributeDefinitions(modulesToInvalidateAttributeDefs);
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:AndroidResourceFilesListener.java

示例14: groupByResult

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@NotNull
private static MultiMap<String, GitRepository> groupByResult(@NotNull Map<GitRepository, GitCommandResult> results) {
  MultiMap<String, GitRepository> grouped = MultiMap.create();
  for (Map.Entry<GitRepository, GitCommandResult> entry : results.entrySet()) {
    grouped.putValue(entry.getValue().getErrorOutputAsHtmlString(), entry.getKey());
  }
  return grouped;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:GitResetOperation.java

示例15: groupRefsByRoot

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@NotNull
private static MultiMap<VirtualFile, VcsRef> groupRefsByRoot(@NotNull Iterable<VcsRef> refs) {
  MultiMap<VirtualFile, VcsRef> grouped = MultiMap.create();
  for (VcsRef ref : refs) {
    grouped.putValue(ref.getRoot(), ref);
  }
  return grouped;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:GitRefManager.java


注:本文中的com.intellij.util.containers.MultiMap.create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。