git: reuse the common logic in fetch action

GitOrigin-RevId: 4c5762f95baf5e6db8367ea897aa8d176976d9b0
This commit is contained in:
Dmitry Zhuravlev
2019-12-18 17:12:26 +00:00
committed by intellij-monorepo-bot
parent 789cbf5102
commit 1177844617
@@ -14,6 +14,7 @@ import org.jetbrains.annotations.NotNull;
import static git4idea.GitUtil.getRepositories;
import static git4idea.fetch.GitFetchSupport.fetchSupport;
import static git4idea.ui.branch.GitBranchActionsUtilKt.hasRemotes;
public class GitFetch extends DumbAwareAction {
@@ -25,8 +26,7 @@ public class GitFetch extends DumbAwareAction {
e.getPresentation().setEnabledAndVisible(false);
}
else {
boolean hasRemotes = getRepositories(project).stream().anyMatch(repository -> !repository.getRemotes().isEmpty());
e.getPresentation().setEnabledAndVisible(hasRemotes);
e.getPresentation().setEnabledAndVisible(hasRemotes(project));
}
}