mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 332915: [tracepoint] Refreshing the Trace Control view blocks the UI thread
This commit is contained in:
parent
3e78c7b962
commit
220e3bf81a
1 changed files with 54 additions and 51 deletions
|
@ -212,59 +212,62 @@ public class TraceControlView extends ViewPart implements IViewPart, SessionEnde
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateContent() {
|
protected void updateContent() {
|
||||||
asyncExec(new Runnable() {
|
if (fDebugSessionId != null && getSession() != null) {
|
||||||
public void run() {
|
final ITraceTargetDMContext ctx = DMContexts.getAncestorOfType(fTargetContext, ITraceTargetDMContext.class);
|
||||||
String content = ""; //$NON-NLS-1$
|
if (ctx != null) {
|
||||||
String status = retrieveStatus();
|
getSession().getExecutor().execute(
|
||||||
if (status != null && status.length() > 0) {
|
new DsfRunnable() {
|
||||||
Calendar cal = Calendar.getInstance();
|
public void run() {
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); //$NON-NLS-1$
|
final IGDBTraceControl traceControl = getService(IGDBTraceControl.class);
|
||||||
|
if (traceControl != null) {
|
||||||
|
traceControl.getTraceStatus(
|
||||||
|
ctx, new DataRequestMonitor<ITraceStatusDMData>(getSession().getExecutor(), null) {
|
||||||
|
@Override
|
||||||
|
protected void handleCompleted() {
|
||||||
|
String traceStatus = EMPTY_STRING;
|
||||||
|
if (isSuccess() && getData() != null) {
|
||||||
|
fTracingSupported = getData().isTracingSupported();
|
||||||
|
if (fTracingSupported) {
|
||||||
|
traceStatus = getData().toString();
|
||||||
|
if (traceStatus.length() > 0) {
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); //$NON-NLS-1$
|
||||||
|
|
||||||
content = TracepointsMessages.TraceControlView_trace_view_content_updated_label +
|
traceStatus = TracepointsMessages.TraceControlView_trace_view_content_updated_label +
|
||||||
sdf.format(cal.getTime()) + "\n" + status; //$NON-NLS-1$
|
sdf.format(cal.getTime()) + "\n" + traceStatus; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
fStatusText.setText(content);
|
}
|
||||||
updateActionEnablement();
|
} else {
|
||||||
}});
|
fTracingSupported = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String retrieveStatus() {
|
final String finalStatus = traceStatus;
|
||||||
if (fDebugSessionId == null || getSession() == null) {
|
asyncExec(new Runnable() {
|
||||||
return EMPTY_STRING;
|
public void run() {
|
||||||
}
|
fStatusText.setText(finalStatus);
|
||||||
|
updateActionEnablement();
|
||||||
final ITraceTargetDMContext ctx = DMContexts.getAncestorOfType(fTargetContext, ITraceTargetDMContext.class);
|
}});
|
||||||
if (ctx == null) {
|
}
|
||||||
return EMPTY_STRING;
|
});
|
||||||
}
|
} else {
|
||||||
|
fTracingSupported = false;
|
||||||
Query<ITraceStatusDMData> query = new Query<ITraceStatusDMData>() {
|
|
||||||
@Override
|
|
||||||
protected void execute(DataRequestMonitor<ITraceStatusDMData> rm) {
|
|
||||||
final IGDBTraceControl traceControl = getService(IGDBTraceControl.class);
|
|
||||||
if (traceControl != null) {
|
|
||||||
traceControl.getTraceStatus(ctx, rm);
|
|
||||||
} else {
|
|
||||||
rm.setData(null);
|
|
||||||
rm.done();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
try {
|
|
||||||
getSession().getExecutor().execute(query);
|
|
||||||
ITraceStatusDMData data = query.get();
|
|
||||||
if (data != null) {
|
|
||||||
fTracingSupported = data.isTracingSupported();
|
|
||||||
if (fTracingSupported) return data.toString();
|
|
||||||
} else {
|
|
||||||
fTracingSupported = false;
|
|
||||||
}
|
|
||||||
} catch (InterruptedException exc) {
|
|
||||||
} catch (ExecutionException exc) {
|
|
||||||
}
|
|
||||||
|
|
||||||
return EMPTY_STRING;
|
asyncExec(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
fStatusText.setText(EMPTY_STRING);
|
||||||
|
updateActionEnablement();
|
||||||
|
}});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fStatusText.setText(EMPTY_STRING);
|
||||||
|
updateActionEnablement();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void exitVisualizationMode() {
|
protected void exitVisualizationMode() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue