com.intellij.openapi.vcs.history.VcsHistoryProvider Java Examples

The following examples show how to use com.intellij.openapi.vcs.history.VcsHistoryProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SelectedBlockHistoryAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #2
Source File: TFSVcs.java    From azure-devops-intellij with MIT License 5 votes vote down vote up
@Override
public VcsHistoryProvider getVcsHistoryProvider() {
    if (myHistoryProvider == null) {
        myHistoryProvider = new TFSHistoryProvider(myProject);
    }
    return myHistoryProvider;
}
 
Example #3
Source File: MockVcsHelper.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void showFileHistory(VcsHistoryProvider vcsHistoryProvider,
                            AnnotationProvider annotationProvider,
                            FilePath path,
                            String repositoryPath,
                            AbstractVcs vcs) {
  throw new UnsupportedOperationException();
}
 
Example #4
Source File: TabbedShowHistoryAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static boolean isEnabled(@Nonnull Project project, @Nonnull FilePath path, @Nonnull VirtualFile fileOrParent) {
  boolean result = false;
  AbstractVcs vcs = ChangesUtil.getVcsForFile(fileOrParent, project);

  if (vcs != null) {
    VcsHistoryProvider provider = vcs.getVcsHistoryProvider();

    result = provider != null &&
             (provider.supportsHistoryForDirectories() || !path.isDirectory()) &&
             AbstractVcs.fileInVcsByFileStatus(project, fileOrParent) &&
             provider.canShowHistoryFor(fileOrParent);
  }

  return result;
}
 
Example #5
Source File: TabbedShowHistoryAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected void actionPerformed(@Nonnull VcsContext context) {
  Project project = context.getProject();
  Pair<FilePath, VirtualFile> pair = getPathAndParentFile(context);
  FilePath path = assertNotNull(pair.first);
  VirtualFile fileOrParent = assertNotNull(pair.second);
  AbstractVcs vcs = assertNotNull(ChangesUtil.getVcsForFile(fileOrParent, project));
  VcsHistoryProvider provider = assertNotNull(vcs.getVcsHistoryProvider());

  AbstractVcsHelper.getInstance(project).showFileHistory(provider, vcs.getAnnotationProvider(), path, null, vcs);
}
 
Example #6
Source File: P4Vcs.java    From p4ic4idea with Apache License 2.0 4 votes vote down vote up
@Override
@Nullable
public VcsHistoryProvider getVcsHistoryProvider() {
    return historyProvider;
}
 
Example #7
Source File: P4Vcs.java    From p4ic4idea with Apache License 2.0 4 votes vote down vote up
@Override
@Nullable
public VcsHistoryProvider getVcsBlockHistoryProvider() {
    return getVcsHistoryProvider();
}
 
Example #8
Source File: MockVcsHelper.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void showFileHistory(VcsHistoryProvider vcsHistoryProvider, FilePath path, AbstractVcs vcs, String repositoryPath) {
  throw new UnsupportedOperationException();
}
 
Example #9
Source File: AbstractVcsHelper.java    From consulo with Apache License 2.0 4 votes vote down vote up
public abstract void showFileHistory(@Nonnull VcsHistoryProvider historyProvider,
@Nonnull FilePath path,
@Nonnull AbstractVcs vcs,
@javax.annotation.Nullable String repositoryPath);
 
Example #10
Source File: AbstractVcsHelper.java    From consulo with Apache License 2.0 4 votes vote down vote up
public abstract void showFileHistory(@Nonnull VcsHistoryProvider historyProvider,
@Nullable AnnotationProvider annotationProvider,
@Nonnull FilePath path,
@Nullable String repositoryPath,
@Nonnull final AbstractVcs vcs);
 
Example #11
Source File: AbstractVcs.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
public VcsHistoryProvider getVcsHistoryProvider() {
  return null;
}
 
Example #12
Source File: AbstractVcs.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
public VcsHistoryProvider getVcsBlockHistoryProvider() {
  return null;
}