Package org.eclipse.jdt.core.dom

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


     * Create a block builder for the method body.
     *
     * @return builder
     */
    public BlockBuilder createBlock() {
        Block block = m_ast.newBlock();
        m_method.setBody(block);
        return new BlockBuilder(m_source, block);
    }
View Full Code Here


      method.setMethodName(dec.getName().toString());
      Type returnType = dec.getReturnType2();
      if (returnType != null) {
        method.setReturnType(returnType.toString());
      }
      Block d = dec.getBody();
      if (d == null) {
        continue;
      }
      method.setCodeBlock(d.toString());
      List param = dec.parameters();
      ListIterator paramList = param.listIterator();
      while (paramList.hasNext()) {
        SingleVariableDeclaration sin = (SingleVariableDeclaration) paramList.next();
        method.getParameters().add(sin.getType().toString());
View Full Code Here

    builder.append("}\n");
 

  protected boolean processListenerMethod(WidgetAdapter adapter, EventSetDescriptor esd, MethodDescriptor mListener, MethodDeclaration methoddec) {
    if (methoddec.getName().getFullyQualifiedName().equals(mListener.getName())) {
      Block mbody = methoddec.getBody();
      SingleVariableDeclaration var = (SingleVariableDeclaration) methoddec.parameters().get(0);
      IEventMethod content = getDelegatingContent(adapter, esd, mListener, mbody, var);
      methods.put(mListener, content);
      return true;
    } else {
View Full Code Here

  private List getBeanPropertyInitStatements(WidgetAdapter adapter, TypeDeclaration type) {
    List statements;
    if (adapter.isRoot()) {
      MethodDeclaration initMethod = getMethodDeclaration(type, INIT_METHOD_NAME);
      if (initMethod != null) {
        Block body = initMethod.getBody();
        statements = body.statements();
      } else {
        initMethod = getMethodDeclaration(type, type.getName().getFullyQualifiedName());
        if (initMethod != null) {
          Block body = initMethod.getBody();
          statements = body.statements();
        } else {
          statements = new ArrayList();
        }
      }
    } else {
      String getMethodName = NamespaceUtil.getGetMethodName(adapter, adapter.getID());
      MethodDeclaration getMethod = getMethodDeclaration(type, getMethodName);
      if (getMethod != null) {
        Block body = getMethod.getBody();
        statements = body.statements();
        if (!statements.isEmpty()) {
          Object first = statements.get(0);
          if (first instanceof IfStatement) {
            IfStatement ifs = (IfStatement) statements.get(0);
            Statement thenstmt = ifs.getThenStatement();
            if (thenstmt instanceof Block) {
              Block block = (Block) thenstmt;
              statements = block.statements();
            }
          }
        }
      } else {
        MethodDeclaration initMethod = getMethodDeclaration(type, INIT_METHOD_NAME);
        Block body = initMethod.getBody();
        statements = body.statements();
      }
    }
    return statements;
  }
View Full Code Here

    return success;
  }

 
  private boolean createEventMethodForWidget(TypeDeclaration type, WidgetAdapter adapter, EventSetDescriptor esd, MethodDescriptor mListener, MethodDeclaration md) {
    Block body = md.getBody();
    List statements = body.statements();
    if (!adapter.isRoot()&&!statements.isEmpty()) {
      Object firstStatement = statements.get(0);
      if (firstStatement instanceof IfStatement) {
        IfStatement ifstatement = (IfStatement) firstStatement;
        Statement thenstatement = ifstatement.getThenStatement();
View Full Code Here

public class BlockEvaluatorFactory extends ASTEvaluatorFactory {
  @Override
  protected IEvaluator createEvaluator(Object adaptable) {
    if(adaptable instanceof Block){
      Block block = (Block) adaptable;
      return new BlockEvaluator(block);
    }
    return null;
  }
View Full Code Here

  /**
   * @return RETURN | THROW | RETURN_VALUE
   */
  @Override
  public int evaluate(EvaluationContext context) {
    Block body = method.getBody();
    IEvaluator evaluator = (IEvaluator) Platform.getAdapterManager()
        .getAdapter(body, IEvaluator.class);
    int result = evaluator.evaluate(context);
    switch (result) {
    case RETURN:
View Full Code Here

  }
  /**
   * Example: try { int x; }
   */
  public boolean visit(TryStatement node) {
    Block body = node.getBody();
    Block finalBody = node.getFinally();
    List catches = node.catchClauses();

    ControlFlowNode cfnBody = controlFlowNode.newControlFlowNode(body);
    ControlFlowNode cfnFinalBody = null;

View Full Code Here

  //
  ////////////////////////////////////////////////////////////////////////////
  @Override
  public void add(JavaInfo child, StatementTarget target, Association association) throws Exception {
    // prepare block
    Block block = (Block) child.getEditor().addStatement(ImmutableList.of("{", "}"), target);
    // add statements in block
    target = new StatementTarget(block, true);
    add(child, target, null, association);
  }
View Full Code Here

  // collapsed nodes: in source: use one node that represents many; to be used as
  // copy/move source or to replace at once.
  // in the target: one block node that is not flattened.

  public Block createCollapsePlaceholder() {
    Block placeHolder= this.ast.newBlock();
    if (this.collapsedNodes == null) {
      this.collapsedNodes= new HashSet();
    }
    this.collapsedNodes.add(placeHolder);
    return placeHolder;
View Full Code Here

TOP

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

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.