/** * Converts the given variable into an <code>IIterable</code>. If a corresponding adapter can't be found an * exception is thrown. If the corresponding adapter isn't loaded yet, <code>null</code> is returned. * * @param var the variable to turn into an <code>IIterable</code> * @param expression the expression referring to the variable * * @return the <code>IIterable</code> or <code>null<code> if a corresponding adapter isn't loaded yet * * @throws CoreException if the var can't be adapted to an <code>IIterable</code> */ public static IIterable getAsIIterable(Object var, Expression expression) throws CoreException { if (var instanceof IIterable) { return (IIterable)var; } else { IAdapterManager manager= Platform.getAdapterManager(); IIterable result= (IIterable)manager.getAdapter(var, IIterable.class); if (result != null) return result; if (manager.queryAdapter(var, IIterable.class.getName()) == IAdapterManager.NOT_LOADED) return null; throw new CoreException(new ExpressionStatus( ExpressionStatus.VARIABLE_IS_NOT_A_COLLECTION, Messages.format(ExpressionMessages.Expression_variable_not_iterable, expression.toString()))); } }
/** * Converts the given variable into an <code>ICountable</code>. If a corresponding adapter can't be found an * exception is thrown. If the corresponding adapter isn't loaded yet, <code>null</code> is returned. * * @param var the variable to turn into an <code>ICountable</code> * @param expression the expression referring to the variable * * @return the <code>ICountable</code> or <code>null<code> if a corresponding adapter isn't loaded yet * * @throws CoreException if the var can't be adapted to an <code>ICountable</code> */ public static ICountable getAsICountable(Object var, Expression expression) throws CoreException { if (var instanceof ICountable) { return (ICountable)var; } else { IAdapterManager manager= Platform.getAdapterManager(); ICountable result= manager.getAdapter(var, ICountable.class); if (result != null) return result; if (manager.queryAdapter(var, ICountable.class.getName()) == IAdapterManager.NOT_LOADED) return null; throw new CoreException(new ExpressionStatus( ExpressionStatus.VARIABLE_IS_NOT_A_COLLECTION, Messages.format(ExpressionMessages.Expression_variable_not_countable, expression.toString()))); } }
/** * Converts the given variable into an <code>ICountable</code>. If a corresponding adapter can't be found an * exception is thrown. If the corresponding adapter isn't loaded yet, <code>null</code> is returned. * * @param var the variable to turn into an <code>ICountable</code> * @param expression the expression referring to the variable * * @return the <code>ICountable</code> or <code>null<code> if a corresponding adapter isn't loaded yet * * @throws CoreException if the var can't be adapted to an <code>ICountable</code> */ public static ICountable getAsICountable(Object var, Expression expression) throws CoreException { if (var instanceof ICountable) { return (ICountable)var; } else { IAdapterManager manager= Platform.getAdapterManager(); ICountable result= manager.getAdapter(var, ICountable.class); if (result != null) return result; if (manager.queryAdapter(var, ICountable.class.getName()) == IAdapterManager.NOT_LOADED) return null; throw new CoreException(new ExpressionStatus( ExpressionStatus.VARIABLE_IS_NOT_A_COLLECTION, Messages.format(ExpressionMessages.Expression_variable_not_countable, expression.toString()))); } }
/** * Converts the given variable into an <code>ICountable</code>. If a corresponding adapter can't be found an * exception is thrown. If the corresponding adapter isn't loaded yet, <code>null</code> is returned. * * @param var the variable to turn into an <code>ICountable</code> * @param expression the expression referring to the variable * * @return the <code>ICountable</code> or <code>null<code> if a corresponding adapter isn't loaded yet * * @throws CoreException if the var can't be adapted to an <code>ICountable</code> */ public static ICountable getAsICountable(Object var, Expression expression) throws CoreException { if (var instanceof ICountable) { return (ICountable)var; } else { IAdapterManager manager= Platform.getAdapterManager(); ICountable result= (ICountable)manager.getAdapter(var, ICountable.class); if (result != null) return result; if (manager.queryAdapter(var, ICountable.class.getName()) == IAdapterManager.NOT_LOADED) return null; throw new CoreException(new ExpressionStatus( ExpressionStatus.VARIABLE_IS_NOT_A_COLLECTION, Messages.format(ExpressionMessages.Expression_variable_not_countable, expression.toString()))); } }
/** * Converts the given variable into an <code>IIterable</code>. If a corresponding adapter can't be found an * exception is thrown. If the corresponding adapter isn't loaded yet, <code>null</code> is returned. * * @param var the variable to turn into an <code>IIterable</code> * @param expression the expression referring to the variable * * @return the <code>IIterable</code> or <code>null<code> if a corresponding adapter isn't loaded yet * * @throws CoreException if the var can't be adapted to an <code>IIterable</code> */ public static IIterable<?> getAsIIterable(Object var, Expression expression) throws CoreException { if (var instanceof IIterable) { return (IIterable<?>)var; } else { IAdapterManager manager= Platform.getAdapterManager(); IIterable<?> result= manager.getAdapter(var, IIterable.class); if (result != null) return result; if (manager.queryAdapter(var, IIterable.class.getName()) == IAdapterManager.NOT_LOADED) return null; throw new CoreException(new ExpressionStatus( ExpressionStatus.VARIABLE_IS_NOT_A_COLLECTION, Messages.format(ExpressionMessages.Expression_variable_not_iterable, expression.toString()))); } }
/** * Converts the given variable into an <code>ICountable</code>. If a corresponding adapter can't be found an * exception is thrown. If the corresponding adapter isn't loaded yet, <code>null</code> is returned. * * @param var the variable to turn into an <code>ICountable</code> * @param expression the expression referring to the variable * * @return the <code>ICountable</code> or <code>null<code> if a corresponding adapter isn't loaded yet * * @throws CoreException if the var can't be adapted to an <code>ICountable</code> */ public static ICountable getAsICountable(Object var, Expression expression) throws CoreException { if (var instanceof ICountable) { return (ICountable)var; } else { IAdapterManager manager= Platform.getAdapterManager(); ICountable result= manager.getAdapter(var, ICountable.class); if (result != null) return result; if (manager.queryAdapter(var, ICountable.class.getName()) == IAdapterManager.NOT_LOADED) return null; throw new CoreException(new ExpressionStatus( ExpressionStatus.VARIABLE_IS_NOT_A_COLLECTION, Messages.format(ExpressionMessages.Expression_variable_not_countable, expression.toString()))); } }
/** * Converts the given variable into an <code>IIterable</code>. If a corresponding adapter can't be found an * exception is thrown. If the corresponding adapter isn't loaded yet, <code>null</code> is returned. * * @param var the variable to turn into an <code>IIterable</code> * @param expression the expression referring to the variable * * @return the <code>IIterable</code> or <code>null<code> if a corresponding adapter isn't loaded yet * * @throws CoreException if the var can't be adapted to an <code>IIterable</code> */ public static IIterable<?> getAsIIterable(Object var, Expression expression) throws CoreException { if (var instanceof IIterable) { return (IIterable<?>)var; } else { IAdapterManager manager= Platform.getAdapterManager(); IIterable<?> result= manager.getAdapter(var, IIterable.class); if (result != null) return result; if (manager.queryAdapter(var, IIterable.class.getName()) == IAdapterManager.NOT_LOADED) return null; throw new CoreException(new ExpressionStatus( ExpressionStatus.VARIABLE_IS_NOT_A_COLLECTION, Messages.format(ExpressionMessages.Expression_variable_not_iterable, expression.toString()))); } }
/** * Converts the given variable into an <code>IIterable</code>. If a corresponding adapter can't be found an * exception is thrown. If the corresponding adapter isn't loaded yet, <code>null</code> is returned. * * @param var the variable to turn into an <code>IIterable</code> * @param expression the expression referring to the variable * * @return the <code>IIterable</code> or <code>null<code> if a corresponding adapter isn't loaded yet * * @throws CoreException if the var can't be adapted to an <code>IIterable</code> */ public static IIterable<?> getAsIIterable(Object var, Expression expression) throws CoreException { if (var instanceof IIterable) { return (IIterable<?>)var; } else { IAdapterManager manager= Platform.getAdapterManager(); IIterable<?> result= manager.getAdapter(var, IIterable.class); if (result != null) return result; if (manager.queryAdapter(var, IIterable.class.getName()) == IAdapterManager.NOT_LOADED) return null; throw new CoreException(new ExpressionStatus( ExpressionStatus.VARIABLE_IS_NOT_A_COLLECTION, Messages.format(ExpressionMessages.Expression_variable_not_iterable, expression.toString()))); } }
adapted = manager.getAdapter(var, fTypeName); if (adapted == null) { if (manager.queryAdapter(var, fTypeName) == IAdapterManager.NOT_LOADED) { return EvaluationResult.NOT_LOADED; } else {
public EvaluationResult evaluate(IEvaluationContext context) throws CoreException { if (fTypeName == null) return EvaluationResult.FALSE; Object var= context.getDefaultVariable(); Object adapted= null; IAdapterManager manager= Platform.getAdapterManager(); if (Expressions.isInstanceOf(var, fTypeName)) { adapted= var; } else { if (!manager.hasAdapter(var, fTypeName)) return EvaluationResult.FALSE; adapted= manager.getAdapter(var, fTypeName); } // the adapted result is null but hasAdapter returned true check // if the adapter is loaded. if (adapted == null) { if (manager.queryAdapter(var, fTypeName) == IAdapterManager.NOT_LOADED) { return EvaluationResult.NOT_LOADED; } else { return EvaluationResult.FALSE; } } return evaluateAnd(new DefaultVariable(context, adapted)); }
adapted = manager.getAdapter(var, fTypeName); if (adapted == null) { if (manager.queryAdapter(var, fTypeName) == IAdapterManager.NOT_LOADED) { return EvaluationResult.NOT_LOADED; } else {
adapted = manager.getAdapter(var, fTypeName); if (adapted == null) { if (manager.queryAdapter(var, fTypeName) == IAdapterManager.NOT_LOADED) { return EvaluationResult.NOT_LOADED; } else {