Eclipse Plugin Dev- Extracting IStackFrame object from selection in Debug View

早过忘川 提交于 2019-12-12 02:07:56

问题


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.

来源:https://stackoverflow.com/questions/36615273/eclipse-plugin-dev-extracting-istackframe-object-from-selection-in-debug-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!