use of com.intellij.vcs.log.VcsLogProvider in project intellij-community by JetBrains.
the class VcsLogFileHistoryProviderImpl method canShowFileHistory.
@Override
public boolean canShowFileHistory(@NotNull Project project, @NotNull FilePath path) {
if (!Registry.is("vcs.new.history"))
return false;
VcsRoot rootObject = ProjectLevelVcsManager.getInstance(project).getVcsRootObjectFor(path);
if (rootObject == null)
return false;
VirtualFile root = rootObject.getPath();
AbstractVcs vcs = rootObject.getVcs();
if (vcs == null || root == null)
return false;
VcsLogData dataManager = VcsProjectLog.getInstance(project).getDataManager();
if (dataManager == null || !dataManager.getRoots().contains(root) || dataManager.getIndex().getDataGetter() == null)
return false;
List<VcsLogProvider> allLogProviders = Arrays.asList(Extensions.getExtensions(VcsLogProvider.LOG_PROVIDER_EP, project));
VcsLogProvider provider = ContainerUtil.find(allLogProviders, p -> p.getSupportedVcs().equals(vcs.getKeyInstanceMethod()));
if (provider == null)
return false;
return VcsLogProperties.get(provider, VcsLogProperties.SUPPORTS_INDEXING);
}
use of com.intellij.vcs.log.VcsLogProvider in project intellij-community by JetBrains.
the class EnableMatchCaseAction method update.
@Override
public void update(@NotNull AnActionEvent e) {
super.update(e);
VcsLogUi ui = e.getData(VcsLogDataKeys.VCS_LOG_UI);
VcsLogUiProperties properties = e.getData(VcsLogInternalDataKeys.LOG_UI_PROPERTIES);
if (ui != null && properties != null && properties.exists(MainVcsLogUiProperties.TEXT_FILTER_MATCH_CASE)) {
boolean regexEnabled = properties.exists(MainVcsLogUiProperties.TEXT_FILTER_REGEX) && properties.get(MainVcsLogUiProperties.TEXT_FILTER_REGEX);
if (!regexEnabled) {
e.getPresentation().setText(MATCH_CASE);
} else {
Collection<VcsLogProvider> providers = ContainerUtil.newLinkedHashSet(ui.getDataPack().getLogProviders().values());
List<VcsLogProvider> supported = ContainerUtil.filter(providers, p -> VcsLogProperties.get(p, VcsLogProperties.CASE_INSENSITIVE_REGEX));
e.getPresentation().setVisible(true);
e.getPresentation().setEnabled(!supported.isEmpty());
if (providers.size() == supported.size() || supported.isEmpty()) {
e.getPresentation().setText(MATCH_CASE);
} else {
String supportedText = StringUtil.join(ContainerUtil.map(supported, p -> p.getSupportedVcs().getName().toLowerCase()), ", ");
e.getPresentation().setText(MATCH_CASE + " (" + supportedText + " only)");
}
}
}
}
use of com.intellij.vcs.log.VcsLogProvider in project intellij-community by JetBrains.
the class VcsLogManager method refreshLogOnVcsEvents.
private static void refreshLogOnVcsEvents(@NotNull Map<VirtualFile, VcsLogProvider> logProviders, @NotNull VcsLogRefresher refresher, @NotNull Disposable disposableParent) {
MultiMap<VcsLogProvider, VirtualFile> providers2roots = MultiMap.create();
logProviders.forEach((key, value) -> providers2roots.putValue(value, key));
for (Map.Entry<VcsLogProvider, Collection<VirtualFile>> entry : providers2roots.entrySet()) {
Disposable disposable = entry.getKey().subscribeToRootRefreshEvents(entry.getValue(), refresher);
Disposer.register(disposableParent, disposable);
}
}
Aggregations