use of com.intellij.openapi.vcs.impl.VcsBackgroundableActions in project intellij-community by JetBrains.
the class VcsHistoryProviderBackgroundableProxy method doExecuteAppendableSession.
private void doExecuteAppendableSession(final VcsKey vcsKey, final FilePath filePath, @Nullable VcsRevisionNumber startRevisionNumber, final VcsAppendableHistorySessionPartner partner, @Nullable VcsBackgroundableActions actionKey, boolean canUseCache, boolean canUseLastRevisionCheck) {
if (myCachesHistory && canUseCache) {
final VcsAbstractHistorySession session = getFullHistoryFromCache(vcsKey, filePath);
if (session != null) {
partner.reportCreatedEmptySession(session);
partner.finished();
return;
}
}
final ProjectLevelVcsManagerImpl vcsManager = (ProjectLevelVcsManagerImpl) ProjectLevelVcsManager.getInstance(myProject);
final VcsBackgroundableActions resultingActionKey = actionKey == null ? VcsBackgroundableActions.CREATE_HISTORY_SESSION : actionKey;
final BackgroundableActionEnabledHandler handler;
handler = vcsManager.getBackgroundableActionHandler(resultingActionKey);
// fo not start same action twice
if (handler.isInProgress(resultingActionKey))
return;
handler.register(resultingActionKey);
final VcsAppendableHistorySessionPartner cachedPartner;
if (myCachesHistory && startRevisionNumber == null) {
cachedPartner = new HistoryPartnerProxy(partner, session -> {
if (session == null)
return;
VcsCacheableHistorySessionFactory<Serializable, VcsAbstractHistorySession> delegate = (VcsCacheableHistorySessionFactory<Serializable, VcsAbstractHistorySession>) myDelegate;
FilePath correctedPath = delegate.getUsedFilePath(session);
myVcsHistoryCache.put(filePath, correctedPath, vcsKey, (VcsAbstractHistorySession) session.copy(), delegate, true);
});
} else {
cachedPartner = partner;
}
reportHistory(filePath, startRevisionNumber, vcsKey, resultingActionKey, handler, cachedPartner, canUseLastRevisionCheck);
}
use of com.intellij.openapi.vcs.impl.VcsBackgroundableActions in project intellij-community by JetBrains.
the class VcsHistoryProviderBackgroundableProxy method createSessionFor.
public void createSessionFor(final VcsKey vcsKey, final FilePath filePath, final Consumer<VcsHistorySession> continuation, @Nullable VcsBackgroundableActions actionKey, final boolean silent, @Nullable final Consumer<VcsHistorySession> backgroundSpecialization) {
final ThrowableComputable<VcsHistorySession, VcsException> throwableComputable = myHistoryComputerFactory.create(filePath, backgroundSpecialization, vcsKey);
final VcsBackgroundableActions resultingActionKey = actionKey == null ? VcsBackgroundableActions.CREATE_HISTORY_SESSION : actionKey;
final Object key = VcsBackgroundableActions.keyFrom(filePath);
if (silent) {
VcsBackgroundableComputable.createAndRunSilent(myProject, resultingActionKey, key, VcsBundle.message("loading.file.history.progress"), throwableComputable, continuation);
} else {
VcsBackgroundableComputable.createAndRun(myProject, resultingActionKey, key, VcsBundle.message("loading.file.history.progress"), VcsBundle.message("message.title.could.not.load.file.history"), throwableComputable, continuation, null);
}
}
Aggregations