@Nullable
  public static MavenDomPlugin searchManagingPlugin(@NotNull final MavenDomPlugin plugin) {
    final String artifactId = plugin.getArtifactId().getStringValue();
    final String groupId = plugin.getGroupId().getStringValue();
    if (artifactId == null) return null;

    final MavenDomProjectModel model = plugin.getParentOfType(MavenDomProjectModel.class, false);
    if (model == null) return null;

    SearchProcessor<MavenDomPlugin, MavenDomPlugins> processor =
        new SearchProcessor<MavenDomPlugin, MavenDomPlugins>() {
          @Override
          protected MavenDomPlugin find(MavenDomPlugins mavenDomPlugins) {
            if (!model.equals(mavenDomPlugins.getParentOfType(MavenDomProjectModel.class, true))) {
              for (MavenDomPlugin domPlugin : mavenDomPlugins.getPlugins()) {
                if (MavenPluginDomUtil.isPlugin(domPlugin, groupId, artifactId)) {
                  return domPlugin;
                }
              }
            }

            return null;
          }
        };

    Function<MavenDomProjectModelBase, MavenDomPlugins> domProfileFunction =
        mavenDomProfile -> mavenDomProfile.getBuild().getPluginManagement().getPlugins();

    process(
        model, processor, model.getManager().getProject(), domProfileFunction, domProfileFunction);

    return processor.myResult;
  }
  @NotNull
  public static Collection<MavenDomPlugin> searchManagedPluginUsages(
      @NotNull final MavenDomPlugin plugin) {
    String artifactId = plugin.getArtifactId().getStringValue();
    if (artifactId == null) return Collections.emptyList();

    String groupId = plugin.getGroupId().getStringValue();

    MavenDomProjectModel model = plugin.getParentOfType(MavenDomProjectModel.class, false);
    if (model == null) return Collections.emptyList();

    return searchManagedPluginUsages(model, groupId, artifactId);
  }