Search in sources :

Example 1 with BackgroundOperatingDiffElement

use of com.intellij.ide.diff.BackgroundOperatingDiffElement in project intellij-community by JetBrains.

the class SynchronizeDiff method update.

@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);
    }
}
Also used : BackgroundOperatingDiffElement(com.intellij.ide.diff.BackgroundOperatingDiffElement) DirDiffElementImpl(com.intellij.openapi.diff.impl.dir.DirDiffElementImpl)

Aggregations

BackgroundOperatingDiffElement (com.intellij.ide.diff.BackgroundOperatingDiffElement)1 DirDiffElementImpl (com.intellij.openapi.diff.impl.dir.DirDiffElementImpl)1