Hi,
As you said I tried to get the
status from RunControl service.
As said in mail below, just
captured the current debug context; please verify the code below
if(event.getContext() instanceof IStructuredSeletion){
IStructuredSelection selection =
(IStructuredSelection) event.getContext();
Object obj =
selection.getFirstElement();
IDMVMContext
context = (IDMVMContext) obj;
IDMContext
dmContext = context.getDMContext();
if (dmContext instanceof
IExecutionDMContext) {
IExecutionDMContext execContext = (IExecutionDMContext) dmContext;
serviceFactory.getRunControl().isSuspended(execContext);
// returns status
of currently selected thread id of stackframe
}
}
Its showing the selected thread
status correctly;
As per my requirement whenever the
debug view selection changes(user selecting stackframes by mouse clicks) the thread
status should be updated.
Hence I think using IDebugContextListener
is more suited than DebugUITools.getDebugContext(); Am I correct?
Anyways….Thanks a lot…
Malu
From: cdt-dev-bounces@xxxxxxxxxxx
[mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Marc Khouzam
Sent: Monday, April 30, 2012 7:15 PM
To: 'CDT General developers list.'
Subject: Re: [cdt-dev] How to obtain the current thread status from
Launchview.
Hi,
You can get the status of the thread by using the IRunControl
service.
You can look at an example in
AbstractThreadVMNode.updatePropertiesInSessionThread()
in the org.eclipse.cdt.dsf.ui plugin.
Also, I'm not sure what your exact scenario is, so just in case,
besides using
IDebugContextListener which tells you when the active context
changes, you could
use DebugUITools.getDebugContext() to get the current context.
Marc
From: cdt-dev-bounces@xxxxxxxxxxx
[mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Malu Sasi
Sent: Friday, April 27, 2012 8:27 AM
To: CDT General developers list.
Subject: [cdt-dev] How to obtain the current thread status from Launch
view.
Hi,
I would like to know if it is possible to get the status of thread currently selected (Resume/Suspend/Terminate) from Launch view?
I tried out by registering to IDebugContextListener. In
case where multiple threads are listed, while switching between the threads, debugContextChanged(DebugContextEvent
event) , gets invoked.
From the event we get the TreeSelection, and I managed to
get the thread id from it as below:
if(event.getContext() instanceof IStructuredSeletion){
IStructuredSelection selection =
(IStructuredSelection) event.getContext();
Object obj =
selection.getFirstElement();
if (obj instanceof IDMVMContext) {
IDMContext
dmContext = = ((IDMVMContext) obj).getDMContext();
if (dmContext instanceof
IMIExecutionDMContext) {
IMIExecutionDMContext
execContext = (IMIExecutionDMContext) dmContext;
execContext.getThreadId());
// returns the currently selected thread id of stackframe
}
}
}
Kindly let me know if it is possible to get the status of
thread (running/suspended/terminated)
Or if there is any other better method?
Thanks in advance,
Malu
*****
Confidentiality Statement/Disclaimer *****
This message and any attachments is intended for the sole use of the intended
recipient. It may contain confidential information. Any unauthorized use,
dissemination or modification is strictly prohibited. If you are not the
intended recipient, please notify the sender immediately then delete it from
all your systems, and do not copy, use or print. Internet communications are
not secure and it is the responsibility of the recipient to make sure that it
is virus/malicious code exempt.
The company/sender cannot be responsible for any unauthorized alterations or
modifications made to the contents. If you require any form of confirmation of
the contents, please contact the company/sender. The company/sender is not
liable for any errors or omissions in the content of this message.