Search in sources :

Example 1 with VcsLogManager

use of com.intellij.vcs.log.impl.VcsLogManager in project intellij-community by JetBrains.

the class OpenAnotherLogTabAction method update.

@Override
public void update(AnActionEvent e) {
    Project project = e.getProject();
    if (project == null || !Registry.is("vcs.log.open.another.log.visible")) {
        e.getPresentation().setEnabledAndVisible(false);
        return;
    }
    VcsProjectLog projectLog = VcsProjectLog.getInstance(project);
    VcsLogManager logManager = e.getData(VcsLogInternalDataKeys.LOG_MANAGER);
    e.getPresentation().setEnabledAndVisible(// only for main log (it is a question, how and where we want to open tabs for external logs)
    logManager != null && projectLog.getLogManager() == logManager);
}
Also used : Project(com.intellij.openapi.project.Project) VcsProjectLog(com.intellij.vcs.log.impl.VcsProjectLog) VcsLogManager(com.intellij.vcs.log.impl.VcsLogManager)

Example 2 with VcsLogManager

use of com.intellij.vcs.log.impl.VcsLogManager in project intellij-community by JetBrains.

the class RefreshLogAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    VcsLogUtil.triggerUsage(e);
    VcsLogManager logManager = e.getRequiredData(VcsLogInternalDataKeys.LOG_MANAGER);
    // diagnostic for possible refresh problems
    VcsLogUi ui = e.getRequiredData(VcsLogDataKeys.VCS_LOG_UI);
    if (ui instanceof AbstractVcsLogUi) {
        VisiblePackRefresher refresher = ((AbstractVcsLogUi) ui).getRefresher();
        if (!refresher.isValid()) {
            String message = "Trying to refresh invalid log tab.";
            if (!logManager.getDataManager().getProgress().isRunning()) {
                LOG.error(message);
            } else {
                LOG.warn(message);
            }
            refresher.setValid(true);
        }
    }
    logManager.getDataManager().refreshSoftly(VcsLogUtil.getVisibleRoots(ui));
}
Also used : VisiblePackRefresher(com.intellij.vcs.log.visible.VisiblePackRefresher) AbstractVcsLogUi(com.intellij.vcs.log.ui.AbstractVcsLogUi) VcsLogManager(com.intellij.vcs.log.impl.VcsLogManager) AbstractVcsLogUi(com.intellij.vcs.log.ui.AbstractVcsLogUi) VcsLogUi(com.intellij.vcs.log.VcsLogUi)

Example 3 with VcsLogManager

use of com.intellij.vcs.log.impl.VcsLogManager in project intellij-community by JetBrains.

the class RefreshLogAction method update.

@Override
public void update(AnActionEvent e) {
    VcsLogManager logManager = e.getData(VcsLogInternalDataKeys.LOG_MANAGER);
    e.getPresentation().setEnabledAndVisible(logManager != null && e.getData(VcsLogDataKeys.VCS_LOG_UI) != null);
}
Also used : VcsLogManager(com.intellij.vcs.log.impl.VcsLogManager)

Example 4 with VcsLogManager

use of com.intellij.vcs.log.impl.VcsLogManager in project intellij-community by JetBrains.

the class GitShowExternalLogAction method createManagerAndContent.

@NotNull
private static MyContentComponent createManagerAndContent(@NotNull Project project, @NotNull final GitVcs vcs, @NotNull final List<VirtualFile> roots, @Nullable String tabName) {
    final GitRepositoryManager repositoryManager = GitRepositoryManager.getInstance(project);
    for (VirtualFile root : roots) {
        repositoryManager.addExternalRepository(root, GitRepositoryImpl.getInstance(root, project, true));
    }
    VcsLogManager manager = new VcsLogManager(project, ServiceManager.getService(project, VcsLogTabsProperties.class), ContainerUtil.map(roots, root -> new VcsRoot(vcs, root)));
    return new MyContentComponent(manager.createLogPanel(calcLogId(roots), tabName), roots, () -> {
        for (VirtualFile root : roots) {
            repositoryManager.removeExternalRepository(root);
        }
    });
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) Arrays(java.util.Arrays) VirtualFile(com.intellij.openapi.vfs.VirtualFile) ProjectLevelVcsManager(com.intellij.openapi.vcs.ProjectLevelVcsManager) GitRepositoryManager(git4idea.repo.GitRepositoryManager) GitRepositoryImpl(git4idea.repo.GitRepositoryImpl) ContainerUtil(com.intellij.util.containers.ContainerUtil) VcsLogContentProvider(com.intellij.vcs.log.impl.VcsLogContentProvider) GitVcs(git4idea.GitVcs) GitUtil(git4idea.GitUtil) Task(com.intellij.openapi.progress.Task) VcsRoot(com.intellij.openapi.vcs.VcsRoot) Comparing(com.intellij.openapi.util.Comparing) GitVersion(git4idea.config.GitVersion) WindowWrapper(com.intellij.openapi.ui.WindowWrapper) Disposer(com.intellij.openapi.util.Disposer) VcsLogManager(com.intellij.vcs.log.impl.VcsLogManager) Project(com.intellij.openapi.project.Project) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) CommonDataKeys(com.intellij.openapi.actionSystem.CommonDataKeys) ProgressManager(com.intellij.openapi.progress.ProgressManager) ToolWindow(com.intellij.openapi.wm.ToolWindow) StringUtil(com.intellij.openapi.util.text.StringUtil) Collection(java.util.Collection) ChangesViewContentManager(com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager) Content(com.intellij.ui.content.Content) Disposable(com.intellij.openapi.Disposable) File(java.io.File) java.awt(java.awt) Nullable(org.jetbrains.annotations.Nullable) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) DumbAwareAction(com.intellij.openapi.project.DumbAwareAction) List(java.util.List) ServiceManager(com.intellij.openapi.components.ServiceManager) ContentFactory(com.intellij.ui.content.ContentFactory) WindowWrapperBuilder(com.intellij.openapi.ui.WindowWrapperBuilder) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) ContentManager(com.intellij.ui.content.ContentManager) ObjectUtils(com.intellij.util.ObjectUtils) VcsLogTabsProperties(com.intellij.vcs.log.impl.VcsLogTabsProperties) NotNull(org.jetbrains.annotations.NotNull) Collections(java.util.Collections) FileChooser(com.intellij.openapi.fileChooser.FileChooser) javax.swing(javax.swing) VcsLogManager(com.intellij.vcs.log.impl.VcsLogManager) VcsLogTabsProperties(com.intellij.vcs.log.impl.VcsLogTabsProperties) GitRepositoryManager(git4idea.repo.GitRepositoryManager) VcsRoot(com.intellij.openapi.vcs.VcsRoot) NotNull(org.jetbrains.annotations.NotNull)

