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);
}
Aggregations