Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.Expression


    List statements = body.statements();
    if (statements.size() == 1) {
      Object stmt = statements.get(0);
      if (stmt instanceof ExpressionStatement) {
        ExpressionStatement es = (ExpressionStatement) stmt;
        Expression expression = es.getExpression();
        if (expression instanceof MethodInvocation) {
          MethodInvocation mi = (MethodInvocation) expression;
          Expression optional = mi.getExpression();
          if (optional == null||optional instanceof ThisExpression) {
            List list = mi.arguments();
            if (list.size() != 1) {
              return new CodeSnippet(adapter, eventSet, methodDesc, es.toString());
            }
            Expression exp = (Expression) list.get(0);
            if (exp instanceof SimpleName) {
              SimpleName sn = (SimpleName) exp;
              SimpleName varn = var.getName();
              if (sn.getFullyQualifiedName().equals(varn.getFullyQualifiedName()))
                return new EventDelegation(methodDesc, mi.getName().getFullyQualifiedName());
View Full Code Here


  /**
   * @return OK | THROW
   */
  @Override
  public int evaluate(EvaluationContext context) {
    Expression expression = expressionStatement.getExpression();
    IEvaluator evaluator = (IEvaluator) Platform.getAdapterManager().getAdapter(expression, IEvaluator.class);
    return evaluator.evaluate(context);
  }
View Full Code Here

    TypeDeclaration type = (TypeDeclaration) cunit.types().get(0);
    final String[]ret=new String[1];
    type.accept(new ASTVisitor(){
      @Override
      public boolean visit(ReturnStatement node) {
        Expression exp = node.getExpression();
        if(exp!=null&&exp instanceof SimpleName){
          String retName = ((SimpleName)exp).getFullyQualifiedName();
          if(retName.equals(fieldName)){
            ASTNode current = node;
            while(current!=null&&!(current instanceof MethodDeclaration))
View Full Code Here

  public static String findReturnFieldName(MethodDeclaration method){
    final String[]ret=new String[1];
    method.accept(new ASTVisitor(){
      @Override
      public boolean visit(ReturnStatement node) {
        Expression exp=node.getExpression();
        if(exp instanceof SimpleName ){
          ret[0]=((SimpleName)exp).getFullyQualifiedName();
        }
        return false;
      }
View Full Code Here

 
 
  protected boolean processAddListenerStatement(TypeDeclaration type, WidgetAdapter adapter, EventSetDescriptor esd, MethodDescriptor mListener, MethodInvocation mi) {
    List arguments = mi.arguments();
    for (Object arg : arguments) {
      Expression argExpression = (Expression) arg;
      if (argExpression instanceof ThisExpression) {
        addMethod(mListener);
        return true;
      } else
        return false;
View Full Code Here

  }
 
  protected boolean processAddListenerStatement(TypeDeclaration type, WidgetAdapter adapter, EventSetDescriptor esd, MethodDescriptor mListener, MethodInvocation mi) {
    List arguments = mi.arguments();
    for (Object arg : arguments) {
      Expression argExpression = (Expression) arg;
      if (argExpression instanceof ClassInstanceCreation) {
        ClassInstanceCreation cic = (ClassInstanceCreation) argExpression;
        AnonymousClassDeclaration acd = cic.getAnonymousClassDeclaration();
        if (acd != null) {
          return false;
View Full Code Here

  /**
   * Example: assert (x != 0) : "x is " + x + " which is not 0";
   */
  public boolean visit(AssertStatement node) {
    ControlFlowNode expression = controlFlowNode.newControlFlowNode(node.getExpression());
    Expression message = node.getMessage();
   
    controlFlowNode.moveEdges(ControlFlowNode.Direction.BACKWARDS, expression);

    if(message != null) {
      ControlFlowNode cfnMessage = controlFlowNode.newControlFlowNode(message);
View Full Code Here

  }
  /**
   * Example: new MyClass(5, "hello");
   */
  public boolean visit(ClassInstanceCreation node) {
    Expression expression = node.getExpression();
    List arguments = node.arguments();
    ControlFlowNode expressioncfn = null, last = null;
    List<ControlFlowNode> cfns = null;
   
    if(expression != null) {
View Full Code Here

//                              ---- 1 ---   --- 3 ---
//    ------------------- 2 -> 3 -------------------
//    ------------------- 2 -> exit ----------------

    // TODO: Add formal parameter, so a continue; makes more sense
    Expression expression = node.getExpression();
    Statement body = node.getBody();
    ControlFlowNode expressionCFN = null;
    ControlFlowNode bodyCFN = null;
    ControlFlowNode exit = controlFlowNode.getNode(ControlFlowNode.Direction.FORWARDS);
   
View Full Code Here

  }
  /**
   * Example: x = this.myField;
   */
  public boolean visit(FieldAccess node) {
    Expression expression = node.getExpression();
   
    if(expression == null)
      return false;

    ControlFlowNode expressioncfn = controlFlowNode.newControlFlowNode(expression);
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.Expression

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.