Search in sources :

Example 1 with DiffContext

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

the class OpenInEditorAction method update.

@Override
public void update(@NotNull AnActionEvent e) {
    if (!ActionPlaces.isToolbarPlace(e.getPlace())) {
        e.getPresentation().setEnabledAndVisible(true);
        return;
    }
    DiffRequest request = e.getData(DiffDataKeys.DIFF_REQUEST);
    DiffContext context = e.getData(DiffDataKeys.DIFF_CONTEXT);
    if (DiffUtil.isUserDataFlagSet(DiffUserDataKeys.GO_TO_SOURCE_DISABLE, request, context)) {
        e.getPresentation().setVisible(false);
        e.getPresentation().setEnabled(false);
    }
    if (e.getProject() == null) {
        e.getPresentation().setVisible(true);
        e.getPresentation().setEnabled(false);
        return;
    }
    Navigatable[] navigatables = e.getData(DiffDataKeys.NAVIGATABLE_ARRAY);
    if (navigatables == null || !ContainerUtil.exists(navigatables, (it) -> it.canNavigate())) {
        e.getPresentation().setVisible(true);
        e.getPresentation().setEnabled(false);
        return;
    }
    e.getPresentation().setEnabledAndVisible(true);
}
Also used : DiffContext(com.intellij.diff.DiffContext) DiffRequest(com.intellij.diff.requests.DiffRequest) Navigatable(com.intellij.pom.Navigatable)

Aggregations

DiffContext (com.intellij.diff.DiffContext)1 DiffRequest (com.intellij.diff.requests.DiffRequest)1 Navigatable (com.intellij.pom.Navigatable)1