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

Examples of org.eclipse.wb.internal.core.utils.execution.RunnableEx


    }

    @Override
    public void setValue(final Object value) throws Exception {
      if (value instanceof String) {
        ExecutionUtils.run(LayoutPanelInfo.this, new RunnableEx() {
          public void run() throws Exception {
            changeInvocationUnit(m_invocation, m_index, value, m_horizontal);
          }
        });
      }
View Full Code Here


  /**
   * Visits all {@link MethodInvocation}'s for this column.
   */
  private void visitColumnInvocations(final ColumnInvocationsVisitor visitor) {
    final int index = getIndex();
    ExecutionUtils.runRethrow(new RunnableEx() {
      public void run() throws Exception {
        m_panel.visitCellInvocations(new CellInvocationsVisitor() {
          public void visit(MethodDescription methodDescription,
              MethodInvocation invocation,
              Expression rowArgument,
View Full Code Here

  //
  // IResourcesLoader
  //
  ////////////////////////////////////////////////////////////////////////////
  public void dispose() {
    ExecutionUtils.runIgnore(new RunnableEx() {
      public void run() throws Exception {
        m_jarFile.close();
      }
    });
  }
View Full Code Here

        newValue = null;
      }
      // remove value
      if (newValue == null) {
        if (arguments.size() == 2) {
          ExecutionUtils.run(m_this, new RunnableEx() {
            public void run() throws Exception {
              editor.removeInvocationArgument(invocation, 1);
            }
          });
        }
      }
      // set value
      if (newValue != null) {
        final String valueSource = StringConverter.INSTANCE.toJavaSource(m_this, newValue);
        if (arguments.size() == 1) {
          // add argument
          ExecutionUtils.run(m_this, new RunnableEx() {
            public void run() throws Exception {
              editor.addInvocationArgument(invocation, 1, valueSource);
            }
          });
        } else {
          // replace argument
          ExecutionUtils.run(m_this, new RunnableEx() {
            public void run() throws Exception {
              editor.replaceExpression(arguments.get(1), valueSource);
              // may be was not String argument
              editor.replaceInvocationBinding(invocation);
            }
View Full Code Here

      final MethodInvocation invocation = getInvocation();
      final String signaturePrefix = "setColumnWidth(com.google.gwt.user.cellview.client.Column,";
      // remove value
      if (StringUtils.isEmpty(valueString)) {
        if (invocation != null) {
          ExecutionUtils.run(m_this, new RunnableEx() {
            public void run() throws Exception {
              editor.removeEnclosingStatement(invocation);
            }
          });
        }
        return;
      }
      // new value
      if (invocation == null) {
        final String valueSource = StringConverter.INSTANCE.toJavaSource(m_this, valueString);
        ExecutionUtils.run(m_this, new RunnableEx() {
          public void run() throws Exception {
            StatementTarget target = new StatementTarget(getAssociation().getStatement(), false);
            String signature = signaturePrefix + "java.lang.String)";
            String argumentsSource = TemplateUtils.format("{0}, {1}", m_this, valueSource);
            MethodInvocation newInvocation =
                getParentJava().addMethodInvocation(target, signature, argumentsSource);
            addRelatedNodes(newInvocation);
          }
        });
        return;
      }
      // update value
      final List<Expression> arguments = DomGenerics.arguments(invocation);
      // setColumnWidth(Column,String)
      {
        String signature = signaturePrefix + "java.lang.String)";
        if (AstNodeUtils.isMethodInvocation(invocation, signature)) {
          final String valueSource = StringConverter.INSTANCE.toJavaSource(m_this, valueString);
          ExecutionUtils.run(m_this, new RunnableEx() {
            public void run() throws Exception {
              editor.replaceExpression(arguments.get(1), valueSource);
            }
          });
        }
      }
      // setColumnWidth(Column,double,Unit)
      {
        String typeNameUnit = "com.google.gwt.dom.client.Style.Unit";
        String signature = signaturePrefix + "double," + typeNameUnit + ")";
        if (AstNodeUtils.isMethodInvocation(invocation, signature)) {
          // prepare "value" and "unit"
          double sizeValue;
          Object sizeUnit;
          try {
            sizeValue = getValueFromSizeString(valueString);
            sizeUnit = getUnitFromSizeString(valueString);
          } catch (Throwable e) {
            return;
          }
          // no unit
          if (sizeUnit == null) {
            return;
          }
          // apply "value" and "unit"
          final String valueSource = DoubleConverter.INSTANCE.toJavaSource(m_this, sizeValue);
          final String unitSource = typeNameUnit + "." + sizeUnit.toString();
          ExecutionUtils.run(m_this, new RunnableEx() {
            public void run() throws Exception {
              editor.replaceExpression(arguments.get(1), valueSource);
              editor.replaceExpression(arguments.get(2), unitSource);
            }
          });
View Full Code Here

      value = "";
    }
    if (value instanceof String) {
      final String stringValue = (String) value;
      if (!ObjectUtils.equals(getValue(), stringValue)) {
        ExecutionUtils.run(m_object, new RunnableEx() {
          public void run() throws Exception {
            getValueObject().setValue(stringValue);
            m_accessor.applySemantics(m_styleName);
          }
        });
View Full Code Here

    }
  }

  public void setSize(final String width, final String height) throws Exception {
    if (width != null || height != null) {
      ExecutionUtils.run(m_object, new RunnableEx() {
        public void run() throws Exception {
          setSize0(width, height);
        }
      });
    }
View Full Code Here

  private void openCommand(AbstractInvocationDescription description, List<Expression> arguments) {
    for (ParameterDescription parameter : description.getParameters()) {
      if (parameter.hasTrueTag("MenuBar.command")) {
        int index = parameter.getIndex();
        final Expression oldCommandExpression = arguments.get(index);
        ExecutionUtils.run(this, new RunnableEx() {
          public void run() throws Exception {
            ASTNode nodeToOpen = getCommandNodeToOpen(oldCommandExpression);
            JavaInfoUtils.scheduleOpenNode(m_this, nodeToOpen);
          }
        });
View Full Code Here

        return false;
      }

      @Override
      public void postVisit(final ASTNode node) {
        ExecutionUtils.runIgnore(new RunnableEx() {
          public void run() throws Exception {
            postVisitEx(node);
          }
        });
      }
View Full Code Here

  // Compilation problems
  //
  ////////////////////////////////////////////////////////////////////////////
  @Override
  public void processAnnotations(final BuildContext[] contexts) {
    ExecutionUtils.runLog(new RunnableEx() {
      public void run() throws Exception {
        processAnnotationsEx(contexts);
      }
    });
  }
View Full Code Here

TOP

Related Classes of org.eclipse.wb.internal.core.utils.execution.RunnableEx

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.