mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 336961: selectTraceRecord() should not update the UI because it can be used for background activities.
This commit is contained in:
parent
82ffa32f82
commit
ec88491764
3 changed files with 41 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2010 Ericsson and others.
|
* Copyright (c) 2010, 2011 Ericsson and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -10,15 +10,19 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.gdb.internal.ui.commands;
|
package org.eclipse.cdt.dsf.gdb.internal.ui.commands;
|
||||||
|
|
||||||
|
import java.util.Hashtable;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.RejectedExecutionException;
|
import java.util.concurrent.RejectedExecutionException;
|
||||||
|
|
||||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
|
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.Query;
|
import org.eclipse.cdt.dsf.concurrent.Query;
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
||||||
import org.eclipse.cdt.dsf.gdb.internal.commands.ISelectNextTraceRecordHandler;
|
import org.eclipse.cdt.dsf.gdb.internal.commands.ISelectNextTraceRecordHandler;
|
||||||
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
|
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
|
||||||
|
import org.eclipse.cdt.dsf.gdb.service.GDBTraceControl_7_2.TraceRecordSelectedChangedEvent;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl;
|
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceRecordDMContext;
|
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceRecordDMContext;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceStatusDMData;
|
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceStatusDMData;
|
||||||
|
@ -38,13 +42,16 @@ import org.eclipse.debug.core.commands.IEnabledStateRequest;
|
||||||
*
|
*
|
||||||
* @since 2.1
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("restriction")
|
||||||
public class GdbSelectNextTraceRecordCommand extends AbstractDebugCommand implements ISelectNextTraceRecordHandler {
|
public class GdbSelectNextTraceRecordCommand extends AbstractDebugCommand implements ISelectNextTraceRecordHandler {
|
||||||
private final DsfExecutor fExecutor;
|
private final DsfExecutor fExecutor;
|
||||||
private final DsfServicesTracker fTracker;
|
private final DsfServicesTracker fTracker;
|
||||||
|
private final DsfSession fSession;
|
||||||
|
|
||||||
public GdbSelectNextTraceRecordCommand(DsfSession session) {
|
public GdbSelectNextTraceRecordCommand(DsfSession session) {
|
||||||
fExecutor = session.getExecutor();
|
fExecutor = session.getExecutor();
|
||||||
fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
|
fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
|
||||||
|
fSession = session;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
@ -73,8 +80,14 @@ public class GdbSelectNextTraceRecordCommand extends AbstractDebugCommand implem
|
||||||
new DataRequestMonitor<ITraceRecordDMContext>(fExecutor, rm) {
|
new DataRequestMonitor<ITraceRecordDMContext>(fExecutor, rm) {
|
||||||
@Override
|
@Override
|
||||||
protected void handleSuccess() {
|
protected void handleSuccess() {
|
||||||
ITraceRecordDMContext nextDmc = traceControl.createNextRecordContext(getData());
|
final ITraceRecordDMContext nextDmc = traceControl.createNextRecordContext(getData());
|
||||||
traceControl.selectTraceRecord(nextDmc, rm);
|
traceControl.selectTraceRecord(nextDmc, new RequestMonitor(ImmediateExecutor.getInstance(), rm) {
|
||||||
|
@Override
|
||||||
|
protected void handleSuccess() {
|
||||||
|
fSession.dispatchEvent(new TraceRecordSelectedChangedEvent(nextDmc), new Hashtable<String, String>());
|
||||||
|
rm.done();
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2010 Ericsson and others.
|
* Copyright (c) 2010, 2011 Ericsson and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -10,16 +10,20 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.gdb.internal.ui.commands;
|
package org.eclipse.cdt.dsf.gdb.internal.ui.commands;
|
||||||
|
|
||||||
|
import java.util.Hashtable;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.RejectedExecutionException;
|
import java.util.concurrent.RejectedExecutionException;
|
||||||
|
|
||||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
|
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.Query;
|
import org.eclipse.cdt.dsf.concurrent.Query;
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
||||||
import org.eclipse.cdt.dsf.gdb.internal.commands.ISelectPrevTraceRecordHandler;
|
import org.eclipse.cdt.dsf.gdb.internal.commands.ISelectPrevTraceRecordHandler;
|
||||||
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
|
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl;
|
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl;
|
||||||
|
import org.eclipse.cdt.dsf.gdb.service.GDBTraceControl_7_2.TraceRecordSelectedChangedEvent;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceRecordDMContext;
|
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceRecordDMContext;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceStatusDMData;
|
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceStatusDMData;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceTargetDMContext;
|
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceTargetDMContext;
|
||||||
|
@ -38,13 +42,16 @@ import org.eclipse.debug.core.commands.IEnabledStateRequest;
|
||||||
*
|
*
|
||||||
* @since 2.1
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("restriction")
|
||||||
public class GdbSelectPrevTraceRecordCommand extends AbstractDebugCommand implements ISelectPrevTraceRecordHandler {
|
public class GdbSelectPrevTraceRecordCommand extends AbstractDebugCommand implements ISelectPrevTraceRecordHandler {
|
||||||
private final DsfExecutor fExecutor;
|
private final DsfExecutor fExecutor;
|
||||||
private final DsfServicesTracker fTracker;
|
private final DsfServicesTracker fTracker;
|
||||||
|
private final DsfSession fSession;
|
||||||
|
|
||||||
public GdbSelectPrevTraceRecordCommand(DsfSession session) {
|
public GdbSelectPrevTraceRecordCommand(DsfSession session) {
|
||||||
fExecutor = session.getExecutor();
|
fExecutor = session.getExecutor();
|
||||||
fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
|
fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
|
||||||
|
fSession = session;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
@ -73,8 +80,14 @@ public class GdbSelectPrevTraceRecordCommand extends AbstractDebugCommand implem
|
||||||
new DataRequestMonitor<ITraceRecordDMContext>(fExecutor, rm) {
|
new DataRequestMonitor<ITraceRecordDMContext>(fExecutor, rm) {
|
||||||
@Override
|
@Override
|
||||||
protected void handleSuccess() {
|
protected void handleSuccess() {
|
||||||
ITraceRecordDMContext prevDmc = traceControl.createPrevRecordContext(getData());
|
final ITraceRecordDMContext prevDmc = traceControl.createPrevRecordContext(getData());
|
||||||
traceControl.selectTraceRecord(prevDmc, rm);
|
traceControl.selectTraceRecord(prevDmc, new RequestMonitor(ImmediateExecutor.getInstance(), rm) {
|
||||||
|
@Override
|
||||||
|
protected void handleSuccess() {
|
||||||
|
fSession.dispatchEvent(new TraceRecordSelectedChangedEvent(prevDmc), new Hashtable<String, String>());
|
||||||
|
rm.done();
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -684,8 +684,15 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
|
||||||
// Workaround for GDB pre-release where we don't get the details
|
// Workaround for GDB pre-release where we don't get the details
|
||||||
// of the frame when we load a trace file.
|
// of the frame when we load a trace file.
|
||||||
// To get around this, we can force a select of record 0
|
// To get around this, we can force a select of record 0
|
||||||
ITraceRecordDMContext initialRecord = createTraceRecordContext(context, "0"); //$NON-NLS-1$
|
final ITraceRecordDMContext initialRecord = createTraceRecordContext(context, "0"); //$NON-NLS-1$
|
||||||
selectTraceRecord(initialRecord, rm);
|
selectTraceRecord(initialRecord, new RequestMonitor(ImmediateExecutor.getInstance(), rm) {
|
||||||
|
@Override
|
||||||
|
protected void handleSuccess() {
|
||||||
|
// This event will indicate to the other services that we are visualizing trace data.
|
||||||
|
getSession().dispatchEvent(new TraceRecordSelectedChangedEvent(initialRecord), getProperties());
|
||||||
|
rm.done();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -911,9 +918,6 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
|
||||||
fCurrentRecordDmc = context;
|
fCurrentRecordDmc = context;
|
||||||
fTracepointIndexForTraceRecord = getData().getTraceRecord().getTracepointId();
|
fTracepointIndexForTraceRecord = getData().getTraceRecord().getTracepointId();
|
||||||
|
|
||||||
// This event will indicate to the other services that we are visualizing trace data.
|
|
||||||
getSession().dispatchEvent(new TraceRecordSelectedChangedEvent(context), getProperties());
|
|
||||||
|
|
||||||
// We could rely on the TraceRecordSelectedChangedEvent to update all the views, but this
|
// We could rely on the TraceRecordSelectedChangedEvent to update all the views, but this
|
||||||
// would require a lot of changes.
|
// would require a lot of changes.
|
||||||
// Notice that looking at a new trace record should behave in the same manner
|
// Notice that looking at a new trace record should behave in the same manner
|
||||||
|
|
Loading…
Add table
Reference in a new issue