IDEA-93113 Don't show incoming changes and warn about outdated version if incoming changes are not supported by the VCS committed changes provider.

This commit is contained in:
Kirill Likhodedov
2012-10-18 20:14:57 +04:00
parent a2be6066cf
commit cbc7614e09
2 changed files with 12 additions and 5 deletions
@@ -22,10 +22,7 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.AbstractVcs;
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
import com.intellij.openapi.vcs.VcsBundle;
import com.intellij.openapi.vcs.VcsListener;
import com.intellij.openapi.vcs.*;
import com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager;
import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList;
import com.intellij.openapi.wm.*;
@@ -98,7 +95,8 @@ public class IncomingChangesIndicator {
private boolean needIndicator() {
final AbstractVcs[] vcss = ProjectLevelVcsManager.getInstance(myProject).getAllActiveVcss();
for (AbstractVcs vcs : vcss) {
if (vcs.getCachingCommittedChangesProvider() != null) {
CachingCommittedChangesProvider provider = vcs.getCachingCommittedChangesProvider();
if (provider != null && provider.supportsIncomingChanges()) {
return true;
}
}
@@ -25,6 +25,7 @@ import com.intellij.openapi.fileEditor.FileEditorManagerListener;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.vcs.CachingCommittedChangesProvider;
import com.intellij.openapi.vcs.VcsBundle;
import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList;
@@ -150,6 +151,9 @@ public class OutdatedVersionNotifier implements ProjectComponent {
}
private void initPanel(final CommittedChangeList list, final Change c, final FileEditor editor) {
if (!isIncomingChangesSupported(list)) {
return;
}
final OutdatedRevisionPanel component = new OutdatedRevisionPanel(list, c);
editor.putUserData(PANEL_KEY, component);
myFileEditorManager.addTopComponent(editor, component);
@@ -205,4 +209,9 @@ public class OutdatedVersionNotifier implements ProjectComponent {
updateLabelText(c);
}
}
private static boolean isIncomingChangesSupported(@NotNull CommittedChangeList list) {
CachingCommittedChangesProvider provider = list.getVcs().getCachingCommittedChangesProvider();
return provider != null && provider.supportsIncomingChanges();
}
}