use of com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl in project intellij-community by JetBrains.
the class SelectedBlockHistoryAction method isEnabled.
protected boolean isEnabled(VcsContext context) {
Project project = context.getProject();
if (project == null)
return false;
VcsSelection selection = VcsSelectionUtil.getSelection(context);
if (selection == null)
return false;
VirtualFile file = FileDocumentManager.getInstance().getFile(selection.getDocument());
if (file == null)
return false;
final ProjectLevelVcsManagerImpl vcsManager = (ProjectLevelVcsManagerImpl) ProjectLevelVcsManager.getInstance(project);
final BackgroundableActionEnabledHandler handler = vcsManager.getBackgroundableActionHandler(VcsBackgroundableActions.HISTORY_FOR_SELECTION);
if (handler.isInProgress(VcsBackgroundableActions.keyFrom(file)))
return false;
AbstractVcs activeVcs = ProjectLevelVcsManager.getInstance(project).getVcsFor(file);
if (activeVcs == null)
return false;
VcsHistoryProvider provider = activeVcs.getVcsBlockHistoryProvider();
if (provider == null)
return false;
if (!AbstractVcs.fileInVcsByFileStatus(project, VcsUtil.getFilePath(file)))
return false;
return true;
}
use of com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl 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.ProjectLevelVcsManagerImpl in project intellij-community by JetBrains.
the class HgTaskBranchesTest method initRepository.
@NotNull
@Override
protected Repository initRepository(@NotNull String name) {
String tempDirectory = FileUtil.getTempDirectory();
String root = tempDirectory + "/" + name;
assertTrue(new File(root).mkdirs());
HgPlatformTest.initRepo(root);
touch("a.txt");
hg("add a.txt");
hg("commit -m another -u abc");
hg("up -r 0");
ProjectLevelVcsManagerImpl vcsManager = (ProjectLevelVcsManagerImpl) ProjectLevelVcsManager.getInstance(myProject);
HgVcs hgVcs = HgVcs.getInstance(myProject);
assert hgVcs != null;
hgVcs.getProjectSettings().setCheckIncomingOutgoing(false);
vcsManager.setDirectoryMapping(root, HgVcs.VCS_NAME);
VirtualFile file = LocalFileSystem.getInstance().findFileByIoFile(new File(root));
HgRepository repository = HgUtil.getRepositoryManager(myProject).getRepositoryForRoot(file);
assertNotNull("Couldn't find repository for root " + root, repository);
return repository;
}
Aggregations