@Override
 public boolean isAvailableForElement(@NotNull DomElement el) {
   DomElement root = DomUtil.getFileElement(el).getRootElement();
   return root.getModule() != null
       && root instanceof MavenDomProjectModel
       && isAvailableForModel((MavenDomProjectModel) root);
 }
 @Override
 public Module getModule() {
   final DomFileElement<DomElement> fileElement = DomUtil.getFileElement(getInvocationElement());
   if (fileElement == null) {
     final XmlElement xmlElement = getInvocationElement().getXmlElement();
     return xmlElement == null ? null : ModuleUtilCore.findModuleForPsiElement(xmlElement);
   }
   return fileElement.isValid() ? fileElement.getRootElement().getModule() : null;
 }
  public static void addTypeAndClassifierAndVersion(
      @NotNull InsertionContext context,
      @NotNull MavenDomDependency dependency,
      @NotNull String groupId,
      @NotNull String artifactId) {
    if (!StringUtil.isEmpty(dependency.getVersion().getStringValue())) return;

    Project project = context.getProject();

    if (!isInsideManagedDependency(dependency)) {
      MavenDomProjectModel model =
          DomUtil.<MavenDomProjectModel>getFileElement(dependency).getRootElement();
      MavenDomDependency managedDependency =
          findManagedDependency(model, project, groupId, artifactId);
      if (managedDependency != null) {
        if (dependency.getClassifier().getXmlTag() == null
            && dependency.getType().getXmlTag() == null) {
          String classifier = managedDependency.getClassifier().getRawText();
          if (StringUtil.isNotEmpty(classifier)) {
            dependency.getClassifier().setStringValue(classifier);
          }
          String type = managedDependency.getType().getRawText();
          if (StringUtil.isNotEmpty(type)) {
            dependency.getType().setStringValue(type);
          }
        }
        return;
      }
    }

    MavenProjectIndicesManager manager = MavenProjectIndicesManager.getInstance(project);

    Set<String> versions = manager.getVersions(groupId, artifactId);
    if (versions.size() == 1) {
      dependency.getVersion().setStringValue(ContainerUtil.getFirstItem(versions));
      return;
    }

    dependency.getVersion().setStringValue("");

    int versionPosition =
        dependency.getVersion().getXmlTag().getValue().getTextRange().getStartOffset();

    context.getEditor().getCaretModel().moveToOffset(versionPosition);

    if (versions.size() > 0) {
      invokeCompletion(context, CompletionType.BASIC);
    }
  }
 @Nullable
 public final DomElement getIdentityScope(DomElement element) {
   final DomFileDescription description = DomUtil.getFileElement(element).getFileDescription();
   return description.getIdentityScope(element);
 }
 @NotNull
 public final DomElement getResolvingScope(GenericDomValue element) {
   final DomFileDescription description = DomUtil.getFileElement(element).getFileDescription();
   return description.getResolveScope(element);
 }
 protected DomElement getParentDomElement(Project project, Editor editor, PsiFile file) {
   DomElement el = DomUtil.getContextElement(editor);
   return DomUtil.getFileElement(el).getRootElement();
 }