this.showLogical = showLogical;
}
protected void setViewerInput(IStructuredSelection ssel) {
IJavaStackFrame frame = null;
IVariable variable = null;
if (ssel.size() == 1) {
Object input = ssel.getFirstElement();
if (input instanceof IJavaStackFrame) {
frame = (IJavaStackFrame) input;
} else if (input instanceof IVariable) {
variable = (IVariable) input;
}
}
getDetailViewer().setEditable(frame != null || variable != null);
Object current = getViewer().getInput();
// if the debug view stack still contains the same WorkingMemoryImpl, do nothing
if (current != null) {
ISelection stackSelection = getSite().getPage().getSelection(IDebugUIConstants.ID_DEBUG_VIEW);
if (stackSelection instanceof IStructuredSelection) {
Object stack = ((IStructuredSelection) stackSelection).getFirstElement();
if (stack instanceof IJavaStackFrame) {
try {
IJavaObject stackObj = ((IJavaStackFrame) stack).getThis();
if (current.equals(stackObj)) {
return;
}
} catch (Throwable t) {
// do nothing
}
}
}
}
if (current == null && frame == null && variable == null) {
return;
}
if (current != null) {
try {
if ((frame != null && current.equals(frame.getThis()))
|| (variable != null && current.equals(variable.getValue()))) {
return;
}
} catch (Throwable t) {
// do nothing
}
}
if (current != null) {
fLastState = getViewerState();
fSelectionStates.put(current, fLastState);
}
if (frame != null) {
setDebugModel(frame.getModelIdentifier());
} else if (variable != null) {
setDebugModel(variable.getModelIdentifier());
}
showViewer();
Object input = null;
if (frame != null) {
try {
IJavaObject stackObj = frame.getThis();
if ((stackObj != null)
&& (stackObj.getJavaType() != null)
&& ("org.drools.reteoo.WorkingMemoryImpl".equals(
stackObj.getJavaType().getName()))) {
input = stackObj;
}
} catch (Throwable t) {
DroolsIDEPlugin.log(t);
}
} else if (variable != null) {
try {
IValue value = variable.getValue();
if (value != null && value instanceof IJavaObject
&& "org.drools.reteoo.WorkingMemoryImpl".equals(
variable.getValue().getReferenceTypeName())) {
input = (IJavaObject) value;
}
} catch (Throwable t) {
DroolsIDEPlugin.log(t);
}