mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[file-history] move the code disabling diff on column resize to the FileHistoryPanel
This commit is contained in:
@@ -46,6 +46,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.util.ObjectUtils.notNull;
|
||||
@@ -106,12 +107,24 @@ public class FileHistoryPanel extends JPanel implements DataProvider, Disposable
|
||||
add(createActionsToolbar(), BorderLayout.WEST);
|
||||
|
||||
PopupHandler.installPopupHandler(myGraphTable, VcsLogActionPlaces.HISTORY_POPUP_ACTION_GROUP, VcsLogActionPlaces.VCS_HISTORY_PLACE);
|
||||
EmptyAction.wrap(ActionManager.getInstance().getAction(VcsLogActionPlaces.VCS_LOG_SHOW_DIFF_ACTION)).
|
||||
registerCustomShortcutSet(CommonShortcuts.DOUBLE_CLICK_1, tableWithProgress);
|
||||
invokeOnDoubleClick(ActionManager.getInstance().getAction(VcsLogActionPlaces.VCS_LOG_SHOW_DIFF_ACTION), tableWithProgress);
|
||||
|
||||
Disposer.register(myUi, this);
|
||||
}
|
||||
|
||||
private void invokeOnDoubleClick(@NotNull AnAction action, @NotNull JComponent component) {
|
||||
new EmptyAction.MyDelegatingAction(action) {
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
if (e.getInputEvent() instanceof MouseEvent && myGraphTable.isResizingColumns()) {
|
||||
// disable action during columns resize
|
||||
return;
|
||||
}
|
||||
super.actionPerformed(e);
|
||||
}
|
||||
}.registerCustomShortcutSet(CommonShortcuts.DOUBLE_CLICK_1, component);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private JComponent createActionsToolbar() {
|
||||
DefaultActionGroup toolbarGroup = new DefaultActionGroup();
|
||||
@@ -139,6 +152,10 @@ public class FileHistoryPanel extends JPanel implements DataProvider, Disposable
|
||||
@Override
|
||||
public Object getData(@NotNull String dataId) {
|
||||
if (VcsDataKeys.CHANGES.is(dataId) || VcsDataKeys.SELECTED_CHANGES.is(dataId)) {
|
||||
Change change = myUi.getSelectedChange();
|
||||
if (change != null) {
|
||||
return new Change[]{change};
|
||||
}
|
||||
List<VcsFullCommitDetails> details = myUi.getVcsLog().getSelectedDetails();
|
||||
if (details.isEmpty() || details.size() > VcsLogUtil.MAX_SELECTED_COMMITS) return null;
|
||||
return ArrayUtil.toObjectArray(VcsLogUtil.collectChanges(details, detail -> myUi.collectRelevantChanges(detail)), Change.class);
|
||||
|
||||
+1
-9
@@ -27,16 +27,13 @@ import com.intellij.openapi.vcs.changes.actions.diff.ShowDiffAction;
|
||||
import com.intellij.openapi.vcs.history.VcsDiffUtil;
|
||||
import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.vcs.log.CommitId;
|
||||
import com.intellij.vcs.log.VcsFullCommitDetails;
|
||||
import com.intellij.vcs.log.VcsLogDiffHandler;
|
||||
import com.intellij.vcs.log.*;
|
||||
import com.intellij.vcs.log.history.FileHistoryUi;
|
||||
import com.intellij.vcs.log.statistics.VcsLogUsageTriggerCollector;
|
||||
import com.intellij.vcs.log.ui.VcsLogInternalDataKeys;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -94,11 +91,6 @@ public class CompareRevisionsFromHistoryActionProvider implements AnActionExtens
|
||||
FileHistoryUi ui = e.getRequiredData(VcsLogInternalDataKeys.FILE_HISTORY_UI);
|
||||
FilePath filePath = e.getRequiredData(VcsDataKeys.FILE_PATH);
|
||||
|
||||
if (e.getInputEvent() instanceof MouseEvent && ui.getTable().isResizingColumns()) {
|
||||
// disable action during columns resize
|
||||
return;
|
||||
}
|
||||
|
||||
VcsLogUsageTriggerCollector.triggerUsage(e);
|
||||
|
||||
List<CommitId> commits = ui.getVcsLog().getSelectedCommits();
|
||||
|
||||
Reference in New Issue
Block a user