Package org.eclipse.wb.internal.core.utils.ast

Examples of org.eclipse.wb.internal.core.utils.ast.StatementTarget


  @Override
  protected StatementTarget getMethodInvocationTarget(String newSignature) throws Exception {
    if (getCreationSupport() instanceof ThisCreationSupport) {
      ThisCreationSupport creationSupport = (ThisCreationSupport) getCreationSupport();
      MethodDeclaration constructor = creationSupport.getConstructor();
      return new StatementTarget(constructor, false);
    }
    return super.getMethodInvocationTarget(newSignature);
  }
View Full Code Here


    // prepare added invocation
    MethodInvocation invocation = (MethodInvocation) item.getCreationSupport().getNode();
    item.setAssociation(new InvocationVoidAssociation(invocation));
    // configure Widget
    {
      NodeTarget target = new NodeTarget(new StatementTarget(invocation, true));
      Expression widgetExpression =
          editor.replaceInvocationArgument(
              invocation,
              0,
              widget.getCreationSupport().add_getSource(target));
View Full Code Here

  public void ensureFlexTableHelper() throws Exception {
    IPackageFragment packageFragment = (IPackageFragment) getEditor().getModelUnit().getParent();
    String helperClassName = ensureFlexTableHelper(packageFragment);
    // ensure fixRowSpan() invocation
    if (!hasInvocation_fixRowSpan()) {
      StatementTarget target = JavaInfoUtils.getTarget(this);
      String source = TemplateUtils.format("{0}.fixRowSpan({1})", helperClassName, this);
      addExpressionStatement(target, source);
    }
  }
View Full Code Here

    }
    // add new invocation
    if (source != null) {
      ExecutionUtils.run(javaInfo, new RunnableEx() {
        public void run() throws Exception {
          StatementTarget target = getTarget();
          Point location = getLocation(javaInfo);
          String argumentsSource =
              TemplateUtils.format("{0}, {1}, {2}", location.y, location.x, source);
          // add invocation
          JavaInfo formatter = getFormatter(javaInfo);
          MethodInvocation invocation =
              formatter.addMethodInvocation(target, m_methodSignature, argumentsSource);
          // remember values because they will be asked later because of
          // GenericPropertyImpl.rememberValueIntoExpression(Object)
          // TODO ask Mitin and may be remove "remember"
          {
            List<Expression> arguments = DomGenerics.arguments(invocation);
            JavaInfoEvaluationHelper.setValue(arguments.get(0), location.y);
            JavaInfoEvaluationHelper.setValue(arguments.get(1), location.x);
          }
        }

        private StatementTarget getTarget() {
          Statement targetStatement = javaInfo.getAssociation().getStatement();
          return new StatementTarget(targetStatement, false);
        }
      });
      return true;
    }
    // no changes
View Full Code Here

    frame.refresh();
    assertNoErrors(frame);
    FlexTableInfo panel = (FlexTableInfo) frame.getChildrenWidgets().get(0);
    // add new statement, should be added before fixRowSpan()
    {
      StatementTarget target = JavaInfoUtils.getTarget(panel, null);
      panel.addExpressionStatement(target, "System.out.println()");
    }
    assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
View Full Code Here

    // set alignment for cell
    String alignmentSource = alignment.getAlignmentField();
    if (alignmentSource != null) {
      alignmentSource = "com.google.gwt.user.client.ui.HasHorizontalAlignment." + alignmentSource;
      {
        StatementTarget target = JavaInfoUtils.getTarget(m_panel);
        int cell = m_panel.getStatus().getCellOfColumn(m_row, m_column);
        String arguments = m_row + ", " + cell + ", " + alignmentSource;
        m_panel.getCellFormatter().addMethodInvocation(target, SET_HOR_ALIGNMENT, arguments);
      }
    }
View Full Code Here

    // set alignment for cell
    String alignmentSource = alignment.getAlignmentField();
    if (alignmentSource != null) {
      alignmentSource = "com.google.gwt.user.client.ui.HasVerticalAlignment." + alignmentSource;
      {
        StatementTarget target = JavaInfoUtils.getTarget(m_panel);
        int cell = m_panel.getStatus().getCellOfColumn(m_row, m_column);
        String arguments = m_row + ", " + cell + ", " + alignmentSource;
        m_panel.getCellFormatter().addMethodInvocation(target, SET_VER_ALIGNMENT, arguments);
      }
    }
View Full Code Here

    if (alignmentSource != null) {
      alignmentSource = "com.google.gwt.user.client.ui.HasVerticalAlignment." + alignmentSource;
      MethodInvocation invocation =
          m_panel.getRowFormatter().getMethodInvocation(SET_VER_ALIGNMENT);
      if (invocation == null) {
        StatementTarget target = JavaInfoUtils.getTarget(m_panel);
        String arguments = getIndex() + ", " + alignmentSource;
        m_panel.getRowFormatter().addMethodInvocation(target, SET_VER_ALIGNMENT, arguments);
      } else {
        Expression alignmentExpression = DomGenerics.arguments(invocation).get(1);
        m_panel.getEditor().replaceExpression(alignmentExpression, alignmentSource);
View Full Code Here

    int index =
        nextColumn == null ? arrayInitializer.expressions().size() : getColumns().indexOf(
            nextColumn);
    addChild(column, nextColumn);
    // add source
    StatementTarget statementTarget =
        new StatementTarget(AstNodeUtils.getEnclosingStatement(columnsArray), true);
    String source = column.getCreationSupport().add_getSource(new NodeTarget(statementTarget));
    getCreateItemExpression(column, arrayInitializer, index, source);
    // set association
    column.setAssociation(new ArrayAssociation(columnsArray));
    // fire after event
View Full Code Here

      }
      column.getParent().removeChild(column);
      // add to array
      addChild(column, nextColumn);
      if (!(column.getVariableSupport() instanceof EmptyVariableSupport)) {
        StatementTarget statementTarget =
            new StatementTarget(AstNodeUtils.getEnclosingStatement(columnsArray), true);
        column.getVariableSupport().ensureInstanceReadyAt(statementTarget);
        source =
            column.getVariableSupport().getReferenceExpression(new NodeTarget(statementTarget));
      }
      Assert.isNotNull(source, "No source found for.");
View Full Code Here

TOP

Related Classes of org.eclipse.wb.internal.core.utils.ast.StatementTarget

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.