Hello Jae,
The method is "communicate" in the class of DbgpDebuggingEngineCommunicator in the package of org.eclipse.dltk.dbgp.internal.commands.
But as I mentioned, if you change this method sychronized, the thread will not terminated properly cause it cannot catch the InterruptedException.
The following is what I've done so far, hopes it can help you to reproduce the bug. If there is anything unclear, please let know. And thanks for your quick response.
1. Add a custom view in debugging perspective
<extension point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension targetID="org.eclipse.debug.ui.DebugPerspective">
<view relative="org.eclipse.debug.ui.VariableView"
visible="true"
relationship="stack"
id="CustomView">
</view>
</perspectiveExtension>
</extension>
<extension
point="org.eclipse.ui.views">
<category name="Debug" id="org.eclipse.debug.ui">
</category>
<view name="Custom debug "
icon="icons/tcl_obj.gif"
category="org.eclipse.debug.ui"
class="CustomView"
id="CustomView">
</view>
</extension>
2.
import org.eclipse.debug.core.DebugEvent;
public class CustomView extends AbstractDebugView
implements IDebugEventSetListener,
IScriptEvaluationListener,{
private IScriptThread source; //The debugging thread, it will get the script when the view receives DebugEvent
private String snippt;
private TreeViewer viewer;
private IScriptEvaluationEngine scriptEvaluationEngine = null;
public ScriptExplorerTreeView () {
DebugPlugin.getDefault().addDebugEventListener(this);
snippt = "Some tcl script that will take some time to execute";
}
protected Viewer createViewer(Composite parent) {
viewer = new TreeViewer(parent);
......//set content provider and label provider
viewer.setInput(null);
return viewer;
}
...........
public void execInTcl(IScriptEvaluationEngine scriptEvaluationEngine,String commands){
try {
if(commands!=null || commands.length()!=0){
scriptEvaluationEngine.asyncEvaluate(commands, null,this);
}
} catch (Exception e){
e.printStackTrace();
}
}
public synchronized void handleDebugEvents(DebugEvent[] events) {
for (int i = 0; i < events.length; i++) {
DebugEvent event = events[i];
if (!(event.getSource() instanceof IScriptThread)) {
continue;
}
switch (event.getKind()) {
case DebugEvent.SUSPEND:
if(event.getDetail() == DebugEvent.STEP_END){
source = (IScriptThread) event.getSource();
scriptEvaluationEngine = source.getEvaluationEngine();
if (!isVisible()) {
break;
}
try {
execInTcl(scriptEvaluationEngine,snippt);
} catch (Exception e) {
e.printStackTrace();
}
}
break;
......................
}
}
}
public void evaluationComplete(IScriptEvaluationResult result) {
final IScriptValue value = result.getValue();
if (value!=null) {
Display.getDefault().syncExec(new Runnable(){
public void run() {
try {
//Use the returned value to populate the tree
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
Best regards,
Joy
Park yourself in front of a world of choices in alternative vehicles.