use of com.intellij.vcs.log.ui.AbstractVcsLogUi in project intellij-community by JetBrains.
the class VcsLogContentProvider method findAndSelectContent.
public static <U extends AbstractVcsLogUi> boolean findAndSelectContent(@NotNull Project project, @NotNull Class<U> clazz, @NotNull Condition<U> condition) {
ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS);
ContentManager manager = toolWindow.getContentManager();
JComponent component = ContentUtilEx.findContentComponent(manager, c -> {
if (c instanceof VcsLogPanel) {
AbstractVcsLogUi ui = ((VcsLogPanel) c).getUi();
return clazz.isInstance(ui) && condition.value((U) ui);
}
return false;
});
if (component == null)
return false;
if (!toolWindow.isVisible())
toolWindow.activate(null);
return ContentUtilEx.selectContent(manager, component, true);
}
use of com.intellij.vcs.log.ui.AbstractVcsLogUi in project intellij-community by JetBrains.
the class GoToHashOrRefAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
VcsLogUtil.triggerUsage(e);
Project project = e.getRequiredData(CommonDataKeys.PROJECT);
VcsLog log = e.getRequiredData(VcsLogDataKeys.VCS_LOG);
VcsLogUi ui = e.getRequiredData(VcsLogDataKeys.VCS_LOG_UI);
assert ui instanceof AbstractVcsLogUi;
AbstractVcsLogUi logUi = (AbstractVcsLogUi) ui;
Set<VirtualFile> visibleRoots = VcsLogUtil.getVisibleRoots(logUi);
GoToHashOrRefPopup popup = new GoToHashOrRefPopup(project, logUi.getDataPack().getRefs(), visibleRoots, log::jumpToReference, vcsRef -> logUi.jumpToCommit(vcsRef.getCommitHash(), vcsRef.getRoot()), logUi.getColorManager(), new VcsGoToRefComparator(logUi.getDataPack().getLogProviders()));
popup.show(logUi.getTable());
}
use of com.intellij.vcs.log.ui.AbstractVcsLogUi 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));
}
use of com.intellij.vcs.log.ui.AbstractVcsLogUi in project intellij-community by JetBrains.
the class ShowCommitTooltipAction method update.
@Override
public void update(@NotNull AnActionEvent e) {
Project project = e.getProject();
VcsLogUi ui = e.getData(VcsLogDataKeys.VCS_LOG_UI);
if (project == null || ui == null) {
e.getPresentation().setEnabledAndVisible(false);
} else {
e.getPresentation().setEnabledAndVisible(ui instanceof AbstractVcsLogUi && ((AbstractVcsLogUi) ui).getTable().getSelectedRowCount() == 1);
}
}
use of com.intellij.vcs.log.ui.AbstractVcsLogUi in project intellij-community by JetBrains.
the class GoToHashOrRefAction method update.
@Override
public void update(AnActionEvent e) {
VcsLog log = e.getData(VcsLogDataKeys.VCS_LOG);
VcsLogUi logUi = e.getData(VcsLogDataKeys.VCS_LOG_UI);
e.getPresentation().setEnabledAndVisible(e.getProject() != null && log != null && logUi != null && logUi instanceof AbstractVcsLogUi);
}
Aggregations