how to display .class file and popup custom menu when Cilck VirtualFiles item

Answered

I use changesTreeImpl.VirtualFiles   to show the specific file list ,  and I want show decompiled file when click the item  and popup my menu when right click. what should I do?

when click the Calc.java, I want display this file , right click to  popup menu . now I got nothing both actions.

1
1 comment

already resovled, display file by using

VirtualFileList.getSelectionModel().addTreeSelectionListener(x->
{
if(x.getPath()!= null) {
Object lastPathComponent = x.getPath().getLastPathComponent();
if (lastPathComponent instanceof ChangesBrowserFileNode) {
VirtualFile userObject = ((ChangesBrowserFileNode)lastPathComponent).getUserObject();
FileEditorManager.getInstance(project).openFile((userObject),true);
}
}
});
VirtualFileList#setComponentPopupMenu  to add popupMenu
0

Please sign in to leave a comment.