ui component for verifying local binary path
Answered
In the Intellij Dlanguage plugin we have a tool window in which users can set paths to various local binaries that we require:
I was looking at the what's new page for CLion and noticed that there's similar UI for setting the path to cmake:
I'd like to update our plugin so that it has the same look. As it's a common use case I expect there is a custom JB component that we can use rather than make it all up from scratch. Can someone let me know what class to look for or an example code snippet for that screen within CLion.
Please sign in to leave a comment.
What exactly you mean by the "common case"? This is just a form. With labels and inputs.
CLion source code is not open, so we cannot provide you a link to the implantation. But it's regular UI form which uses common components.
For creating animation you can use `com.intellij.util.ui.Animator` class.
Thanks Vasily that helps. I expected that perhaps the components would all have been put into a single Component so that they can be reused easily. On that screenshot alone there's 4 tools that all use the same components. As you guys can see the source you have the option to copy'n'paste it then tweak but for plugin devs to create UI that is exactly the same it can be awkward without a predefined component.
I'll try to get something looking the same by adding a SimpleColoredComponent, and JBLabel under the ComboboxWithBrowseButton we use but I suspect it'll won't look identical. It would be good to have a consistent UX.
It's taken ages but I'm getting closer to putting together the layout in a way that's similar. Nothing functional yet, I'm just trying to get it to look correct.
At first I was unsure which layout to go for. I'd tried val rootPanel = JBPanel<BorderLayoutPanel>() and val rootPanel = JPanel(GridBagLayout()) but have settled on using val rootPanel = JPanel(GridLayoutManager(2,2)) as I guessed that was the better way to go. Any thoughts on those options would be appreciated.
I also found the icon to use when I successfully select the desired binary: AllIcons.General.InspectionsOK
There's also problems around getting the sizing right. Did you guys just set dimensions as Dimension(-1, -1) and set the appropriate size policy to handle the rest?
I still think, as per the original question that this should be a reusable component. A class that extends ComboboxWithBrowseButton with easy to configure auto-detection based off some lambda and also the option to show the output of calling the selected binary with --version (by default) and showing it below the combobox without the need for adding the label separately. I know I need this in more than one screen just for my plugin.