Search in sources :

Example 1 with VcsProjectLog

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

the class VcsLogFeaturesCollector method getProjectUsages.

@NotNull
@Override
public Set<UsageDescriptor> getProjectUsages(@NotNull Project project) throws CollectUsagesException {
    VcsProjectLog projectLog = VcsProjectLog.getInstance(project);
    if (projectLog != null) {
        VcsLogUiImpl ui = projectLog.getMainLogUi();
        if (ui != null) {
            MainVcsLogUiProperties properties = ui.getProperties();
            Set<UsageDescriptor> usages = ContainerUtil.newHashSet();
            usages.add(StatisticsUtilKt.getBooleanUsage("ui.details", properties.get(CommonUiProperties.SHOW_DETAILS)));
            usages.add(StatisticsUtilKt.getBooleanUsage("ui.long.edges", properties.get(SHOW_LONG_EDGES)));
            PermanentGraph.SortType sortType = properties.get(BEK_SORT_TYPE);
            usages.add(StatisticsUtilKt.getBooleanUsage("ui.sort.linear.bek", sortType.equals(PermanentGraph.SortType.LinearBek)));
            usages.add(StatisticsUtilKt.getBooleanUsage("ui.sort.bek", sortType.equals(PermanentGraph.SortType.Bek)));
            usages.add(StatisticsUtilKt.getBooleanUsage("ui.sort.normal", sortType.equals(PermanentGraph.SortType.Normal)));
            if (ui.isMultipleRoots()) {
                usages.add(StatisticsUtilKt.getBooleanUsage("ui.roots", properties.get(SHOW_ROOT_NAMES)));
            }
            usages.add(StatisticsUtilKt.getBooleanUsage("ui.labels.compact", properties.get(COMPACT_REFERENCES_VIEW)));
            usages.add(StatisticsUtilKt.getBooleanUsage("ui.labels.showTagNames", properties.get(SHOW_TAG_NAMES)));
            usages.add(StatisticsUtilKt.getBooleanUsage("ui.textFilter.regex", properties.get(TEXT_FILTER_REGEX)));
            usages.add(StatisticsUtilKt.getBooleanUsage("ui.textFilter.matchCase", properties.get(TEXT_FILTER_MATCH_CASE)));
            for (VcsLogHighlighterFactory factory : Extensions.getExtensions(LOG_HIGHLIGHTER_FACTORY_EP, project)) {
                if (factory.showMenuItem()) {
                    VcsLogHighlighterProperty property = VcsLogHighlighterProperty.get(factory.getId());
                    usages.add(StatisticsUtilKt.getBooleanUsage("ui.highlighter." + ConvertUsagesUtil.ensureProperKey(factory.getId()), properties.exists(property) && properties.get(property)));
                }
            }
            return usages;
        }
    }
    return Collections.emptySet();
}
Also used : MainVcsLogUiProperties(com.intellij.vcs.log.impl.MainVcsLogUiProperties) VcsLogHighlighterFactory(com.intellij.vcs.log.ui.highlighters.VcsLogHighlighterFactory) VcsProjectLog(com.intellij.vcs.log.impl.VcsProjectLog) VcsLogUiImpl(com.intellij.vcs.log.ui.VcsLogUiImpl) UsageDescriptor(com.intellij.internal.statistic.beans.UsageDescriptor) PermanentGraph(com.intellij.vcs.log.graph.PermanentGraph) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with VcsProjectLog

use of com.intellij.vcs.log.impl.VcsProjectLog 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 3 with VcsProjectLog

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

the class GitShowCommitInLogAction method actionPerformed.

@Override
public void actionPerformed(@NotNull AnActionEvent event) {
    final Project project = event.getRequiredData(CommonDataKeys.PROJECT);
    final VcsRevisionNumber revision = getRevisionNumber(event);
    if (revision == null) {
        return;
    }
    boolean logReady = findLog(project) != null;
    final ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(ChangesViewContentManager.TOOLWINDOW_ID);
    ContentManager cm = window.getContentManager();
    Content[] contents = cm.getContents();
    for (Content content : contents) {
        if (VcsLogContentProvider.TAB_NAME.equals(content.getDisplayName())) {
            cm.setSelectedContent(content);
            break;
        }
    }
    final VcsLog log = findLog(project);
    if (log == null) {
        showLogNotReadyMessage(project);
        return;
    }
    Runnable selectAndOpenLog = new Runnable() {

        @Override
        public void run() {
            Runnable selectCommit = new Runnable() {

                @Override
                public void run() {
                    jumpToRevisionUnderProgress(project, log, revision);
                }
            };
            if (!window.isVisible()) {
                window.activate(selectCommit, true);
            } else {
                selectCommit.run();
            }
        }
    };
    if (logReady) {
        selectAndOpenLog.run();
        return;
    }
    VcsProjectLog projectLog = VcsProjectLog.getInstance(project);
    if (projectLog == null) {
        showLogNotReadyMessage(project);
        return;
    }
    VcsLogUiImpl logUi = projectLog.getMainLogUi();
    if (logUi == null) {
        showLogNotReadyMessage(project);
        return;
    }
    logUi.invokeOnChange(selectAndOpenLog);
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) VcsLog(com.intellij.vcs.log.VcsLog) VcsRevisionNumber(com.intellij.openapi.vcs.history.VcsRevisionNumber) ChangesViewContentManager(com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager) ContentManager(com.intellij.ui.content.ContentManager) VcsProjectLog(com.intellij.vcs.log.impl.VcsProjectLog) VcsLogUiImpl(com.intellij.vcs.log.ui.VcsLogUiImpl)

