If you don't have a selection in a view, then the session is based on the active debug context (the selection in the debug view):
IAdaptable debugContext = DebugUITools.getDebugContext();
if (debugContext instanceof IDMVMContext) {
sessionId = ((IDMVMContext)debugContext).getDMContext().getSessionId();
} else if (debugContext instanceof GdbLaunch) {
GdbLaunch gdbLaunch = (GdbLaunch)debugContext;
if (gdbLaunch.isTerminated() == false) {
sessionId = gdbLaunch.getSession().getId();
}
} else if (debugContext instanceof GDBProcess) {
ILaunch launch = ((GDBProcess)debugContext).getLaunch();
if (launch.isTerminated() == false &&
launch instanceof GdbLaunch) {
sessionId = ((GdbLaunch)launch).getSession().getId();
}
}
From: laskava@xxxxxxxxx [laskava@xxxxxxxxx] on behalf of Alena Laskavaia [elaskavaia.cdt@xxxxxxxxx]
Sent: January 16, 2015 11:50 AM
To: Marc Khouzam; CDT General developers list.
Subject: Re: [cdt-dev] Globals in Variables view
Marc do you know how to get Dsf session without selection? For example from the view itself? Or there is some context?
I checked Add Register Group command and it only works if you have selection (even it seems like
this command should not be selection dependent). I need to add command that work without selection (Add Local Variables Group)