When is FileHistoryPanel.refresh() called?

Hi,

I have a custom implementation of FileHistoryPanel using PanelWithActionsAndCloseButton. I use the Standard VCS Tool Window to show this panel and the setup works for me. Except for one case.

I need fine grained control over when the history data is to be refreshed after it has been marked as stale. Specifically this has to happen when the custom FileHistoryPanel implementation becomes visible in the VCS tool window. This can happen as a result of either activation of the VCS tool window or when the tab corresponding to the particular panel is selected. How can I trap this event?

Does the FileHistoryPanel.refresh() correspond to this? Exactly when is this called? I have tried trapping the call of this method but I notice that it is never called by the framework.

Please help.

thanks
dk

2 comments
Comment actions Permalink

Hi,

I have seen the following post.
http://intellij.net/forums/thread.jspa?messageID=5201369??

I have the same problem as faced by the person in the above thread.

I have tried adding a FocusListener on the JPanel as follows but it does not work as expected.

protected JComponent createCenterPanel() {
...
JPanel centerPanel = new JPanel(new BorderLayout());
centerPanel.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent e) {
...
}

public void focusLost(FocusEvent e) {
...
}
});

return centerPanel;
}

thanks
dk

Message was edited by:
Dhwani Katagade

0
Comment actions Permalink

Hi All,

I found out a way to refresh my history panel when the tab is clicked.

I added a ContentManagerListener to the content manager.

ContentManager contentManager = ProjectLevelVcsManagerEx.getInstanceEx(project).getContentManager();
contentManager.addContentManagerListener(listener);

In the selectionChanged(...) method of the listener I have checked for the needsUpdate flag and updated the history data.

This works for me.

thanks
dk

0

Please sign in to leave a comment.