Example 4 with VcsProjectLog

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

the class VcsLogRepoSizeCollector method getProjectUsages.

@NotNull
@Override
public Set<UsageDescriptor> getProjectUsages(@NotNull Project project) throws CollectUsagesException {
    VcsProjectLog projectLog = VcsProjectLog.getInstance(project);
    VcsLogData logData = projectLog.getDataManager();
    if (logData != null) {
        DataPack dataPack = logData.getDataPack();
        if (dataPack.isFull()) {
            PermanentGraph<Integer> permanentGraph = dataPack.getPermanentGraph();
            MultiMap<VcsKey, VirtualFile> groupedRoots = groupRootsByVcs(dataPack.getLogProviders());
            Set<UsageDescriptor> usages = ContainerUtil.newHashSet();
            usages.add(StatisticsUtilKt.getCountingUsage("data.commit.count", permanentGraph.getAllCommits().size(), asList(0, 1, 100, 1000, 10 * 1000, 100 * 1000, 500 * 1000, 1000 * 1000)));
            usages.add(StatisticsUtilKt.getCountingUsage("data.branches.count", dataPack.getRefsModel().getBranches().size(), asList(0, 1, 10, 50, 100, 500, 1000, 5 * 1000, 10 * 1000, 20 * 1000, 50 * 1000)));
            usages.add(StatisticsUtilKt.getCountingUsage("data.users.count", logData.getAllUsers().size(), asList(0, 1, 10, 50, 100, 500, 1000, 5 * 1000, 10 * 1000, 20 * 1000, 50 * 1000)));
            for (VcsKey vcs : groupedRoots.keySet()) {
                usages.add(StatisticsUtilKt.getCountingUsage("data." + vcs.getName().toLowerCase() + ".root.count", groupedRoots.get(vcs).size(), asList(0, 1, 2, 5, 8, 15, 30, 50, 100, 300, 500)));
            }
            return usages;
        }
    }
    return Collections.emptySet();
}
Also used : VcsKey(com.intellij.openapi.vcs.VcsKey) VirtualFile(com.intellij.openapi.vfs.VirtualFile) VcsLogData(com.intellij.vcs.log.data.VcsLogData) VcsProjectLog(com.intellij.vcs.log.impl.VcsProjectLog) DataPack(com.intellij.vcs.log.data.DataPack) UsageDescriptor(com.intellij.internal.statistic.beans.UsageDescriptor) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

VcsProjectLog (com.intellij.vcs.log.impl.VcsProjectLog)4 UsageDescriptor (com.intellij.internal.statistic.beans.UsageDescriptor)2 Project (com.intellij.openapi.project.Project)2 VcsLogUiImpl (com.intellij.vcs.log.ui.VcsLogUiImpl)2 NotNull (org.jetbrains.annotations.NotNull)2 VcsKey (com.intellij.openapi.vcs.VcsKey)1 ChangesViewContentManager (com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager)1 VcsRevisionNumber (com.intellij.openapi.vcs.history.VcsRevisionNumber)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 ToolWindow (com.intellij.openapi.wm.ToolWindow)1 Content (com.intellij.ui.content.Content)1 ContentManager (com.intellij.ui.content.ContentManager)1 VcsLog (com.intellij.vcs.log.VcsLog)1 DataPack (com.intellij.vcs.log.data.DataPack)1 VcsLogData (com.intellij.vcs.log.data.VcsLogData)1 PermanentGraph (com.intellij.vcs.log.graph.PermanentGraph)1 MainVcsLogUiProperties (com.intellij.vcs.log.impl.MainVcsLogUiProperties)1 VcsLogManager (com.intellij.vcs.log.impl.VcsLogManager)1 VcsLogHighlighterFactory (com.intellij.vcs.log.ui.highlighters.VcsLogHighlighterFactory)1