Examples of AstEditor


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

      value = (String) _value;
    } else {
      value = "100";
    }
    //
    AstEditor editor = getEditor();
    if (widget.getAssociation() instanceof InvocationChildAssociation) {
      InvocationChildAssociation association = (InvocationChildAssociation) widget.getAssociation();
      MethodInvocation invocation = association.getInvocation();
      // set percent
      if (value.endsWith("%")) {
        ColumnLayoutDataInfo columnData;
        if (association.getDescription().getSignature().endsWith(",int)")) {
          columnData = setWidth_addColumnLayoutData(widget, invocation);
        } else {
          columnData = widget.getChildren(ColumnLayoutDataInfo.class).get(0);
        }
        // set "columnWidth" property
        {
          value = StringUtils.substring(value, 0, -1);
          double weight = Integer.parseInt(value) / 100.0;
          columnData.setWidth(weight);
        }
        // done
        return;
      }
      // set absolute value
      {
        Expression expression = DomGenerics.arguments(invocation).get(1);
        editor.replaceExpression(expression, value);
        editor.replaceInvocationBinding(invocation);
        for (JavaInfo columnData : widget.getChildren(ColumnLayoutDataInfo.class)) {
          columnData.delete();
        }
      }
    }
View Full Code Here

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

    }
  }

  private ColumnLayoutDataInfo setWidth_addColumnLayoutData(WidgetInfo widget,
      MethodInvocation invocation) throws Exception {
    AstEditor editor = getEditor();
    ColumnLayoutDataInfo columnData =
        (ColumnLayoutDataInfo) JavaInfoUtils.createJavaInfo(
            editor,
            "com.gwtext.client.widgets.layout.ColumnLayoutData",
            new ConstructorCreationSupport());
    // set CreationSupport
    Expression expression;
    {
      expression = DomGenerics.arguments(invocation).get(1);
      String contentSource = columnData.getCreationSupport().add_getSource(null);
      expression = editor.replaceExpression(expression, contentSource);
      columnData.getCreationSupport().add_setSourceExpression(expression);
      columnData.addRelatedNode(expression);
    }
    // set Association
    columnData.setAssociation(new InvocationSecondaryAssociation(invocation));
    editor.replaceInvocationBinding(invocation);
    // set VariableSupport
    VariableSupport variableSupport = new EmptyVariableSupport(columnData, expression);
    columnData.setVariableSupport(variableSupport);
    // add content ColumnLayoutData as child
    widget.addChild(columnData);
View Full Code Here

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

          addContentPanel();
        }
      }

      private void addContentPanel() throws Exception {
        AstEditor editor = getEditor();
        JavaInfo content =
            JavaInfoUtils.createJavaInfo(
                editor,
                "com.gwtext.client.widgets.Panel",
                new ConstructorCreationSupport());
        // set CreationSupport
        Expression expression;
        {
          ClassInstanceCreation creation =
              ((ConstructorCreationSupport) getCreationSupport()).getCreation();
          expression = DomGenerics.arguments(creation).get(0);
          String contentSource = content.getCreationSupport().add_getSource(null);
          expression = editor.replaceExpression(expression, contentSource);
          content.getCreationSupport().add_setSourceExpression(expression);
          content.addRelatedNode(expression);
        }
        // set Association
        content.setAssociation(new ConstructorChildAssociation());
View Full Code Here

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

   * Fills given {@link IMenuManager} with {@link IAction}s for setting new {@link LayoutInfo} on
   * this {@link CompositeInfo}.
   */
  public void fillLayoutsManager(IMenuManager layoutsManager) throws Exception {
    // add layout items
    final AstEditor editor = getEditor();
    ClassLoader editorLoader = EditorState.get(editor).getEditorLoader();
    List<LayoutDescription> descriptions =
        LayoutDescriptionHelper.get(GwtExtToolkitDescription.INSTANCE);
    for (final LayoutDescription description : descriptions) {
      final Class<?> layoutClass = editorLoader.loadClass(description.getLayoutClassName());
      final String creationId = description.getCreationId();
      ComponentDescription layoutComponentDescription =
          ComponentDescriptionHelper.getDescription(editor, layoutClass);
      ObjectInfoAction action = new ObjectInfoAction(this) {
        @Override
        protected void runEx() throws Exception {
          description.ensureLibraries(editor.getJavaProject());
          LayoutInfo layout =
              (LayoutInfo) JavaInfoUtils.createJavaInfo(
                  getEditor(),
                  layoutClass,
                  new ConstructorCreationSupport(creationId, true));
View Full Code Here

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

  /**
   * Prepares {@link LayoutInfo} for any layout existing by default for this container.
   */
  private void initialize_createImplicitLayout() throws Exception {
    if (hasLayout()) {
      AstEditor editor = getEditor();
      Object layout = ReflectionUtils.invokeMethod(getObject(), "getLayout()");
      // create implicit layout model
      LayoutInfo implicitLayout;
      CreationSupport creationSupport = new ImplicitLayoutCreationSupport(this);
      if (layout == null) {
View Full Code Here

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

   * Fills given {@link IMenuManager} with {@link IAction}s for setting new {@link LayoutInfo} on
   * this {@link CompositeInfo}.
   */
  public void fillLayoutsManager(IMenuManager layoutsManager) throws Exception {
    // add layout items
    final AstEditor editor = getEditor();
    ClassLoader editorLoader = EditorState.get(editor).getEditorLoader();
    List<LayoutDescription> descriptions =
        LayoutDescriptionHelper.get(ExtGwtToolkitDescription.INSTANCE);
    for (final LayoutDescription description : descriptions) {
      final Class<?> layoutClass = editorLoader.loadClass(description.getLayoutClassName());
      final String creationId = description.getCreationId();
      ComponentDescription layoutComponentDescription =
          ComponentDescriptionHelper.getDescription(editor, layoutClass);
      ObjectInfoAction action = new ObjectInfoAction(this) {
        @Override
        protected void runEx() throws Exception {
          description.ensureLibraries(editor.getJavaProject());
          LayoutInfo layout =
              (LayoutInfo) JavaInfoUtils.createJavaInfo(
                  getEditor(),
                  layoutClass,
                  new ConstructorCreationSupport(creationId, true));
View Full Code Here

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

    if (hasLayout()) {
      if (initialize_hasExplicitLayout()) {
        return;
      }
      // prepare for creation
      AstEditor editor = getEditor();
      Object layout = ReflectionUtils.invokeMethod(getObject(), "getLayout()");
      // check if same implicit already exists
      if (initialize_removeImplicitLayout(layout)) {
        return;
      }
View Full Code Here

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

    visitColumnInvocations(new ColumnInvocationsVisitor() {
      public void visit(MethodDescription methodDescription,
          MethodInvocation invocation,
          int row,
          int column) throws Exception {
        AstEditor editor = m_panel.getEditor();
        if (methodDescription.getSignature().equals(SET_HOR_ALIGNMENT)) {
          editor.removeEnclosingStatement(invocation);
        } else if (methodDescription.getSignature().equals(SET_ALIGNMENT)) {
          editor.replaceInvocationName(invocation, "setVerticalAlignment");
          editor.removeInvocationArgument(invocation, 2);
          editor.replaceInvocationBinding(invocation);
        }
      }
    });
    // add invocations for each cell in column
    String alignmentSource = alignment.getAlignmentField();
View Full Code Here

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

    m_fieldName = fieldName;
    // prepare AST editor for Constants class
    {
      IType constants_type = m_root.getEditor().getJavaProject().findType(m_bundleName);
      ICompilationUnit constants_unit = constants_type.getCompilationUnit();
      m_accessorEditor = new AstEditor(constants_unit);
    }
  }
View Full Code Here

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

  /**
   * @return the new <code>Image</code> widget from this <code>AbstractImagePrototype</code>.
   */
  public ImageInfo createImageWidget() throws Exception {
    AstEditor editor = m_bundle.getEditor();
    // prepare CreationSupport
    OpaqueCreationSupport creationSupport;
    {
      String source = getImageSource();
      creationSupport = new OpaqueCreationSupport(source);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.