Package com.jetbrains.lang.dart.psi

Examples of com.jetbrains.lang.dart.psi.DartExpression


  @Nullable
  @Override
  protected PsiElement findAnchor(PsiElement element) {
    DartCallExpression callExpression = PsiTreeUtil.getParentOfType(element, DartCallExpression.class);
    assert callExpression != null;
    DartExpression expression = callExpression.getExpression();
    DartReference[] dartReferences = PsiTreeUtil.getChildrenOfType(expression, DartReference.class);
    DartClass dartClass = dartReferences == null ? PsiTreeUtil.getParentOfType(element, DartClass.class)
                                                 : dartReferences[0].resolveDartClass().getDartClass();
    return DartResolveUtil.getBody(dartClass);
  }
View Full Code Here


        candidates.add(StringUtil.decapitalize(dartClassName));
      }
    }

    if (expression instanceof DartCallExpression) {
      final DartExpression callee = ((DartCallExpression)expression).getExpression();
      text = callee.getText();
    }

    if (text != null) {
      candidates.addAll(generateNames(text));
    }
View Full Code Here

  }

  protected Collection<String> buildSuggestions(Class<? extends DartExpression> parentClass) {
    myFixture.configureByFile(getTestName(false) + getFileExtension());
    DartIntroduceHandler handler = createHandler();
    DartExpression expr = PsiTreeUtil.getParentOfType(
      myFixture.getFile().findElementAt(myFixture.getEditor().getCaretModel().getOffset()),
      parentClass
    );
    return DartNameSuggesterUtil.getSuggestedNames(expr);
  }
View Full Code Here

  @Nullable
  public TextRange surroundElements(@NotNull Project project, @NotNull Editor editor, @NotNull PsiElement[] elements)
    throws IncorrectOperationException {
    PsiElement source = elements[0];

    final DartExpression parenthExprNode = getSurroundedNode(source);
    if (parenthExprNode == null) {
      throw new IncorrectOperationException("Can't create expression for: " + source.getText());
    }

    final PsiElement replace = source.replace(parenthExprNode);
View Full Code Here

*/
public class DartExpressionSurroundDescriptor implements SurroundDescriptor {
  @NotNull
  @Override
  public PsiElement[] getElementsToSurround(PsiFile file, int startOffset, int endOffset) {
    final DartExpression result = DartRefactoringUtil.findExpressionInRange(file, startOffset, endOffset);
    return result == null ? PsiElement.EMPTY_ARRAY : new PsiElement[]{result};
  }
View Full Code Here

    String testName;
    final DartArgumentList dartArgumentList = expression == null ? null : expression.getArguments().getArgumentList();
    if (dartArgumentList == null || dartArgumentList.getExpressionList().isEmpty()) {
      return null;
    }
    final DartExpression dartExpression = dartArgumentList.getExpressionList().get(0);
    testName = dartExpression == null ? "" : StringUtil.unquoteString(dartExpression.getText());
    return testName;
  }
View Full Code Here

TOP

Related Classes of com.jetbrains.lang.dart.psi.DartExpression

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.