Search in sources :

Example 1 with DirDiffElementImpl

use of com.intellij.openapi.diff.impl.dir.DirDiffElementImpl 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)

Example 2 with DirDiffElementImpl

use of com.intellij.openapi.diff.impl.dir.DirDiffElementImpl in project intellij-community by JetBrains.

the class SetNoOperation method update.

@Override
public final void update(AnActionEvent e) {
    final DirDiffTableModel model = SetOperationToBase.getModel(e);
    final JTable table = SetOperationToBase.getTable(e);
    if (table != null && model != null) {
        for (DirDiffElementImpl element : model.getSelectedElements()) {
            if (element.getOperation() != DirDiffOperation.NONE) {
                e.getPresentation().setEnabled(true);
                return;
            }
        }
    }
    e.getPresentation().setEnabled(false);
}
Also used : DirDiffTableModel(com.intellij.openapi.diff.impl.dir.DirDiffTableModel) DirDiffElementImpl(com.intellij.openapi.diff.impl.dir.DirDiffElementImpl)

Example 3 with DirDiffElementImpl

use of com.intellij.openapi.diff.impl.dir.DirDiffElementImpl in project intellij-community by JetBrains.

the class SetOperationToBase method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    DirDiffOperation operation = getOperation();
    boolean setToDefault = operation == DirDiffOperation.NONE;
    final DirDiffTableModel model = getModel(e);
    final JTable table = getTable(e);
    assert model != null && table != null;
    for (DirDiffElementImpl element : model.getSelectedElements()) {
        if (isEnabledFor(element)) {
            element.setOperation(setToDefault ? element.getDefaultOperation() : operation);
        } else {
            element.setOperation(DirDiffOperation.NONE);
        }
    }
    table.repaint();
}
Also used : DirDiffTableModel(com.intellij.openapi.diff.impl.dir.DirDiffTableModel) DirDiffElementImpl(com.intellij.openapi.diff.impl.dir.DirDiffElementImpl) DirDiffOperation(com.intellij.ide.diff.DirDiffOperation)

Example 4 with DirDiffElementImpl

use of com.intellij.openapi.diff.impl.dir.DirDiffElementImpl in project intellij-community by JetBrains.

the class SetOperationToBase method update.

@Override
public final void update(AnActionEvent e) {
    final DirDiffTableModel model = getModel(e);
    final JTable table = getTable(e);
    if (table != null && model != null) {
        for (DirDiffElementImpl element : model.getSelectedElements()) {
            if (isEnabledFor(element)) {
                e.getPresentation().setEnabled(true);
                return;
            }
        }
    }
    e.getPresentation().setEnabled(false);
}
Also used : DirDiffTableModel(com.intellij.openapi.diff.impl.dir.DirDiffTableModel) DirDiffElementImpl(com.intellij.openapi.diff.impl.dir.DirDiffElementImpl)

Example 5 with DirDiffElementImpl

use of com.intellij.openapi.diff.impl.dir.DirDiffElementImpl in project intellij-community by JetBrains.

the class SetNoOperation method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    final DirDiffTableModel model = SetOperationToBase.getModel(e);
    final JTable table = SetOperationToBase.getTable(e);
    assert model != null && table != null;
    for (DirDiffElementImpl element : model.getSelectedElements()) {
        element.setOperation(DirDiffOperation.NONE);
    }
    table.repaint();
}
Also used : DirDiffTableModel(com.intellij.openapi.diff.impl.dir.DirDiffTableModel) DirDiffElementImpl(com.intellij.openapi.diff.impl.dir.DirDiffElementImpl)

Aggregations

DirDiffElementImpl (com.intellij.openapi.diff.impl.dir.DirDiffElementImpl)5 DirDiffTableModel (com.intellij.openapi.diff.impl.dir.DirDiffTableModel)4 BackgroundOperatingDiffElement (com.intellij.ide.diff.BackgroundOperatingDiffElement)1 DirDiffOperation (com.intellij.ide.diff.DirDiffOperation)1