Search in sources :

Example 1 with MavenDomDependencies

use of org.jetbrains.idea.maven.dom.model.MavenDomDependencies in project intellij-community by JetBrains.

the class MavenNavigationUtil method findDependency.

@Nullable
public static MavenDomDependency findDependency(@NotNull MavenDomProjectModel projectDom, final String groupId, final String artifactId) {
    MavenDomProjectProcessorUtils.SearchProcessor<MavenDomDependency, MavenDomDependencies> processor = new MavenDomProjectProcessorUtils.SearchProcessor<MavenDomDependency, MavenDomDependencies>() {

        @Nullable
        @Override
        protected MavenDomDependency find(MavenDomDependencies element) {
            for (MavenDomDependency dependency : element.getDependencies()) {
                if (Comparing.equal(groupId, dependency.getGroupId().getStringValue()) && Comparing.equal(artifactId, dependency.getArtifactId().getStringValue())) {
                    return dependency;
                }
            }
            return null;
        }
    };
    MavenDomProjectProcessorUtils.processDependencies(projectDom, processor);
    return processor.getResult();
}
Also used : MavenDomProjectProcessorUtils(org.jetbrains.idea.maven.dom.MavenDomProjectProcessorUtils) MavenDomDependencies(org.jetbrains.idea.maven.dom.model.MavenDomDependencies) MavenDomDependency(org.jetbrains.idea.maven.dom.model.MavenDomDependency) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

Nullable (org.jetbrains.annotations.Nullable)1 MavenDomProjectProcessorUtils (org.jetbrains.idea.maven.dom.MavenDomProjectProcessorUtils)1 MavenDomDependencies (org.jetbrains.idea.maven.dom.model.MavenDomDependencies)1 MavenDomDependency (org.jetbrains.idea.maven.dom.model.MavenDomDependency)1