本文整理汇总了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;
}
示例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;
}
示例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));
}
};
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
};
}
示例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;
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}