void (@NotNull final AnActionEvent e) { Project project = e.getData(CommonDataKeys.PROJECT); if (project == null || project.isDefault()) { e.getPresentation().setEnabledAndVisible(false); return; } if (project.getService(GHHostedRepositoriesManager.class).getKnownRepositoriesState().getValue().isEmpty()) { e.getPresentation().setEnabledAndVisible(false); return; } Editor editor = e.getData(CommonDataKeys.EDITOR); VirtualFile file = e.getData(CommonDataKeys.VIRTUAL_FILE); VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY); boolean hasFilesWithContent = FILE_WITH_CONTENT.value(file) || (files != null && ContainerUtil.exists(files, FILE_WITH_CONTENT)); if (!hasFilesWithContent || editor != null && editor.getDocument().getTextLength() == 0) { e.getPresentation().setEnabledAndVisible(false); return; } e.getPresentation().setEnabledAndVisible(true); }