Package com.intellij.psi

Examples of com.intellij.psi.PsiElement


    @Override
    public final void childAdded(final PsiTreeChangeEvent pEvent) {
        if (ignoreEvents)
            return;

        final PsiElement child = pEvent.getChild();
        final String changedProperty = getPropertyForElement(child);
        if (changedProperty != null) {
            if (child instanceof XmlTag)
                notifyAddition(changedProperty);
            else if (child instanceof XmlText)
View Full Code Here


    @Override
    public final void childRemoved(final PsiTreeChangeEvent pEvent) {
        if (ignoreEvents)
            return;

        final PsiElement child = pEvent.getChild();
        final XmlTag parent = PsiTreeUtil.getParentOfType(pEvent.getParent(),
                                                          XmlTag.class,
                                                          false);
        if (parent == null)
            return;
View Full Code Here

    @Override
    public final void childReplaced(final PsiTreeChangeEvent pEvent) {
        if (ignoreEvents)
            return;

        final PsiElement oldChild = pEvent.getOldChild();
        final XmlTag parent = PsiTreeUtil.getParentOfType(pEvent.getParent(),
                                                          XmlTag.class,
                                                          false);
        if (parent == null)
            return;

        String oldChangedProperty = null;
        String newChangedProperty = null;

        if (oldChild instanceof XmlText)
            oldChangedProperty = getPropertyForElement(parent);
        else if (oldChild instanceof XmlTag) {
            final XmlTag tag = (XmlTag) oldChild;
            final String[] tagPath = PsiUtils.getPathAndConcat(parent, tag.getName());
            oldChangedProperty = getPropertyForPath(tagPath);
        }

        final PsiElement newChild = pEvent.getNewChild();
        if (newChild instanceof XmlText)
            newChangedProperty = getPropertyForElement(newChild);
        else if (newChild instanceof XmlTag) {
            final XmlTag tag = (XmlTag) newChild;
            final String[] tagPath = PsiUtils.getPathAndConcat(parent, tag.getName());
View Full Code Here

          textAttributes =
            EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.DEPRECATED_ATTRIBUTES)
              .clone();
        }

        PsiElement psiElement = node.getPsiElement();
        VirtualFile vFile = (psiElement == null)
          ? null
            : ((psiElement instanceof PsiDirectory)
              ? ((PsiDirectory) psiElement).getVirtualFile()
                : (psiElement.getContainingFile() == null) ? null : psiElement.getContainingFile().getVirtualFile());

        String reviewName = scopeTreeViewPanel.getCurrentScopeName();
        if (reviewName == null)
        {
          return;
View Full Code Here

    assert project != null;
    final PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
    assert psiFile != null;

    //region Interesting part where I track down usages
    PsiElement element = psiFile.findElementAt(editor.getCaretModel().getOffset());
    element = (element != null) ? element.getParent() : null;
    final List<PsiElement> usages = new ArrayList<PsiElement>();
    if (element instanceof Symbol) {
//      usages.add(element);

      final PsiReference ref = element.getReference();
      if (ref != null) {
        final PsiElement resolve = ref.resolve();
        if (resolve != null && resolve instanceof Symbol) {
          if (!resolve.equals(element))
            usages.add(resolve);
          final Collection<Symbol> symbolsInFile = PsiTreeUtil.findChildrenOfType(psiFile, Symbol.class);
          for (Symbol symbol : symbolsInFile) {
            final PsiReference reference = symbol.getReference();
            if (reference != null) {
              final PsiElement resolve1 = reference.resolve();
              if (resolve1 != null && !symbol.equals(resolve1) && resolve.equals(resolve1)) {
                usages.add(symbol);
              }
            }
          }
View Full Code Here

    }
  }

  @Override
  public void visitSymbol(final Symbol symbol) {
    PsiElement id = symbol.getFirstChild();

    if (NAMES.contains(id.getText())) {
      setHighlighting(symbol, myHolder, MathematicaSyntaxHighlighterColors.BUILTIN_FUNCTION);
      return;
    }

    LocalDefinitionResolveProcessor processor = new LocalDefinitionResolveProcessor(symbol);
View Full Code Here

  public void visitSet(de.halirutan.mathematica.parsing.psi.api.assignment.Set set) {
    cacheFromSetAssignment(set);
  }

  public void visitTagSet(TagSet tagSet) {
    final PsiElement tag = tagSet.getFirstChild();
    if (tag instanceof Symbol) {
      myCollectedFunctionNames.add(((Symbol) tag).getSymbolName());
    }
  }
View Full Code Here

      myCollectedFunctionNames.add(((Symbol) tag).getSymbolName());
    }
  }

  public void visitTagSetDelayed(TagSetDelayed tagSetDelayed) {
    final PsiElement tag = tagSetDelayed.getFirstChild();
    if (tag instanceof Symbol) {
      myCollectedFunctionNames.add(((Symbol) tag).getSymbolName());
    }
  }
View Full Code Here

  @Override
  public void visitFunctionCall(final FunctionCall functionCall) {
    final String head = functionCall.getHead().getText();
    if (head.matches("Set|SetDelayed")) {
      final PsiElement lhs = functionCall.getArgument(1);
      if (lhs != null) {
        final SetDefinitionSymbolVisitor visitor = new SetDefinitionSymbolVisitor(lhs);
        lhs.accept(visitor);
        cacheAssignedSymbols(visitor.getUnboundSymbols());
      }
    } else if (head.matches("TagSet|TagSetDelayed|SetAttributes|SetOptions")) {
      final PsiElement arg1 = functionCall.getArgument(1);
      if (arg1 instanceof Symbol) {
        myCollectedFunctionNames.add(((Symbol) arg1).getSymbolName());
      }
    }
  }
View Full Code Here

  public Set<String> getFunctionsNames() {
    return myCollectedFunctionNames;
  }

  private void cacheFromSetAssignment(PsiElement element) {
    final PsiElement lhs = element.getFirstChild();
    SetDefinitionSymbolVisitor visitor = new SetDefinitionSymbolVisitor(lhs);
    lhs.accept(visitor);
    cacheAssignedSymbols(visitor.getUnboundSymbols());
  }
View Full Code Here

TOP

Related Classes of com.intellij.psi.PsiElement

Copyright © 2018 www.massapicom. 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.