Questions about structure view


I implemented a structure view in my custom language plugin, but I have two questions related to this:

- my StructureViewModel implements StructureViewModel.ExpandInfoProvider to automatically collapse certains nodes, but why does it only work in the structure tool window, not the popup?
- how can I add more than one color in a StructureViewTreeElement's label? It seems that PresentationData supports it via its myColoredText attribute, but it's never populated in PresentationData.updateFrom(ItemPresentation presentation)

For the second question, it seems that the only way to achieve this is to create a whole new component for the structure view, I didn't find any way to override TreeElementWrapper#update(PresentationData presentation).
Perhaps you could add a method named getColoredFragments() in ColoredItemPresentation, or add a new interface like ColoredFragmentAware, and handle this change in PresentationData.updateFrom(ItemPresentation presentation) ?

Comment actions Permalink

In relation to question1: I also created a InheritedMembersNodeProvider to show parent members, but they are only shown in the tool window, not in the popup?!

Comment actions Permalink

Also, I noticed a strange thing: I have a filter that implements FileStructureFilter, so that it's also shown in the structure popup. Note that this filter is not reverted. Now, when I open the structure popup, the nodes matched by the filters are not displayed, although the checkbox is not checked. The correct behaviour should be: the nodes shouldn't be displayed only if the checkbox is checked (unless the filter is reverted).

I traced it down to FileStructurePopup#addCheckbox(JPanel, TreeAction), which assumes the filter is always reverted:

myTreeActionsOwner.setActionIncluded(action, action instanceof FileStructureFilter ? !selected : selected);

So in my case, if the checkbox is not selected, the filter is applied and nodes are removed. I think the correct impl should be:

myTreeActionsOwner.setActionIncluded(action, action instanceof FileStructureFilter && ((FileStructureFilter) action).isReverted() ? !selected : selected);

The only implementations I found is PyInheritedMembersFilter, and the old JavaAnonymousMembersFilter[1], which are both reverted filters, so I guess my problem never occured.

Should I open an issue for this?


Comment actions Permalink

Hello Bastien!
Good catch! Also, I think we should add extra check a few lines below as well. Take a look at the patch attached

Comment actions Permalink

Yes, I saw that too. I submitted an issue to track the bug and a created a PR a few hours ago to fix it:

I also made a similar change in FileStructureDialog, even though I don't know where it's used.

About my other problems, I submitted a second PR to allow multiple colors in nodes shown in the structure view:

I would be grateful if you could merge those pull requests :)


Comment actions Permalink

Is the behavior in the following screenshot normal?

Capture d’écran 2015-07-09 à 09.40.58.png

The tool window shows members inherited from Object in both classes, but the popup does not show every inherited member under Test2, because it considers they are duplicates of those under Test1. In my opinion, this is not the correct behavior. What do you think?


Please sign in to leave a comment.