Structure View questions
Answered
Hi, all! I would like to amend a bit Structure View tab and add possibility to copy/paste/move methods using that tool. Currently I've found only StructureViewPopupMenu which apears by right click on element. But I've not found how I could add new button to StructureView panel. Is it possible?
If so, how can I enable/disable that button if selection is empty?
Also I've found the way to obtain PsiElement from AnAction event, which is related to current selection in StructureView, but how can I get list of provided elements?
And last but not least) How can I override standard action from menu?
Thx )
Please sign in to leave a comment.
Hi,
e.getData(LangDataKeys.PSI_ELEMENT_ARRAY)
If the latter, then you may try to find it in the data context by using some keys from CommonDataKeys class (e.g. NAVIGATABLE) and inspecting available objects for the data you need.
You can customize menu in the popup with PopupHandler.installPopupMenu:
But this requires custom structure view implementation again. See example:
https://github.com/JetBrains/intellij-community/blob/master/plugins/properties/properties-resource-bundle-editor/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewComponent.java#L87-L93
Thx a lot for your answers!