Example usage for org.eclipse.jdt.core.dom Expression getProperty

List of usage examples for org.eclipse.jdt.core.dom Expression getProperty

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom Expression getProperty.

Prototype

public final Object getProperty(String propertyName) 

Source Link

Document

Returns the value of the named property of this node, or null if none.

Usage

From source file:org.decojer.cavaj.utils.Expressions.java

License:Open Source License

/**
 * Get originating literal value.//from www.j av  a  2  s .c  om
 *
 * Cannot replace this through getInFrame(getOp()) because PUSH etc. just change unknown out
 * frame.
 *
 * @param literal
 *            AST literal expression
 * @return originating literal value
 */
@Nullable
public static Object getValue(@Nonnull final Expression literal) {
    return literal.getProperty(PROP_VALUE);
}

From source file:org.eclipse.wb.core.eval.ExecutionFlowUtils2.java

License:Open Source License

/**
 * @return the existing {@link ExpressionValue} without trying to calculate it.
 */// www .j a  v a2 s  .  c o m
public static ExpressionValue getValue0(Expression expression) {
    ExpressionValue value = (ExpressionValue) expression.getProperty(KEY_VALUE);
    if (value == null) {
        value = (ExpressionValue) expression.getProperty(KEY_VALUE_PERMANENT);
    }
    return value;
}

From source file:org.eclipse.wb.core.eval.ExecutionFlowUtils2.java

License:Open Source License

/**
 * @return the existing permanent {@link ExpressionValue} without trying to calculate it.
 *//*w  ww.j  a va2 s . c  om*/
public static ExpressionValue getPermanentValue0(Expression expression) {
    return (ExpressionValue) expression.getProperty(KEY_VALUE_PERMANENT);
}

From source file:org.eclipse.wb.core.eval.ExecutionFlowUtils2.java

License:Open Source License

/**
 * @return ensures that {@link Expression} has permanent {@link ExpressionValue}, uses existing
 *         value or creates new one.//from w  ww .ja v  a 2s .  co  m
 */
public static ExpressionValue ensurePermanentValue(Expression expression) {
    ExpressionValue value;
    {
        // usually there is already some ExpressionValue
        value = (ExpressionValue) expression.getProperty(KEY_VALUE);
        // if no, create new one
        if (value == null) {
            value = new ExpressionValue(expression);
        }
    }
    // use this value as permanent
    expression.setProperty(KEY_VALUE_PERMANENT, value);
    // done
    return value;
}

From source file:org.eclipse.wb.core.eval.ExecutionFlowUtils2.java

License:Open Source License

/**
 * Clears permanent {@link ExpressionValue} associated with given {@link Expression}. Permanent
 * value is used to associate model, so practically we remove reference on model.
 *///from   w  w w.  ja  v a2 s. c om
public static void clearPermanentValue(Expression expression) {
    ExpressionValue value = (ExpressionValue) expression.getProperty(KEY_VALUE_PERMANENT);
    if (value != null) {
        value.setModel(null);
        expression.setProperty(KEY_VALUE_PERMANENT, null);
    }
}

From source file:org.eclipse.wb.core.eval.ExecutionFlowUtils2.java

License:Open Source License

public static ExpressionValue getValue(ExecutionFlowDescription flowDescription, Expression expression) {
    ensureValues(flowDescription);// w w w .ja v  a2  s  .  c o  m
    ExpressionValue value = (ExpressionValue) expression.getProperty(KEY_VALUE);
    if (value == null) {
        value = (ExpressionValue) expression.getProperty(KEY_VALUE_PERMANENT);
    }
    return value;
}

From source file:org.eclipse.wb.core.eval.ExecutionFlowUtils2.java

License:Open Source License

public static ExpressionValue getValuePrev(ExecutionFlowDescription flowDescription, Expression expression) {
    ensureValues(flowDescription);//from www.j av a  2 s.c o m
    return (ExpressionValue) expression.getProperty(KEY_VALUE_PREV);
}

From source file:org.eclipse.wb.internal.core.databinding.parser.AstModelSupport.java

License:Open Source License

protected final boolean isRepresentedOverReference(Expression expression) throws Exception {
    if (m_nameReference != null) {
        // prepare cached value
        String nameReference = (String) expression.getProperty(REFERENCE_VALUE_KEY);
        if (nameReference != null) {
            return m_nameReference.equals(nameReference);
        }//from www.  j a  v  a2s.  com
        // check variable references
        if (AstNodeUtils.isVariable(expression)) {
            nameReference = CoreUtils.getNodeReference(expression);
            expression.setProperty(REFERENCE_VALUE_KEY, nameReference);
            //
            return m_nameReference.equals(nameReference);
        }
    }
    return false;
}

From source file:org.eclipse.wb.internal.core.model.JavaInfoEvaluationHelper.java

License:Open Source License

/**
 * @return the value of {@link Expression} evaluated during AST execution, or <code>null</code> if
 *         given {@link Expression} was not evaluated.
 *///from   w ww.j av a 2 s .  c o  m
public static Object getValue(Expression expression) {
    Object value = expression.getProperty(KEY_EXPRESSION_VALUE);
    if (value == NULL_VALUE) {
        return null;
    }
    return value;
}

From source file:org.eclipse.wb.internal.core.nls.bundle.AbstractBundleSource.java

License:Open Source License

/**
 * Get information from expression. Ensure that this information comes from current source.
 *//*  w ww .  j a  va  2  s .c  o  m*/
protected final BasicExpressionInfo getBasicExpressionInfo(Expression expression) {
    AbstractSource expressionSource = NlsSupport.getSource(expression);
    if (expressionSource == this) {
        return (BasicExpressionInfo) expression.getProperty(NLS_EXPRESSION_INFO);
    }
    return null;
}