boolean (@NotNull DomElement element) { DomElement dependencyOrPluginElement = element.getParent(); if (dependencyOrPluginElement instanceof MavenDomDependency) { DomElement dependencies = dependencyOrPluginElement.getParent(); if (dependencies instanceof MavenDomDependencies) { if (dependencies.getParent() instanceof MavenDomDependencyManagement) { return true; } } } else if (dependencyOrPluginElement instanceof MavenDomPlugin) { DomElement pluginsElement = dependencyOrPluginElement.getParent(); if (pluginsElement instanceof MavenDomPlugins) { if (pluginsElement.getParent() instanceof MavenDomPluginManagement) { return true; } } } return false; }