Package org.eclipse.wb.internal.core.model.creation

Examples of org.eclipse.wb.internal.core.model.creation.ConstructorCreationSupport


      Class<?> componentClass = getClass(editor, typeBinding);
      if (componentClass == null) {
        return null;
      }
      // create JavaInfo
      CreationSupport creationSupport = new ConstructorCreationSupport(creation);
      return JavaInfoUtils.createJavaInfo(editor, componentClass, creationSupport);
    }
    // unknown class
    return null;
  }
View Full Code Here


  private static void visitTaggedParameters(JavaInfo javaInfo,
      TaggedParameterVisitorEx visitor,
      String tagName) throws Exception {
    // visit constructor
    if (javaInfo.getCreationSupport() instanceof ConstructorCreationSupport) {
      ConstructorCreationSupport creationSupport =
          (ConstructorCreationSupport) javaInfo.getCreationSupport();
      ClassInstanceCreation creation = creationSupport.getCreation();
      ConstructorDescription constructorDescription = creationSupport.getDescription();
      List<Expression> arguments = DomGenerics.arguments(creation);
      for (ParameterDescription parameter : constructorDescription.getParameters()) {
        if (parameter.hasTrueTag(tagName)) {
          visitTaggedParameter(visitor, constructorDescription, arguments, parameter);
        }
View Full Code Here

   * @return the position from <code>com.gwtext.client.core.RegionPosition</code>.
   */
  public String getPosition() {
    return ExecutionUtils.runObjectIgnore(new RunnableObjectEx<String>() {
      public String runObject() throws Exception {
        ConstructorCreationSupport creationSupport =
            (ConstructorCreationSupport) getCreationSupport();
        Expression regionExpression = DomGenerics.arguments(creationSupport.getCreation()).get(0);
        Object region = JavaInfoEvaluationHelper.getValue(regionExpression);
        return (String) ReflectionUtils.invokeMethod(region, "getPosition()");
      }
    }, "north");
  }
View Full Code Here

    // create new Menu
    JavaInfo menu =
        JavaInfoUtils.createJavaInfo(
            getEditor(),
            "com.extjs.gxt.ui.client.widget.menu.Menu",
            new ConstructorCreationSupport());
    // prepare "new Menu()" source
    String menuSource;
    {
      StatementTarget statementTarget =
          new StatementTarget(AstNodeUtils.getEnclosingStatement(menuExpression), true);
View Full Code Here

  ////////////////////////////////////////////////////////////////////////////
  public static WidgetCanvasInfo command_CREATE_widget(CanvasInfo container,
      WidgetInfo widget,
      WidgetInfo nextWidget) throws Exception {
    // create empty WidgetCanvas
    ConstructorCreationSupport canvasCreationSupport = new ConstructorCreationSupport();
    WidgetCanvasInfo widgetCanvas =
        (WidgetCanvasInfo) JavaInfoUtils.createJavaInfo(
            container.getEditor(),
            "com.smartgwt.client.widgets.WidgetCanvas",
            canvasCreationSupport);
    container.command_absolute_CREATE(widgetCanvas, nextWidget);
    // attach widget at WidgetCanvas
    Expression expression = DomGenerics.arguments(canvasCreationSupport.getCreation()).get(0);
    // add source
    String widgetSource = widget.getCreationSupport().add_getSource(null);
    expression = container.getEditor().replaceExpression(expression, widgetSource);
    widget.addRelatedNode(expression);
    // set supports
View Full Code Here

      public void endEdit_aboutToRefresh() throws Exception {
        if (!isDeleted()
            && getCreationSupport() instanceof ConstructorCreationSupport
            && getMethodInvocations().isEmpty()
            && getFieldAssignments().isEmpty()) {
          ConstructorCreationSupport creationSupport =
              (ConstructorCreationSupport) getCreationSupport();
          ClassInstanceCreation creation = creationSupport.getCreation();
          String signature = creationSupport.getDescription().getSignature();
          // prepare arguments
          List<Expression> arguments = DomGenerics.arguments(creation);
          if (!AstNodeUtils.areLiterals(arguments)) {
            return;
          }
          // evaluate arguments
          List<Object> argumentValues;
          {
            EditorState state = JavaInfoUtils.getState(m_this);
            EvaluationContext context =
                new EvaluationContext(state.getEditorLoader(), state.getFlowDescription());
            argumentValues = Lists.newArrayList();
            for (Expression argument : arguments) {
              Object value = AstEvaluationEngine.evaluate(context, argument);
              JavaInfoEvaluationHelper.setValue(argument, value);
              argumentValues.add(value);
            }
          }
          // delete, if default constructor arguments
          if (isDefault(signature, argumentValues)) {
            delete();
          }
          // post process
          {
            boolean creationChanged =
                postProcessConstructorCreation(signature, creation, argumentValues);
            if (creationChanged) {
              setCreationSupport(new ConstructorCreationSupport(creation));
            }
          }
        }
      }
View Full Code Here

    // prepare Canvas
    final DynamicFormInfo parentCanvas =
        (DynamicFormInfo) JavaInfoUtils.createJavaInfo(
            m_editor,
            "com.smartgwt.client.widgets.form.DynamicForm",
            new ConstructorCreationSupport());
    {
      // drop Canvas on RootPanel
      panel.command_CREATE2(parentCanvas, null);
      panel.command_BOUNDS(parentCanvas, new Point(10, 10), new Dimension(700, 500));
      // broadcast for set widget as "live"
View Full Code Here

        expression = m_javaInfo.getEditor().addInvocationArgument(invocation, 1, source);
      }
    }
    // set CreationSupport
    {
      m_javaInfo.setCreationSupport(new ConstructorCreationSupport((ClassInstanceCreation) expression));
      m_javaInfo.bindToExpression(expression);
      m_javaInfo.addRelatedNode(expression);
    }
    // set Association
    m_javaInfo.setAssociation(new InvocationSecondaryAssociation(invocation));
View Full Code Here

  private void setMargin_constructor(int index, Object value) throws Exception {
    materialize();
    if (getCreationSupport() instanceof ConstructorCreationSupport) {
      setMargin_constructor4();
      // new arguments
      ConstructorCreationSupport creationSupport =
          (ConstructorCreationSupport) getCreationSupport();
      String signature = creationSupport.getDescription().getSignature();
      List<Expression> arguments = DomGenerics.arguments(creationSupport.getCreation());
      // update one of 4 arguments
      if ("<init>(int,int,int,int)".equals(signature)) {
        String valueSource = getMarginValueSource(value);
        getEditor().replaceExpression(arguments.get(index), valueSource);
        ExecutionUtils.refresh(this);
View Full Code Here

   * Attempts to convert {@link ConstructorCreationSupport} into using 4 arguments.
   */
  private void setMargin_constructor4() throws Exception {
    String signature;
    {
      ConstructorCreationSupport creationSupport =
          (ConstructorCreationSupport) getCreationSupport();
      signature = creationSupport.getDescription().getSignature();
    }
    // if no arguments, expand to 4 arguments
    if ("<init>()".equals(signature)) {
      setMargin_constructor4(0);
    }
View Full Code Here

TOP

Related Classes of org.eclipse.wb.internal.core.model.creation.ConstructorCreationSupport

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.