mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-130881, IDEA-130881 show enter/space/click message if applicable
This commit is contained in:
@@ -153,6 +153,7 @@ public class DirDiffPanel implements Disposable, DataProvider {
|
||||
}
|
||||
});
|
||||
if (model.isOperationsEnabled()) {
|
||||
|
||||
new AnAction("Change diff operation") {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
@@ -218,10 +219,13 @@ public class DirDiffPanel implements Disposable, DataProvider {
|
||||
final ActionToolbar toolbar = actionManager.createActionToolbar("DirDiff", actions, true);
|
||||
registerCustomShortcuts(actions, myTable);
|
||||
myToolBarPanel.add(toolbar.getComponent(), BorderLayout.CENTER);
|
||||
final JBLabel label = new JBLabel("Use Space button or mouse click to change operation for the selected elements." +
|
||||
" Enter to perform.", SwingConstants.CENTER);
|
||||
label.setForeground(UIUtil.getInactiveTextColor());
|
||||
UIUtil.applyStyle(UIUtil.ComponentStyle.MINI, label);
|
||||
if (model.isOperationsEnabled()) {
|
||||
final JBLabel label = new JBLabel("Use Space button or mouse click to change operation for the selected elements." +
|
||||
" Enter to perform.", SwingConstants.CENTER);
|
||||
label.setForeground(UIUtil.getInactiveTextColor());
|
||||
UIUtil.applyStyle(UIUtil.ComponentStyle.MINI, label);
|
||||
myFilesPanel.add(label, BorderLayout.SOUTH);
|
||||
}
|
||||
DataManager.registerDataProvider(myFilesPanel, this);
|
||||
myTable.addMouseListener(new PopupHandler() {
|
||||
@Override
|
||||
@@ -231,7 +235,6 @@ public class DirDiffPanel implements Disposable, DataProvider {
|
||||
popupMenu.show(comp, x, y);
|
||||
}
|
||||
});
|
||||
myFilesPanel.add(label, BorderLayout.SOUTH);
|
||||
final JBLoadingPanel loadingPanel = new JBLoadingPanel(new BorderLayout(), wnd.getDisposable());
|
||||
loadingPanel.addListener(new JBLoadingPanelListener.Adapter() {
|
||||
boolean showHelp = true;
|
||||
|
||||
+9
-17
@@ -16,15 +16,12 @@
|
||||
package com.intellij.openapi.diff.impl.dir.actions;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.diff.BackgroundOperatingDiffElement;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CustomShortcutSet;
|
||||
import com.intellij.openapi.actionSystem.ShortcutSet;
|
||||
import com.intellij.openapi.diff.impl.dir.DirDiffElementImpl;
|
||||
import com.intellij.openapi.diff.impl.dir.DirDiffTableModel;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
|
||||
import java.util.List;
|
||||
import com.intellij.util.containers.JBIterable;
|
||||
|
||||
import static com.intellij.ide.diff.DirDiffOperation.*;
|
||||
|
||||
@@ -44,20 +41,15 @@ public class SynchronizeDiff extends DirDiffAction {
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
super.update(e);
|
||||
if (e.getPresentation().isEnabled() &&
|
||||
(getModel().getSourceDir() instanceof BackgroundOperatingDiffElement ||
|
||||
getModel().getTargetDir() instanceof BackgroundOperatingDiffElement)) {
|
||||
List<DirDiffElementImpl> elements = mySelectedOnly ? getModel().getSelectedElements() : getModel().getElements();
|
||||
for (DirDiffElementImpl dirDiffElement : elements) {
|
||||
if ((dirDiffElement.getSource() == null || dirDiffElement.getSource().isOperationsEnabled()) &&
|
||||
(dirDiffElement.getTarget() == null || dirDiffElement.getTarget().isOperationsEnabled()) &&
|
||||
(dirDiffElement.getOperation() == COPY_FROM || dirDiffElement.getOperation() == COPY_TO || dirDiffElement.getOperation() == DELETE)) {
|
||||
e.getPresentation().setEnabled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
e.getPresentation().setEnabled(false);
|
||||
if (!e.getPresentation().isEnabled()) {
|
||||
return;
|
||||
}
|
||||
boolean enabled = !JBIterable.from(mySelectedOnly ? getModel().getSelectedElements() : getModel().getElements())
|
||||
.filter(d -> d.getOperation() == COPY_FROM || d.getOperation() == COPY_TO || d.getOperation() == DELETE)
|
||||
.filter(d -> d.getSource() == null || d.getSource().isOperationsEnabled())
|
||||
.filter(d -> d.getTarget() == null || d.getTarget().isOperationsEnabled())
|
||||
.isEmpty();
|
||||
e.getPresentation().setEnabled(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user