Examples of findElementAt()


Examples of com.intellij.psi.PsiFile.findElementAt()

    if (context == null) return null;
    final Editor editor = CommonDataKeys.EDITOR.getData(context);
    if (editor != null) {
      final PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(context);
      if (psiFile != null) {
        element = psiFile.findElementAt(editor.getCaretModel().getOffset());
      }
    }
    if (element == null) {
      element = CommonDataKeys.PSI_ELEMENT.getData(context);
    }
View Full Code Here

Examples of com.intellij.psi.PsiFile.findElementAt()

          PsiFileFactory.getInstance(expr.getContainingFile().getProject()).createFileFromText("newElementFile.cfml",
                                                                                               templateText + newText + "\">");
      }
    }
    if (psiFile != null) {
      PsiElement newStringElement = psiFile.findElementAt(templateText.length());
      if (newStringElement != null && newStringElement.getParent() != null) {
        return (CfmlCompositeElement)expr.replace(newStringElement.getParent());
      }
    }
    return expr;
View Full Code Here

Examples of com.intellij.psi.PsiFile.findElementAt()

            return null;
        }

        int templateStartOffset = context.getTemplateStartOffset();
        int offset = templateStartOffset > 0 ? context.getTemplateStartOffset() - 1 : context.getTemplateStartOffset();
        return findParentOfType(file.findElementAt(offset), clz);
    }

    public static String readFirstParamValue(ExpressionContext context, Expression[] params, String defaultValue) {
        String value = null;
        if (params.length > 0) {
View Full Code Here

Examples of com.intellij.psi.PsiFile.findElementAt()

        }

        int templateStartOffset = context.getTemplateStartOffset();
        final int offset = templateStartOffset > 0 ? context.getTemplateStartOffset() - 1 : context.getTemplateStartOffset();

        GoFunctionDeclaration fd = findParentOfType(file.findElementAt(offset), GoFunctionDeclaration.class);
        String name = fd == null ? "" : fd.getFunctionName();
        return new TextResult(name == null ? "" : name);
    }
}
View Full Code Here

Examples of com.intellij.psi.PsiFile.findElementAt()

    protected boolean isInContext(PsiElement element) {
      PsiFile file = element.getContainingFile();
      if (file != null && ErlangParserUtil.isConsole(file)) return false;
      int offset = element.getTextOffset();
      if (offset > 0 && file != null) {
        PsiElement prev = file.findElementAt(offset - 1);
        if (ErlangPsiImplUtil.is(prev, ErlangTypes.ERL_DOT)) return false;
      }
      PsiElement parent = element.getParent();
      return parent instanceof ErlangFile || parent instanceof PsiErrorElement && parent.getParent() instanceof ErlangFile;
    }
View Full Code Here

Examples of com.intellij.psi.PsiFile.findElementAt()

  @Nullable
  protected DomElement getSelectedDomElementFromTextEditor(final TextEditor textEditor) {
    final PsiFile psiFile = getPsiFile();
    if (psiFile == null) return null;
    final PsiElement psiElement = psiFile.findElementAt(textEditor.getEditor().getCaretModel().getOffset());

    if (psiElement == null) return null;

    final XmlTag xmlTag = PsiTreeUtil.getParentOfType(psiElement, XmlTag.class);
View Full Code Here

Examples of com.intellij.psi.PsiFile.findElementAt()

    final PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
    if (!(file instanceof XmlFile)) {
      return null;
    }

    return getDomElement(file.findElementAt(editor.getCaretModel().getOffset()));
  }

  @Nullable
  public static DomElement getDomElement(final Editor editor, final PsiFile file) {
     return getDomElement(file.findElementAt(editor.getCaretModel().getOffset()));
View Full Code Here

Examples of com.intellij.psi.PsiFile.findElementAt()

    final PsiFile psiFile = psiElement.getContainingFile();
    final PsiFile originalFile = psiFile.getOriginalFile();
    if (originalFile == null) return domElement;
    final TextRange range = psiElement.getTextRange();
    final PsiElement element = originalFile.findElementAt(range.getStartOffset());
    final int maxLength = range.getLength();
    final boolean isAttribute = psiElement instanceof XmlAttribute;
    final Class<? extends XmlElement> clazz = isAttribute ? XmlAttribute.class : XmlTag.class;
    final DomManager domManager = domElement.getManager();
    DomElement current = null;
View Full Code Here

Examples of org.jetbrains.plugins.clojure.psi.api.ClojureFile.findElementAt()

    if (!(file instanceof ClojureFile)) throw new NoDataException();

    final String query = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
      public String compute() {
        final ClojureFile clojureFile = (ClojureFile) file;
        PsiElement element = clojureFile.findElementAt(position.getOffset());

        String nsName = getNameSpaceName(element);
        final String nsPrefix = nsName != null ? nsName + "$" : "user$";

        final ClDef def = PsiTreeUtil.getParentOfType(element, ClDef.class);
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.GoFile.findElementAt()

                return;
            }

            // If nothing is selected in editor, find all potential expressions.
            int offset = editor.getCaretModel().getOffset();
            PsiElement element = getPrevSiblingIfItsWhiteSpaceOrComment(file.findElementAt(offset));
            if (element != null) {
                offset = Math.min(offset, element.getTextRange().getEndOffset() - 1);
            }
            List<GoExpr> expressions = collectExpressions(file, offset);
            if (expressions.isEmpty()) {
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.