use of com.virtuslab.gitmachete.backend.api.IGitMacheteRepositorySnapshot in project git-machete-intellij-plugin by VirtusLab.
the class EnhancedGraphTable method getSuccessfulDiscoverRepositoryConsumer.
private Consumer<IGitMacheteRepositorySnapshot> getSuccessfulDiscoverRepositoryConsumer(@UI Runnable doOnUIThreadWhenReady) {
return (IGitMacheteRepositorySnapshot repositorySnapshot) -> UiThreadExecutionCompat.invokeLaterIfNeeded(NON_MODAL, () -> {
gitMacheteRepositorySnapshot = repositorySnapshot;
queueRepositoryUpdateAndModelRefresh(doOnUIThreadWhenReady);
val notifier = VcsNotifier.getInstance(project);
val notification = VcsNotifier.STANDARD_NOTIFICATION.createNotification(getString("string.GitMachete.EnhancedGraphTable.automatic-discover.success-message"), NotificationType.INFORMATION);
notification.addAction(NotificationAction.createSimple(() -> getString("action.GitMachete.OpenMacheteFileAction.description"), () -> {
val actionEvent = createAnActionEvent();
ActionManager.getInstance().getAction(ACTION_OPEN_MACHETE_FILE).actionPerformed(actionEvent);
}));
notifier.notify(notification);
});
}
use of com.virtuslab.gitmachete.backend.api.IGitMacheteRepositorySnapshot in project git-machete-intellij-plugin by VirtusLab.
the class EnhancedGraphTable method queueRepositoryUpdateAndModelRefresh.
@Override
public void queueRepositoryUpdateAndModelRefresh(@UI Runnable doOnUIThreadWhenReady) {
LOG.debug("Entering");
if (!project.isDisposed()) {
UiThreadExecutionCompat.invokeLaterIfNeeded(NON_MODAL, () -> {
val gitRepositorySelectionProvider = getGitRepositorySelectionProvider();
val gitRepository = gitRepositorySelectionProvider.getSelectedGitRepository().getOrNull();
if (gitRepository == null) {
LOG.warn("Selected repository is null");
return;
}
@UI Consumer<Option<IGitMacheteRepositorySnapshot>> doRefreshModel = newGitMacheteRepositorySnapshot -> {
val nullableRepositorySnapshot = newGitMacheteRepositorySnapshot.getOrNull();
this.gitMacheteRepositorySnapshot = nullableRepositorySnapshot;
if (nullableRepositorySnapshot != null) {
refreshModel(gitRepository, nullableRepositorySnapshot, doOnUIThreadWhenReady);
} else {
refreshModel(gitRepository, NullGitMacheteRepositorySnapshot.getInstance(), doOnUIThreadWhenReady);
}
};
setTextForEmptyTable(getString("string.GitMachete.EnhancedGraphTable.empty-table-text.loading"));
LOG.debug("Queuing repository update onto a non-UI thread");
new GitMacheteRepositoryUpdateBackgroundable(project, gitRepository, branchLayoutReader, doRefreshModel).queue();
GitVfsUtils.getMacheteFile(gitRepository).forEach(macheteFile -> VfsUtil.markDirtyAndRefresh(/* async */
true, /* recursive */
false, /* reloadChildren */
false, macheteFile));
});
} else {
LOG.debug("Project is disposed");
}
}
Aggregations