Examples of JSNamedElementProxy


Examples of com.intellij.lang.javascript.index.JSNamedElementProxy

    PsiElement resolvedElement = resolveResult.getElement();
    if (resolvedElement == null || !resolveResult.isValidResult()) {
      return null;
    }
    if (resolvedElement instanceof JSNamedElementProxy) {
      JSNamedElementProxy proxy = (JSNamedElementProxy) resolvedElement;
      return proxy.getElement();
    }
    return resolvedElement;
  }
View Full Code Here

Examples of com.intellij.lang.javascript.index.JSNamedElementProxy

    return new AngularAttributeDescriptor(project, directiveName, null);
  }

  public static boolean isAngularExpressionAttribute(XmlAttribute parent) {
    final String attributeName = DirectiveUtil.normalizeAttributeName(parent.getName());
    final JSNamedElementProxy directive = AngularIndexUtil.resolve(parent.getProject(), AngularDirectivesDocIndex.INDEX_ID, attributeName);
    if (directive != null) {
      final String restrict = directive.getIndexItem().getTypeString();
      final String param = restrict.split(";", -1)[2];
      return param.endsWith("expression") || param.startsWith("string");
    }
    return false;
  }
View Full Code Here

Examples of com.intellij.lang.javascript.index.JSNamedElementProxy

  public static boolean isJSONAttribute(XmlAttribute parent) {
    final String value = parent.getValue();
    if (value == null || !value.startsWith("{")) return false;

    final String attributeName = DirectiveUtil.normalizeAttributeName(parent.getName());
    final JSNamedElementProxy directive = AngularIndexUtil.resolve(parent.getProject(), AngularDirectivesDocIndex.INDEX_ID, attributeName);
    if (directive != null) {
      final String restrict = directive.getIndexItem().getTypeString();
      final String type = restrict.split(";", -1)[2];
      return type.contains("object literal") || type.equals("mixed");
    }
    return false;
  }
View Full Code Here

Examples of com.intellij.lang.javascript.index.JSNamedElementProxy

  }

  @Override
  public PsiElement getDeclaration() {
    final String name = DirectiveUtil.normalizeAttributeName(getName());
    final JSNamedElementProxy declaration = AngularIndexUtil.resolve(myProject, AngularDirectivesIndex.INDEX_ID, name);
    return declaration != null ? declaration :
           AngularIndexUtil.resolve(myProject, AngularDirectivesDocIndex.INDEX_ID, getName());
  }
View Full Code Here

Examples of com.intellij.lang.javascript.index.JSNamedElementProxy

  public static boolean processTagDirectives(final Project project,
                                             Processor<JSNamedElementProxy> processor) {
    final Collection<String> docDirectives = AngularIndexUtil.getAllKeys(AngularDirectivesDocIndex.INDEX_ID, project);
    for (String directiveName : docDirectives) {
      final JSNamedElementProxy directive = getTagDirective(project, directiveName, AngularDirectivesDocIndex.INDEX_ID);
      if (directive != null) {
        if (!processor.process(directive)) {
          return false;
        }
      }
    }
    final Collection<String> directives = AngularIndexUtil.getAllKeys(AngularDirectivesIndex.INDEX_ID, project);
    for (String directiveName : directives) {
      if (!docDirectives.contains(directiveName)) {
        final JSNamedElementProxy directive = getTagDirective(project, directiveName, AngularDirectivesIndex.INDEX_ID);
        if (directive != null) {
          if (!processor.process(directive)) {
            return false;
          }
        }
View Full Code Here

Examples of com.intellij.lang.javascript.index.JSNamedElementProxy

    }
    return true;
  }

  public static JSNamedElementProxy getTagDirective(String directiveName, Project project) {
    final JSNamedElementProxy directive = getTagDirective(project, directiveName, AngularDirectivesDocIndex.INDEX_ID);
    return directive == null ? getTagDirective(project, directiveName, AngularDirectivesIndex.INDEX_ID) : directive;
    }
View Full Code Here

Examples of com.intellij.lang.javascript.index.JSNamedElementProxy

    final JSNamedElementProxy directive = getTagDirective(project, directiveName, AngularDirectivesDocIndex.INDEX_ID);
    return directive == null ? getTagDirective(project, directiveName, AngularDirectivesIndex.INDEX_ID) : directive;
    }

  private static JSNamedElementProxy getTagDirective(Project project, String directiveName, final ID<String, Void> index) {
    final JSNamedElementProxy directive = AngularIndexUtil.resolve(project, index, directiveName);
    final String restrictions = directive != null ? directive.getIndexItem().getTypeString() : null;
    if (restrictions != null) {
      final String[] split = restrictions.split(";", -1);
      final String restrict = AngularIndexUtil.convertRestrictions(project, split[0]);
      if (!StringUtil.isEmpty(restrict) && StringUtil.containsIgnoreCase(restrict, "E")) {
        return directive;
View Full Code Here

Examples of com.intellij.lang.javascript.index.JSNamedElementProxy

    return null;
  }

  private static JSNamedElementProxy getDirective(PsiElement element, final String name) {
    final String directiveName = getAttributeName(name);
    final JSNamedElementProxy directive = AngularIndexUtil.resolve(element.getProject(), AngularDirectivesIndex.INDEX_ID, directiveName);
    if (directive != null && element.getTextRange().contains(directive.getTextOffset())) {
      return directive;
    }
    return null;
  }
View Full Code Here

Examples of com.intellij.lang.javascript.index.JSNamedElementProxy

  }

  @NotNull
  @Override
  public PsiElement[] getDeclarationsForSimpleSelector(@NotNull CssSimpleSelector selector) {
    final JSNamedElementProxy directive = DirectiveUtil.getTagDirective(DirectiveUtil.normalizeAttributeName(selector.getElementName()), selector.getProject());
    return directive != null ? new PsiElement[] {directive} : PsiElement.EMPTY_ARRAY;
  }
View Full Code Here

Examples of com.intellij.lang.javascript.index.JSNamedElementProxy

    if (descriptor != null && !(descriptor instanceof AnyXmlElementDescriptor)) {
      return null;
    }

    final Project project = xmlTag.getProject();
    final JSNamedElementProxy directive = DirectiveUtil.getTagDirective(directiveName, project);

    return directive != null ? new AngularJSTagDescriptor(directiveName, directive) : null;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.