0

So, I am developing an Eclipse plugin and trying to build a View similiar to the Variables View. Now, to get the selected StackFrame from the Debug View, I have registered an IDebugContextListener, which ultimately calls the method listed below in case of a selection. The problem is that I ma unable to get a IStackFrame object from IStructuredSelection.getFirstElement(). I also tried to get an adapter for the IStackframe class. That too didn't work. I would really appreciate if someone can point me the method of getting a IStackFrame object from a selection.

private void contextActivated(ISelection context) {
    if (context instanceof StructuredSelection) {
        System.out.println("a");
        Object data = ((StructuredSelection) context).getFirstElement();
        if (data instanceof IStackFrame) {
             System.out.println("yes");
        } else {
             System.out.println("no" + data.getClass().getName());
        }
    }
}

The issue with this is that it always execute the else part (even when the selection is a StackFrame in the debug view). Also, the adapter approach didn't work.

Manav Garg
  • 512
  • 1
  • 3
  • 17
  • So what does `data.getClass().getName()` say? – greg-449 Apr 14 '16 at 07:02
  • It always prints out the following class name: "org.eclipse.cdt.dsf.ui.viewmodel.datamodel.AbstractDMVMNode.DMVMContext" I am not sure how to get the IStackframe from this – Manav Garg Apr 14 '16 at 14:59

0 Answers0