本文整理汇总了Java中com.intellij.util.containers.MultiMap类的典型用法代码示例。如果您正苦于以下问题:Java MultiMap类的具体用法?Java MultiMap怎么用?Java MultiMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MultiMap类属于com.intellij.util.containers包,在下文中一共展示了MultiMap类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: computeChildren
import com.intellij.util.containers.MultiMap; //导入依赖的package包/类
@Override
protected MultiMap<PsiFile, T> computeChildren(@Nullable PsiFile psiFile) {
MultiMap<PsiFile, T> children = new MultiMap<>();
Project project = getProject();
if (project != null) {
JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(project);
PsiClass serviceAnnotation = javaPsiFacade.findClass(getAnnotationQName(), GlobalSearchScope.allScope(project));
if (serviceAnnotation != null) {
AnnotatedElementsSearch.searchPsiClasses(serviceAnnotation, GlobalSearchScope.allScope(project)).forEach(psiClass -> {
if (psiClass.isInterface() && isSatisfying(psiClass)) {
children.putValue(psiClass.getContainingFile(), createChild(psiClass));
}
return true;
});
}
}
return children;
}
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:19,代码来源:AnnotatedInterfaceNode.java
示例2: computeChildren
import com.intellij.util.containers.MultiMap; //导入依赖的package包/类
@Override
protected MultiMap<PsiFile, ClassNode> computeChildren(@Nullable PsiFile psiFile) {
MultiMap<PsiFile, ClassNode> children = new MultiMap<>();
children.putValue(aggregateRoot.getContainingFile(), new AggregateRootNode(this, aggregateRoot));
Project project = getProject();
if (project != null) {
JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(project);
PsiClass entityInterface = javaPsiFacade.findClass(ENTITY_INTERFACE, GlobalSearchScope.allScope(project));
PsiClass valueObjectInterface = javaPsiFacade.findClass(VO_INTERFACE, GlobalSearchScope.allScope(project));
if (entityInterface != null && valueObjectInterface != null) {
for (PsiClass psiClass : psiPackage.getClasses(GlobalSearchScope.allScope(project))) {
if (psiClass.isInheritor(entityInterface, true) && !psiClass.equals(aggregateRoot)) {
children.putValue(psiClass.getContainingFile(), new EntityNode(this, psiClass));
} else if (psiClass.isInheritor(valueObjectInterface, true)) {
children.putValue(psiClass.getContainingFile(), new ValueObjectNode(this, psiClass));
}
}
}
}
return children;
}
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:22,代码来源:AggregateNode.java
示例3: computeChildren
import com.intellij.util.containers.MultiMap; //导入依赖的package包/类
@Override
protected MultiMap computeChildren(@Nullable PsiFile psiFile) {
MultiMap<PsiFile, AggregateNode> children = new MultiMap<>();
Project project = getProject();
if (project != null) {
JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(project);
PsiClass psiClass = javaPsiFacade.findClass(AGGREGATE_ROOT_INTERFACE, GlobalSearchScope.allScope(project));
if (psiClass != null) {
ClassInheritorsSearch.search(psiClass, GlobalSearchScope.allScope(project), true).forEach(candidate -> {
String qualifiedName = candidate.getQualifiedName();
if (qualifiedName != null && !qualifiedName.startsWith(BUSINESS_PACKAGE) && !isAbstract(candidate)) {
children.putValue(candidate.getContainingFile(), new AggregateNode(this, candidate));
}
});
}
}
return children;
}
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:20,代码来源:AggregatesNode.java
示例4: computeChildren
import com.intellij.util.containers.MultiMap; //导入依赖的package包/类
@Override
public MultiMap<PsiFile, ResourceNode> computeChildren(PsiFile psiFile) {
Project project = getProject();
MultiMap<PsiFile, ResourceNode> children = new MultiMap<>();
if (project != null) {
JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(project);
PsiClass pathAnnotation = javaPsiFacade.findClass(PATH_ANNOTATION, GlobalSearchScope.allScope(project));
if (pathAnnotation != null) {
AnnotatedElementsSearch.searchPsiClasses(pathAnnotation, GlobalSearchScope.allScope(project)).forEach(psiClass -> {
if (!psiClass.isInterface() && !NavigatorUtil.isAbstract(psiClass)) {
children.putValue(psiClass.getContainingFile(), new ResourceNode(ResourcesNode.this, pathAnnotation, psiClass));
}
return true;
});
}
}
return children;
}
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:19,代码来源:ResourcesNode.java
示例5: computeChildren
import com.intellij.util.containers.MultiMap; //导入依赖的package包/类
protected MultiMap<PsiFile, ToolNode> computeChildren(PsiFile psiFile) {
MultiMap<PsiFile, ToolNode> children = new MultiMap<>();
Project project = getProject();
if (project != null) {
PsiClass toolInterface = JavaPsiFacade.getInstance(project).findClass(TOOL_INTERFACE, GlobalSearchScope.allScope(project));
if (toolInterface != null) {
ClassInheritorsSearch.search(toolInterface, GlobalSearchScope.allScope(project), true).forEach(psiClass -> {
PsiFile containingFile = psiClass.getContainingFile();
if (!isAbstract(psiClass)) {
children.putValue(containingFile, new ToolNode(this, psiClass));
}
});
}
}
return children;
}
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:17,代码来源:ToolsNode.java
示例6: importData
import com.intellij.util.containers.MultiMap; //导入依赖的package包/类
@Override
public void importData(@NotNull Collection<DataNode<LibraryDependencyData>> toImport,
@Nullable ProjectData projectData,
@NotNull Project project,
@NotNull IdeModifiableModelsProvider modelsProvider) {
if (toImport.isEmpty()) {
return;
}
MultiMap<DataNode<ModuleData>, DataNode<LibraryDependencyData>> byModule = ExternalSystemApiUtil.groupBy(toImport, MODULE);
for (Map.Entry<DataNode<ModuleData>, Collection<DataNode<LibraryDependencyData>>> entry : byModule.entrySet()) {
Module module = modelsProvider.findIdeModule(entry.getKey().getData());
if (module == null) {
LOG.warn(String.format(
"Can't import library dependencies %s. Reason: target module (%s) is not found at the ide and can't be imported",
entry.getValue(), entry.getKey()
));
continue;
}
importData(entry.getValue(), module, modelsProvider);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:LibraryDependencyDataService.java
示例7: GroovyInplaceFieldValidator
import com.intellij.util.containers.MultiMap; //导入依赖的package包/类
public GroovyInplaceFieldValidator(GrIntroduceContext context) {
super(context, new ConflictReporter() {
@Override
public void check(PsiElement toCheck, MultiMap<PsiElement, String> conflicts, String varName) {
if (toCheck instanceof GrVariable && varName.equals(((GrVariable)toCheck).getName())) {
conflicts.putValue(toCheck, GroovyRefactoringBundle.message("field.0.is.already.defined", CommonRefactoringUtil.htmlEmphasize(varName)));
}
if (toCheck instanceof GrMethod) {
if (GroovyPropertyUtils.isSimplePropertyAccessor((PsiMethod)toCheck) &&
varName.equals(GroovyPropertyUtils.getPropertyNameByAccessorName(((PsiMethod)toCheck).getName()))) {
conflicts.putValue(toCheck, GroovyRefactoringBundle
.message("access.to.created.field.0.will.be.overriden.by.method.1", CommonRefactoringUtil.htmlEmphasize(varName),
CommonRefactoringUtil.htmlEmphasize(DescriptiveNameUtil.getDescriptiveName(toCheck))));
}
}
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GroovyInplaceFieldValidator.java
示例8: buildVisitor
import com.intellij.util.containers.MultiMap; //导入依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) {
return new SchemaVisitor() {
@Override
public void visitImports(@NotNull SchemaImports schemaTypeImports) {
super.visitImports(schemaTypeImports);
List<SchemaImportStatement> imports = schemaTypeImports.getImportStatementList();
MultiMap<Qn, SchemaImportStatement> importsByQn = ImportsManager.getImportsByQn(imports);
for (Map.Entry<Qn, Collection<SchemaImportStatement>> entry : importsByQn.entrySet()) {
entry.getValue().stream()
.filter(is -> DEFAULT_IMPORTS_LIST.contains(entry.getKey()))
.forEach(is -> holder.registerProblem(is,
InspectionBundle.message("import.unnecessary.problem.descriptor"),
ProblemHighlightType.LIKE_UNUSED_SYMBOL,
OptimizeImportsQuickFix.INSTANCE));
}
}
};
}
开发者ID:SumoLogic,项目名称:epigraph,代码行数:23,代码来源:UnnecessaryImportInspection.java
示例9: 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
示例10: getAllExistingTasks
import com.intellij.util.containers.MultiMap; //导入依赖的package包/类
@Override
public TaskInfo[] getAllExistingTasks() {
List<R> repositories = myRepositoryManager.getRepositories();
MultiMap<String, String> tasks = new MultiMap<String, String>();
for (R repository : repositories) {
for (String branch : getAllBranches(repository)) {
tasks.putValue(branch, repository.getPresentableUrl());
}
}
return ContainerUtil.map2Array(tasks.entrySet(), TaskInfo.class, new Function<Map.Entry<String, Collection<String>>, TaskInfo>() {
@Override
public TaskInfo fun(Map.Entry<String, Collection<String>> entry) {
return new TaskInfo(entry.getKey(), entry.getValue());
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:DvcsTaskHandler.java
示例11: walk
import com.intellij.util.containers.MultiMap; //导入依赖的package包/类
private static void walk(File root, MultiMap<Couple<Integer>, String> dimToPath, File file) throws IOException {
if (file.isDirectory()) {
for (File child : file.listFiles()) {
walk(root, dimToPath, child);
}
}
else {
if (IMAGE_EXTENSIONS.contains(FileUtilRt.getExtension(file.getName()))) {
String relativePath = file.getAbsolutePath().substring(root.getAbsolutePath().length() + 1);
Image image = loadImage(file);
File target;
int width = image.getWidth(null);
int height = image.getHeight(null);
if (height != width && (height > 100 || width > 100)) {
target = new File("/Users/max/images/other", relativePath);
}
else {
target = new File("/Users/max/images/icons", relativePath);
dimToPath.putValue(new Couple<Integer>(width, height), relativePath);
}
FileUtil.copy(file, target);
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:BuildIcons.java
示例12: getAllPackagePrefixes
import com.intellij.util.containers.MultiMap; //导入依赖的package包/类
public Collection<String> getAllPackagePrefixes(@Nullable GlobalSearchScope scope) {
MultiMap<String, Module> map = myMap;
if (map != null) {
return getAllPackagePrefixes(scope, map);
}
map = new MultiMap<String, Module>();
for (final Module module : ModuleManager.getInstance(myProject).getModules()) {
for (final ContentEntry entry : ModuleRootManager.getInstance(module).getContentEntries()) {
for (final SourceFolder folder : entry.getSourceFolders(JavaModuleSourceRootTypes.SOURCES)) {
final String prefix = folder.getPackagePrefix();
if (StringUtil.isNotEmpty(prefix)) {
map.putValue(prefix, module);
}
}
}
}
synchronized (LOCK) {
if (myMap == null) {
myMap = map;
}
return getAllPackagePrefixes(scope, myMap);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:PackagePrefixIndex.java
示例13: calcOrderEntries
import com.intellij.util.containers.MultiMap; //导入依赖的package包/类
private static OrderEntry[] calcOrderEntries(@NotNull RootInfo info,
@NotNull MultiMap<VirtualFile, OrderEntry> depEntries,
@NotNull MultiMap<VirtualFile, OrderEntry> libClassRootEntries,
@NotNull MultiMap<VirtualFile, OrderEntry> libSourceRootEntries,
@NotNull List<VirtualFile> hierarchy) {
@Nullable VirtualFile libraryClassRoot = info.findLibraryRootInfo(hierarchy, false);
@Nullable VirtualFile librarySourceRoot = info.findLibraryRootInfo(hierarchy, true);
Set<OrderEntry> orderEntries = ContainerUtil.newLinkedHashSet();
orderEntries
.addAll(info.getLibraryOrderEntries(hierarchy, libraryClassRoot, librarySourceRoot, libClassRootEntries, libSourceRootEntries));
for (VirtualFile root : hierarchy) {
orderEntries.addAll(depEntries.get(root));
}
VirtualFile moduleContentRoot = info.findModuleRootInfo(hierarchy);
if (moduleContentRoot != null) {
ContainerUtil.addIfNotNull(orderEntries, info.getModuleSourceEntry(hierarchy, moduleContentRoot, libClassRootEntries));
}
if (orderEntries.isEmpty()) {
return null;
}
OrderEntry[] array = orderEntries.toArray(new OrderEntry[orderEntries.size()]);
Arrays.sort(array, BY_OWNER_MODULE);
return array;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:RootIndex.java
示例14: getModuleIndex
import com.intellij.util.containers.MultiMap; //导入依赖的package包/类
private static ModuleIndex getModuleIndex(final Project project) {
return CachedValuesManager.getManager(project).getCachedValue(project, new CachedValueProvider<ModuleIndex>() {
@Nullable
@Override
public Result<ModuleIndex> compute() {
ModuleIndex index = new ModuleIndex();
for (Module module : ModuleManager.getInstance(project).getModules()) {
for (OrderEntry orderEntry : ModuleRootManager.getInstance(module).getOrderEntries()) {
if (orderEntry instanceof ModuleOrderEntry) {
Module referenced = ((ModuleOrderEntry)orderEntry).getModule();
if (referenced != null) {
MultiMap<Module, Module> map = ((ModuleOrderEntry)orderEntry).isExported() ? index.exportingUsages : index.plainUsages;
map.putValue(referenced, module);
}
}
}
}
return Result.create(index, ProjectRootManager.getInstance(project));
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ModuleWithDependentsScope.java
示例15: analyzeModuleConflicts
import com.intellij.util.containers.MultiMap; //导入依赖的package包/类
public static void analyzeModuleConflicts(final Project project,
final Collection<? extends PsiElement> scopes,
final UsageInfo[] usages,
final PsiElement target,
final MultiMap<PsiElement,String> conflicts) {
if (scopes == null) return;
final VirtualFile vFile = PsiUtilCore.getVirtualFile(target);
if (vFile == null) return;
List<GroovyPsiElement> groovyScopes =
ContainerUtil.collect(scopes.iterator(), new FilteringIterator.InstanceOf<GroovyPsiElement>(GroovyPsiElement.class));
analyzeModuleConflicts(project, groovyScopes, usages, vFile, conflicts);
scopes.removeAll(groovyScopes);
RefactoringConflictsUtil.analyzeModuleConflicts(project, scopes, usages, vFile, conflicts);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:GrRefactoringConflictsUtil.java
示例16: VcsAnnotationLocalChangesListenerImpl
import com.intellij.util.containers.MultiMap; //导入依赖的package包/类
public VcsAnnotationLocalChangesListenerImpl(Project project, final ProjectLevelVcsManager vcsManager) {
myLock = new Object();
myUpdateStuff = createUpdateStuff();
myUpdater = new ZipperUpdater(ApplicationManager.getApplication().isUnitTestMode() ? 10 : 300, Alarm.ThreadToUse.POOLED_THREAD, project);
myConnection = project.getMessageBus().connect();
myLocalFileSystem = LocalFileSystem.getInstance();
VcsAnnotationRefresher handler = createHandler();
myDirtyPaths = new HashSet<String>();
myDirtyChanges = new HashMap<String, VcsRevisionNumber>();
myDirtyFiles = new HashSet<VirtualFile>();
myFileAnnotationMap = MultiMap.createSet();
myVcsManager = vcsManager;
myVcsKeySet = new HashSet<VcsKey>();
myConnection.subscribe(VcsAnnotationRefresher.LOCAL_CHANGES_CHANGED, handler);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:VcsAnnotationLocalChangesListenerImpl.java
示例17: ChainCompletionContext
import com.intellij.util.containers.MultiMap; //导入依赖的package包/类
ChainCompletionContext(final TargetType target,
final Set<String> containingClassQNames,
final MultiMap<String, PsiVariable> contextVars,
final MultiMap<String, PsiMethod> containingClassGetters,
final MultiMap<String, ContextRelevantVariableGetter> contextVarsGetters,
final Map<String, PsiVariable> stringVars,
final Set<String> excludedQNames,
final Project project,
final GlobalSearchScope resolveScope) {
myTarget = target;
myContainingClassQNames = containingClassQNames;
myContextVars = contextVars;
myContainingClassGetters = containingClassGetters;
myContextVarsGetters = contextVarsGetters;
myStringVars = stringVars;
myExcludedQNames = excludedQNames;
myResolveScope = resolveScope;
myProject = project;
myPsiManager = PsiManager.getInstance(project);
myNotDeprecatedMethodsResolver = new MethodIncompleteSignatureResolver(JavaPsiFacade.getInstance(project), resolveScope);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ChainCompletionContext.java
示例18: collectConflicts
import com.intellij.util.containers.MultiMap; //导入依赖的package包/类
public static void collectConflicts(final PsiReference reference,
final PsiElement element,
final Map<Language, InlineHandler.Inliner> inliners,
final MultiMap<PsiElement, String> conflicts) {
final PsiElement referenceElement = reference.getElement();
if (referenceElement == null) return;
final Language language = referenceElement.getLanguage();
final InlineHandler.Inliner inliner = inliners.get(language);
if (inliner != null) {
final MultiMap<PsiElement, String> refConflicts = inliner.getConflicts(reference, element);
if (refConflicts != null) {
for (PsiElement psiElement : refConflicts.keySet()) {
conflicts.putValues(psiElement, refConflicts.get(psiElement));
}
}
}
else {
conflicts.putValue(referenceElement, "Cannot inline reference from " + language.getDisplayName());
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:GenericInlineHandler.java
示例19: DetectedFrameworksData
import com.intellij.util.containers.MultiMap; //导入依赖的package包/类
public DetectedFrameworksData(Project project) {
myDetectedFrameworks = new MultiMap<Integer, DetectedFrameworkDescription>();
File file = new File(FrameworkDetectorRegistryImpl.getDetectionDirPath() + File.separator + project.getName() + "." + project.getLocationHash() +
File.separator + "files");
myNewFiles = new TIntObjectHashMap<TIntHashSet>();
try {
myExistentFrameworkFiles = new PersistentHashMap<Integer, TIntHashSet>(file, EnumeratorIntegerDescriptor.INSTANCE, new TIntHashSetExternalizer());
}
catch (IOException e) {
LOG.info(e);
PersistentHashMap.deleteFilesStartingWith(file);
try {
myExistentFrameworkFiles = new PersistentHashMap<Integer, TIntHashSet>(file, EnumeratorIntegerDescriptor.INSTANCE, new TIntHashSetExternalizer());
}
catch (IOException e1) {
LOG.error(e1);
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:DetectedFrameworksData.java
示例20: groupRefsByRoot
import com.intellij.util.containers.MultiMap; //导入依赖的package包/类
@NotNull
public static MultiMap<VirtualFile, VcsRef> groupRefsByRoot(@NotNull Collection<VcsRef> refs) {
MultiMap<VirtualFile, VcsRef> map = new MultiMap<VirtualFile, VcsRef>() {
@NotNull
@Override
protected Map<VirtualFile, Collection<VcsRef>> createMap() {
return new TreeMap<VirtualFile, Collection<VcsRef>>(new Comparator<VirtualFile>() { // TODO common to VCS root sorting method
@Override
public int compare(VirtualFile o1, VirtualFile o2) {
return o1.getPresentableUrl().compareTo(o2.getPresentableUrl());
}
});
}
};
for (VcsRef ref : refs) {
map.putValue(ref.getRoot(), ref);
}
return map;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:VcsLogUtil.java
注:本文中的com.intellij.util.containers.MultiMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论