Example 5 with VcsLogManager

use of com.intellij.vcs.log.impl.VcsLogManager in project intellij-community by JetBrains.

the class VcsLogFileHistoryProviderImpl method showFileHistory.

@Override
public void showFileHistory(@NotNull Project project, @NotNull FilePath path, @Nullable String revisionNumber) {
    if (!VcsLogContentProvider.findAndSelectContent(project, FileHistoryUi.class, ui -> ui.getPath().equals(path))) {
        VcsLogManager logManager = VcsProjectLog.getInstance(project).getLogManager();
        assert logManager != null;
        VcsLogContentProvider.openLogTab(project, logManager, TAB_NAME, path.getName(), new FileHistoryUiFactory(path));
    }
}
Also used : Extensions(com.intellij.openapi.extensions.Extensions) Arrays(java.util.Arrays) VcsLogProperties(com.intellij.vcs.log.VcsLogProperties) VirtualFile(com.intellij.openapi.vfs.VirtualFile) AbstractVcs(com.intellij.openapi.vcs.AbstractVcs) ProjectLevelVcsManager(com.intellij.openapi.vcs.ProjectLevelVcsManager) VcsProjectLog(com.intellij.vcs.log.impl.VcsProjectLog) VcsLogProvider(com.intellij.vcs.log.VcsLogProvider) ContainerUtil(com.intellij.util.containers.ContainerUtil) VcsLogContentProvider(com.intellij.vcs.log.impl.VcsLogContentProvider) VcsLogFileHistoryProvider(com.intellij.vcs.log.VcsLogFileHistoryProvider) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) VcsRoot(com.intellij.openapi.vcs.VcsRoot) VcsLogData(com.intellij.vcs.log.data.VcsLogData) VcsLogManager(com.intellij.vcs.log.impl.VcsLogManager) Project(com.intellij.openapi.project.Project) Registry(com.intellij.openapi.util.registry.Registry) NotNull(org.jetbrains.annotations.NotNull) FilePath(com.intellij.openapi.vcs.FilePath) VcsLogManager(com.intellij.vcs.log.impl.VcsLogManager)

Aggregations

VcsLogManager (com.intellij.vcs.log.impl.VcsLogManager)5 Project (com.intellij.openapi.project.Project)3 ProjectLevelVcsManager (com.intellij.openapi.vcs.ProjectLevelVcsManager)2 VcsRoot (com.intellij.openapi.vcs.VcsRoot)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 ContainerUtil (com.intellij.util.containers.ContainerUtil)2 VcsLogContentProvider (com.intellij.vcs.log.impl.VcsLogContentProvider)2 VcsProjectLog (com.intellij.vcs.log.impl.VcsProjectLog)2 Disposable (com.intellij.openapi.Disposable)1 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 CommonDataKeys (com.intellij.openapi.actionSystem.CommonDataKeys)1 ServiceManager (com.intellij.openapi.components.ServiceManager)1 Extensions (com.intellij.openapi.extensions.Extensions)1 FileChooser (com.intellij.openapi.fileChooser.FileChooser)1 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 ProgressManager (com.intellij.openapi.progress.ProgressManager)1 Task (com.intellij.openapi.progress.Task)1 DumbAwareAction (com.intellij.openapi.project.DumbAwareAction)1 WindowWrapper (com.intellij.openapi.ui.WindowWrapper)1