Search in sources :

Example 1 with ChangesBrowserSettingsEditor

use of com.intellij.openapi.vcs.versionBrowser.ChangesBrowserSettingsEditor in project intellij-community by JetBrains.

the class AbstractVcsHelperImpl method showChangesBrowser.

public void showChangesBrowser(final CommittedChangesProvider provider, final RepositoryLocation location, @Nls String title, Component parent) {
    final ChangesBrowserSettingsEditor filterUI = provider.createFilterUI(true);
    ChangeBrowserSettings settings = provider.createDefaultSettings();
    boolean ok;
    if (filterUI != null) {
        final CommittedChangesFilterDialog dlg = new CommittedChangesFilterDialog(myProject, filterUI, settings);
        dlg.show();
        ok = dlg.getExitCode() == DialogWrapper.OK_EXIT_CODE;
        settings = dlg.getSettings();
    } else {
        ok = true;
    }
    if (ok) {
        if (myProject.isDefault() || (ProjectLevelVcsManager.getInstance(myProject).getAllActiveVcss().length == 0) || (!ModalityState.NON_MODAL.equals(ModalityState.current()))) {
            final List<CommittedChangeList> versions = new ArrayList<>();
            if (parent == null || !parent.isValid()) {
                parent = WindowManager.getInstance().suggestParentWindow(myProject);
            }
            final CommittedChangesTableModel model = new CommittedChangesTableModel(versions, true);
            final AsynchronousListsLoader[] task = new AsynchronousListsLoader[1];
            final ChangeBrowserSettings finalSettings = settings;
            final ChangesBrowserDialog dlg = createChangesBrowserDialog(model, title, filterUI != null, parent, new Consumer<ChangesBrowserDialog>() {

                @Override
                public void consume(ChangesBrowserDialog changesBrowserDialog) {
                    task[0] = new AsynchronousListsLoader(myProject, provider, location, finalSettings, changesBrowserDialog);
                    ProgressManager.getInstance().run(task[0]);
                }
            });
            dlg.startLoading();
            dlg.show();
            if (task[0] != null) {
                task[0].cancel();
                final List<VcsException> exceptions = task[0].getExceptions();
                if (!exceptions.isEmpty()) {
                    Messages.showErrorDialog(myProject, VcsBundle.message("browse.changes.error.message", exceptions.get(0).getMessage()), VcsBundle.message("browse.changes.error.title"));
                    return;
                }
                if (!task[0].isRevisionsReturned()) {
                    Messages.showInfoMessage(myProject, VcsBundle.message("browse.changes.nothing.found"), VcsBundle.message("browse.changes.nothing.found.title"));
                }
            }
        } else {
            openCommittedChangesTab(provider, location, settings, 0, title);
        }
    }
}
Also used : CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) ChangesBrowserSettingsEditor(com.intellij.openapi.vcs.versionBrowser.ChangesBrowserSettingsEditor) ChangeBrowserSettings(com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings)

Aggregations

ChangeBrowserSettings (com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings)1 ChangesBrowserSettingsEditor (com.intellij.openapi.vcs.versionBrowser.ChangesBrowserSettingsEditor)1 CommittedChangeList (com.intellij.openapi.vcs.versionBrowser.CommittedChangeList)1