changes view toolwindow refactored to use bean: no initial availability check

This commit is contained in:
Dmitry Avdeev
2016-09-21 16:48:35 +03:00
parent b194eb876f
commit 00adb8ede6
3 changed files with 2 additions and 14 deletions
@@ -41,8 +41,7 @@
<colorAndFontDescriptorProvider implementation="com.intellij.openapi.vcs.actions.VcsColorsPageFactory"/> <colorAndFontDescriptorProvider implementation="com.intellij.openapi.vcs.actions.VcsColorsPageFactory"/>
<toolWindow id="Version Control" anchor="bottom" canCloseContents="true" icon="AllIcons.Toolwindows.ToolWindowChanges" <toolWindow id="Version Control" anchor="bottom" canCloseContents="true" icon="AllIcons.Toolwindows.ToolWindowChanges"
factoryClass="com.intellij.openapi.vcs.changes.ui.ChangesViewToolWindowFactory" factoryClass="com.intellij.openapi.vcs.changes.ui.ChangesViewToolWindowFactory"/>
conditionClass="com.intellij.openapi.vcs.changes.ui.ChangesViewToolWindowFactory"/>
<changesViewContent tabName="Repository" className="com.intellij.openapi.vcs.changes.committed.CommittedChangesViewManager" <changesViewContent tabName="Repository" className="com.intellij.openapi.vcs.changes.committed.CommittedChangesViewManager"
predicateClassName="com.intellij.openapi.vcs.changes.committed.CommittedChangesVisibilityPredicate"/> predicateClassName="com.intellij.openapi.vcs.changes.committed.CommittedChangesVisibilityPredicate"/>
@@ -17,8 +17,6 @@ package com.intellij.openapi.vcs.changes.ui;
import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
import com.intellij.openapi.wm.ToolWindow; import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowFactory; import com.intellij.openapi.wm.ToolWindowFactory;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -26,15 +24,9 @@ import org.jetbrains.annotations.NotNull;
/** /**
* @author Dmitry Avdeev * @author Dmitry Avdeev
*/ */
public class ChangesViewToolWindowFactory implements ToolWindowFactory, DumbAware, Condition<Project> { public class ChangesViewToolWindowFactory implements ToolWindowFactory, DumbAware {
@Override @Override
public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) { public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
ChangesViewContentManager.getInstance(project).setUp(toolWindow); ChangesViewContentManager.getInstance(project).setUp(toolWindow);
} }
@Override
public boolean value(Project project) {
ProjectLevelVcsManager manager = ProjectLevelVcsManager.getInstance(project);
return manager.getAllActiveVcss().length > 0;
}
} }
@@ -107,9 +107,6 @@ public class NewMappings {
public AbstractVcs[] getActiveVcses() { public AbstractVcs[] getActiveVcses() {
synchronized (myLock) { synchronized (myLock) {
if (!myActivated) {
activateActiveVcses();
}
final AbstractVcs[] result = new AbstractVcs[myActiveVcses.length]; final AbstractVcs[] result = new AbstractVcs[myActiveVcses.length];
System.arraycopy(myActiveVcses, 0, result, 0, myActiveVcses.length); System.arraycopy(myActiveVcses, 0, result, 0, myActiveVcses.length);
return result; return result;