Search in sources :

Example 1 with ValueRenderer

use of com.jetbrains.cidr.execution.debugger.evaluation.renderers.ValueRenderer in project intellij-plugins by JetBrains.

the class MotionValueRendererFactory method createRenderer.

@Nullable
@Override
public ValueRenderer createRenderer(@NotNull FactoryContext context) throws ExecutionException, DebuggerCommandException {
    try {
        LLValueData data = context.getLLValueData();
        if (data.isValidPointer()) {
            context.getEvaluationContext().evaluate(EvaluationContext.cast("rb_inspect(" + EvaluationContext.cast(data.getPointer(), "id") + ")", "id"));
            // we want ObjC renderers for our collections
            // Ruby collections are inheriting from native ones and don't have any useful instance variables
            final ValueRenderer collectionRenderer = new NSCollectionValueRenderer.Factory().createRenderer(context);
            return collectionRenderer != null ? collectionRenderer : new MotionObjectRenderer(context.getPhysicalValue());
        }
    } catch (DebuggerCommandException ignored) {
    }
    return null;
}
Also used : LLValueData(com.jetbrains.cidr.execution.debugger.backend.LLValueData) DebuggerCommandException(com.jetbrains.cidr.execution.debugger.backend.DebuggerCommandException) NSCollectionValueRenderer(com.jetbrains.cidr.execution.debugger.evaluation.renderers.NSCollectionValueRenderer) NSCollectionValueRenderer(com.jetbrains.cidr.execution.debugger.evaluation.renderers.NSCollectionValueRenderer) ValueRenderer(com.jetbrains.cidr.execution.debugger.evaluation.renderers.ValueRenderer) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

DebuggerCommandException (com.jetbrains.cidr.execution.debugger.backend.DebuggerCommandException)1 LLValueData (com.jetbrains.cidr.execution.debugger.backend.LLValueData)1 NSCollectionValueRenderer (com.jetbrains.cidr.execution.debugger.evaluation.renderers.NSCollectionValueRenderer)1 ValueRenderer (com.jetbrains.cidr.execution.debugger.evaluation.renderers.ValueRenderer)1 Nullable (org.jetbrains.annotations.Nullable)1