Clicking on a row in the project tree doesn't open the file anymore

Answered

https://youtrack.jetbrains.com/issue/WEB-43113

In short, I have this issue when clicking on a file in the project tree do not open the file anymore in my plugin.

What caused this: I replaced the DefaultTreeUI component by my version of TreeUI. To make sure I won't be missing any features of the DefaultTreeUI I copied-pasted the DefaultTreeUI methods, replacing only what I need to replace.

However I still have this issue, even after reverting all my changes, and just using DefaultTreeUI methods. I suspect there is some part in the code that assumes that there can only by a DefaultTreeUI component. Can someone help me figure out this?

12 comments
Comment actions Permalink

It is not recommended to create custom TreeUI. Which functionality do you want to add here?

0
Comment actions Permalink

I don’t know if you know the material theme plugin, but the concept of the plugin is to change the UI components. Therefore I have my own instance of TreeUI replacing your version.

In my version the user can control the look of the arrows as well as adding an indicator of the current selected file.

I think I can get around this issue now thanks to Aleksei but just so you know this is a bit problematic to have hardcoded class names checks.

0
Comment actions Permalink

You can configure icons and other properties via UIDefaults.

0
Comment actions Permalink

It’s not just about icons, it’s about the ability to customize the UI components however I want to. Why would you have the property “TreeUI” in UIDefaults if you can’t replace it with your own version?

0
Comment actions Permalink

Because many developers ignore the main Swing rule - call all methods from EDT. This leads to different multi-threading issues, which I'm trying to solve in the DefaultTreeUI.

0
Comment actions Permalink

No problem then - just make the DefaultTreeUI extendable then. This way I can simply extend the class to change only the parts that interest me.

0
Comment actions Permalink

It's API is not finished yet. Maybe later.

Which parts you want to extend? Something related to offsets can be configured via com.intellij.ui.tree.ui.Control.Painter:

ApplicationManager.getApplication().putUserData(Control.Painter.KEY, new Control.Painter() ... );

 

 

0
Comment actions Permalink

Hmm interesting... I'll check if that meets my requirements. Thanks

0
Comment actions Permalink

Actually, we already have UI settings in the Appearance configurable, which allows to switch on compact mode and to show indent guides.

0
Comment actions Permalink

Yes I know about this, this is not what I want, rather I have implemented a new Control.Painter which I use to render the selected file indicator (http://www.material-theme.com/blog/whats-new-in-2-5/#selected-tree-indicator-styles)

It works with my version of the TreeUI but if I can use DefaultTreeUI and change the Control.Painter to my own that would do the trick.

0
Comment actions Permalink

Oh, I see. So the custom Control.Painer should help.

0

Please sign in to leave a comment.