Search in sources :

Example 1 with GraphTableModel

use of com.intellij.vcs.log.ui.table.GraphTableModel in project intellij-community by JetBrains.

the class AbstractVcsLogUi method jumpTo.

private <T> void jumpTo(@NotNull final T commitId, @NotNull final PairFunction<GraphTableModel, T, Integer> rowGetter, @NotNull final SettableFuture<Boolean> future) {
    if (future.isCancelled())
        return;
    GraphTableModel model = getTable().getModel();
    int row = rowGetter.fun(model, commitId);
    if (row >= 0) {
        getTable().jumpToRow(row);
        future.set(true);
    } else if (model.canRequestMore()) {
        model.requestToLoadMore(() -> jumpTo(commitId, rowGetter, future));
    } else if (!myVisiblePack.isFull()) {
        invokeOnChange(() -> jumpTo(commitId, rowGetter, future));
    } else {
        if (getFilters().isEmpty()) {
            VcsBalloonProblemNotifier.showOverChangesView(myProject, "Commit " + commitId.toString() + " not found.", MessageType.WARNING);
        } else {
            String message = "Commit " + commitId.toString() + " does not exist or does not match active filters";
            VcsBalloonProblemNotifier.showOverChangesView(myProject, message, MessageType.WARNING, new NamedRunnable("Reset filters and search again") {

                @Override
                public void run() {
                    getFilterUi().setFilter(null);
                    invokeOnChange(() -> jumpTo(commitId, rowGetter, SettableFuture.create()));
                }
            });
        }
        future.set(false);
    }
}
Also used : GraphTableModel(com.intellij.vcs.log.ui.table.GraphTableModel) NamedRunnable(com.intellij.openapi.util.NamedRunnable)

Aggregations

NamedRunnable (com.intellij.openapi.util.NamedRunnable)1 GraphTableModel (com.intellij.vcs.log.ui.table.GraphTableModel)1