Providing custom FileHistoryPanel impl
We need to provide some additional controls and a custom layout on the FileHistoryPanel.
As I learn from previous posts, it is not possible to add things like a Combobox to the toolbar of the default FileHistoryPanel implementation. Is this still true?
Perhaps we can have a custom implementation of the FileHistoryPanel interface. But how can we plug in this implementation to the IntelliJ framework so that the AbstractVcsHelperImpl.showFileHistory() method uses this implementation instead of the default one?
Please sign in to leave a comment.
Hello Dhwani,
It's not possible to plug a custom implementation of the FileHistoryPanel
interface into AbstractVcsHelper.showFileHistory(), but there's not much
logic in that method, and you can easily duplicate that in your code.
You can use ProjectLevelVcsManagerEx.getInstanceEx(project).getContentManager()
to get the content manager for the standard VCS toolwindow.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Hi Dmitry,
What we actually need to do is extend the functionality available on the default FileHistoryPanel. We need two tables and a text area apart from a few other controls.
So are you suggesting that we will have to write our own CustomHistoryAction instead of using TabbedShowHistoryAction. And from this action class we can invoke our custom implementation of the FileHistoryPanel interface.
But how can we use the snippet that you mentioned in this context? What I understand is that the method getContentManager() gets the content manager of the standard VCS toolwindow, and we do not want to use the standard one. Because there is no way to add components to it to suit our requirement.
Kindly clarify my doubt. I am new to the framework.
dk
Hello Dhwani,
Yes, that's basically correct.
The VCS toolwindow is basically a container for different kinds of tabs,
and one of the types of tabs that can be shown here is the standard file
history tab. Even if you provide a different type of tab for your file history
implementation, you can still display it in the same toolwindow.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Hi Dmitry,
Please just verify if I am on the right path.
So I will have to retrieve the ContentManager and then create a Content instance corresponding to my implementation of the FileHistpryPanel implementation and then add it to the ContentManager. Something like this?
ContentManager cm = ProjectLevelVcsManagerEx.getInstanceEx(myVcs.getProject()).getContentManager();
ContentFactory cf = PeerFactory.getInstance().getContentFactory();
Content con = cf.createContent( new MyFileHistoryPanel( ... ), "Blah Blah", true);
And this piece of code goes in the actionPerformed of my CustomHistoryAction.
Am I right? Thanks in advance.
dk
Hello Dhwani,
Yes, this looks correct.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Hi Dmitry,
Thanks a lot. :)
regards
dk
Hi Dmitry,
There's one small question. I could not find the class ProjectLevelVcsManagerEx in the html documentation for idea-6.0.5-plugin-development-kit. How safe would it be to use this apparently unpublished class?
dk
Hello Dhwani,
Safe enough. :) This part of code hasn't changed for a long time.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"