Custom debugger action
I have little background OpenApi and on developing Intellij plugins. I have in mind developing my own debugger action that could work as plugin. I want to develop an action that will be used when debugger stops at File object.
This what I have so far:
public class ViewFileAction extends DebuggerAction {
@Override
public void update(AnActionEvent e) {
Presentation presentation = e.getPresentation();
DataContext dataContext = e.getDataContext();
DebuggerTreeNodeImpl selectedNode = getSelectedNode(dataContext);
Value value = getValue(selectedNode);
boolean isFile = isFileType(value);
boolean isObjectRef = value instanceof ObjectReference;
if (!isFile || !isObjectRef) {
presentation.setVisible(false);
return;
}
presentation.setEnabled(true);
presentation.setText("View File");
}
@Override
public void actionPerformed(AnActionEvent e) {
// once performed action (clicked on "View File presentation")
// try to get all data from file object from current debugging context
// [code redacted]
}
}
From this class I have other implementation for `File` type resolving, which are irrelevant in this case.
I have successfully exported the plugin and installed on Intellij. When I run the debugger of the running Intellij instance (the one that starts when you run a Plugin Developement project) when the debugger hits the breakpoint that has File object in context and line, I don't see the View File on the debugging node.
- Can custom Debugger actionswork from plugins?
- What I'm missing here I run the plugin?
- How do I debug a project that works with a debugger on another project?
- Do I explicitly need to run the plugin in debugging mode intellij instance in order to see the debugger action?
- Wouldn't it be better if I just write custom data type renderer?
This ""plugin"" will work on both Intellij IDEA and Android Studio
Please sign in to leave a comment.
Hi, have you registered the action in plugin.xml?
Yes I did register the action, but not sure in which group I should add it, in order to see the action text debugger node (I hope thats the correct terminology)
See image
---------------------------------------------------------------------------------------------------------------------------------------
| File@12345 | { File something something } View File|
_____________________________________________________________________________
Currently this is how I register the plugin:
I have tried different `group-id`s from Debugger group, but no luck.
Debugger groups have moved to the general infrastructure, please use:
Thanks Egor, I've encounter another impediment, "com.sun.jdi.Value" is not recognized (PluginClassLoader fails to load class because it already loaded class with same name "com.sun.jdi.ObjectReference" although I have added tools.jar (jdk 8) to classpath. Should I use com.intellij.debugger.jdi. instead?
Where do you get the Value?
where does this getValue method come from?
Egor, I have changed the code a little bit more after experimenting with XDebugger
This is how I get current selection and value from the descriptior, which returns com.sun.jdi.ObjectReferenceImpl which is Value implementation. Any thoughts?
I'm not sure what it could be, how do you build the plugin? com.sun.jdi.ObjectReference does not look like the same name as com.sun.jdi.Value...