use of com.intellij.util.containers.hash.HashSet in project intellij-community by JetBrains.
the class ChangeSignatureProcessorBase method filterUsages.
protected static List<UsageInfo> filterUsages(List<UsageInfo> infos) {
Map<PsiElement, MoveRenameUsageInfo> moveRenameInfos = new HashMap<>();
Set<PsiElement> usedElements = new HashSet<>();
List<UsageInfo> result = new ArrayList<>(infos.size() / 2);
for (UsageInfo info : infos) {
LOG.assertTrue(info != null);
PsiElement element = info.getElement();
if (info instanceof MoveRenameUsageInfo) {
if (usedElements.contains(element))
continue;
moveRenameInfos.put(element, (MoveRenameUsageInfo) info);
} else {
moveRenameInfos.remove(element);
usedElements.add(element);
if (!(info instanceof PossiblyIncorrectUsage) || ((PossiblyIncorrectUsage) info).isCorrect()) {
result.add(info);
}
}
}
result.addAll(moveRenameInfos.values());
return result;
}
use of com.intellij.util.containers.hash.HashSet in project intellij-community by JetBrains.
the class MavenDomProjectProcessorUtils method searchDependencyUsages.
@NotNull
public static Set<MavenDomDependency> searchDependencyUsages(@NotNull final MavenDomProjectModel model, @NotNull final DependencyConflictId dependencyId, @NotNull final Set<MavenDomDependency> excludes) {
Project project = model.getManager().getProject();
final Set<MavenDomDependency> usages = new HashSet<>();
Processor<MavenDomProjectModel> collectProcessor = mavenDomProjectModel -> {
for (MavenDomDependency domDependency : mavenDomProjectModel.getDependencies().getDependencies()) {
if (excludes.contains(domDependency))
continue;
if (dependencyId.equals(DependencyConflictId.create(domDependency))) {
usages.add(domDependency);
}
}
return false;
};
processChildrenRecursively(model, collectProcessor, project, new HashSet<>(), true);
return usages;
}
use of com.intellij.util.containers.hash.HashSet in project intellij-community by JetBrains.
the class MavenDomProjectProcessorUtils method processParentProjects.
public static void processParentProjects(@NotNull final MavenDomProjectModel projectDom, @NotNull final Processor<MavenDomProjectModel> processor) {
Set<MavenDomProjectModel> processed = new HashSet<>();
Project project = projectDom.getManager().getProject();
MavenDomProjectModel parent = findParent(projectDom, project);
while (parent != null) {
if (processed.contains(parent))
break;
processed.add(parent);
if (processor.process(parent))
break;
parent = findParent(parent, project);
}
}
use of com.intellij.util.containers.hash.HashSet in project intellij-community by JetBrains.
the class MavenDuplicateDependenciesInspection method addProblem.
private static void addProblem(@NotNull MavenDomDependency dependency, @NotNull Collection<MavenDomDependency> dependencies, @NotNull DomElementAnnotationHolder holder) {
StringBuilder sb = new StringBuilder();
Set<MavenDomProjectModel> processed = new HashSet<>();
for (MavenDomDependency domDependency : dependencies) {
if (dependency.equals(domDependency))
continue;
MavenDomProjectModel model = domDependency.getParentOfType(MavenDomProjectModel.class, false);
if (model != null && !processed.contains(model)) {
if (processed.size() > 0)
sb.append(", ");
sb.append(createLinkText(model, domDependency));
processed.add(model);
}
}
holder.createProblem(dependency, HighlightSeverity.WARNING, MavenDomBundle.message("MavenDuplicateDependenciesInspection.has.duplicates", sb.toString()));
}
use of com.intellij.util.containers.hash.HashSet in project intellij-community by JetBrains.
the class MavenDomProjectProcessorUtils method searchManagedPluginUsages.
@NotNull
public static Collection<MavenDomPlugin> searchManagedPluginUsages(@NotNull final MavenDomProjectModel model, @Nullable final String groupId, @NotNull final String artifactId) {
Project project = model.getManager().getProject();
final Set<MavenDomPlugin> usages = new HashSet<>();
Processor<MavenDomProjectModel> collectProcessor = mavenDomProjectModel -> {
for (MavenDomPlugin domPlugin : mavenDomProjectModel.getBuild().getPlugins().getPlugins()) {
if (MavenPluginDomUtil.isPlugin(domPlugin, groupId, artifactId)) {
usages.add(domPlugin);
}
}
return false;
};
processChildrenRecursively(model, collectProcessor, project, new HashSet<>(), true);
return usages;
}
Aggregations