Examples of PsiElement


Examples of com.intellij.psi.PsiElement

    return myAssignmentSymbol.isValid() ? myAssignmentSymbol : null;
  }

  @Override
  public void navigate(final boolean requestFocus) {
    final PsiElement symbol = myAssignment.myAssignmentSymbol;
    if (symbol != null) {
      ((Navigatable) symbol).navigate(requestFocus);
    }
  }
View Full Code Here

Examples of com.intellij.psi.PsiElement

    }
  }

  @Override
  public boolean canNavigate() {
    final PsiElement symbol = myAssignment.myAssignmentSymbol;
    if (symbol != null) {
      return ((Navigatable) symbol).canNavigate();
    }
    return false;
  }
View Full Code Here

Examples of com.intellij.psi.PsiElement

    return false;
  }

  @Override
  public boolean canNavigateToSource() {
    final PsiElement symbol = myAssignment.myAssignmentSymbol;
    if (symbol != null) {
      return ((Navigatable) symbol).canNavigateToSource();
    }
    return false;
  }
View Full Code Here

Examples of com.intellij.psi.PsiElement

  @Override
  protected List<Block> buildChildren() {
    List<Block> blocks = new ArrayList<Block>();
    Alignment baseAlignment = Alignment.createAlignment();
    IElementType parentType = getNode().getElementType();
    PsiElement psi = getNode().getPsi();


    for (ASTNode child = myNode.getFirstChildNode(); child != null; child = child.getTreeNext()) {
      IElementType childType = child.getElementType();
      if (child.getTextRange().getLength() == 0 ||
View Full Code Here

Examples of com.intellij.psi.PsiElement

    super(Mathematica.NAME, "Mathematica");
  }

  public boolean isInContext(@NotNull PsiFile file, int offset) {
    if (PsiUtilBase.getLanguageAtOffset(file, offset).isKindOf(MathematicaFileType.INSTANCE.getLanguage())) {
      PsiElement element = PsiUtilBase.getElementAtOffset(file, offset);
      return PsiTreeUtil.getParentOfType(element, PsiComment.class, false) == null;
    }
    return false;
  }
View Full Code Here

Examples of com.intellij.psi.PsiElement

    final FileType type = MathematicaFileType.INSTANCE;
    return (MathematicaPsiFile) PsiFileFactory.getInstance(myProject).createFileFromText(DUMMY_FILE_NAME, type, code);
  }

  public Expression createExpressionFromText(@NotNull String expr) {
    final PsiElement exprFile = createDummyFile(expr).getFirstChild();
    if (exprFile != null && exprFile instanceof Expression) {
      return (Expression) exprFile;
    }
    throw new IncorrectOperationException("The supplied string is not a valid Mathematica expression.");
  }
View Full Code Here

Examples of com.intellij.psi.PsiElement

    throw new IncorrectOperationException("The supplied string is not a valid Mathematica expression.");
  }

  @NotNull
  public Symbol createSymbol(@NotNull String symbolName) {
    final PsiElement symbol = createDummyFile(symbolName).getFirstChild();
    if (symbol != null && symbol instanceof Symbol) {
      return (Symbol) symbol;
    }
    throw new IncorrectOperationException("The supplied string is not a valid Mathematica Symbol.");
  }
View Full Code Here

Examples of com.intellij.psi.PsiElement

    if (element instanceof UpSet || element instanceof UpSetDelayed) {
      return visitUpSetDefinition(element.getFirstChild());
    }

    if (element instanceof FunctionCall) {
      final PsiElement lhs = ((FunctionCall) element).getArgument(1);
      if (((FunctionCall) element).matchesHead("Set|SetDelayed")) {
        return visitSetDefinition(lhs);
      } else if (((FunctionCall) element).matchesHead("TagSet|TagSetDelayed")) {
        return visitTagSetDefinition(lhs);
      } else if (((FunctionCall) element).matchesHead("UpSet|UpSetDelayed")) {
View Full Code Here

Examples of com.intellij.psi.PsiElement

  @Override
  public boolean isAccepted(PsiElement element) {
    if (element instanceof Symbol) {
      Symbol symbol = (Symbol) element;
      PsiElement parent = symbol.getParent();
      int iter = 0;
      while (parent != null && ++iter != MAX_UPWARD_STEPS && !(parent instanceof PsiFile)) {
        if (parent instanceof Set || parent instanceof SetDelayed) {
          final List<Symbol> assignmentSymbols = MathematicaPsiUtilities.getAssignmentSymbols(parent);
          return assignmentSymbols != null && assignmentSymbols.contains(element);
        }
        parent = parent.getParent();
      }

    }
    return false;
  }
View Full Code Here

Examples of com.intellij.psi.PsiElement

    }
  }

  @Override
  public void visitOptional(Optional optional) {
    PsiElement firstChild = optional.getFirstChild();
    if (firstChild != null) {
      firstChild.accept(this);
    }
  }
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.