protected void setViewerInput(Object context) {
Object input = null;
// if a working memory has been explicitly selected as variable, use this
if (context instanceof IVariable) {
IVariable variable = (IVariable) context;
try {
IValue value = ((IVariable) context).getValue();
if (value != null && value instanceof IJavaObject) {
if ("org.drools.core.common.AbstartWorkingMemory".equals(variable.getValue().getReferenceTypeName()) ||
"org.drools.core.reteoo.ReteooStatefulSession".equals(variable.getValue().getReferenceTypeName()) ||
// for backwards compatibility
"org.drools.reteoo.ReteooStatefulSession".equals(variable.getValue().getReferenceTypeName())) {
input = value;
} else if ("org.drools.core.impl.StatefulKnowledgeSessionImpl".equals(variable.getValue().getReferenceTypeName())
|| "org.drools.impl.StatefulKnowledgeSessionImpl".equals(variable.getValue().getReferenceTypeName())) {
IJavaFieldVariable sessionVar = ((IJavaObject) value).getField("session", false);
if (sessionVar != null) {
input = sessionVar.getValue();
} else {
input = variable.getValue();
}
}
}
} catch (Throwable t) {
DroolsEclipsePlugin.log(t);