<commit_before>// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.vcs.changes.actions.diff

import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.project.DumbAwareAction
import com.intellij.openapi.project.Project
import com.intellij.openapi.vcs.VcsDataKeys.VIRTUAL_FILES
import com.intellij.openapi.vcs.changes.VcsEditorTabFilesManager
import com.intellij.util.containers.JBIterable
import com.intellij.vcsUtil.VcsUtil

internal abstract class MoveDiffPreviewAction(private val openInNewWindow: Boolean) : DumbAwareAction() {

  abstract fun isEnabledAndVisible(project: Project): Boolean

  override fun update(e: AnActionEvent) {
    val project = e.project
    val file = JBIterable.from(e.getData(VIRTUAL_FILES)).single()
    e.presentation.isEnabledAndVisible = project != null
                                         && file != null
                                         && isEnabledAndVisible(project)
  }
<commit_msg>vcs: make move diff preview action available only to VF with diff content<commit_after>// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.vcs.changes.actions.diff

import com.intellij.diff.editor.DiffContentVirtualFile
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.project.DumbAwareAction
import com.intellij.openapi.project.Project
import com.intellij.openapi.vcs.VcsDataKeys.VIRTUAL_FILES
import com.intellij.openapi.vcs.changes.VcsEditorTabFilesManager
import com.intellij.util.containers.JBIterable
import com.intellij.vcsUtil.VcsUtil

internal abstract class MoveDiffPreviewAction(private val openInNewWindow: Boolean) : DumbAwareAction() {

  abstract fun isEnabledAndVisible(project: Project): Boolean

  override fun update(e: AnActionEvent) {
    val project = e.project
    val file = JBIterable.from(e.getData(VIRTUAL_FILES)).single()
    e.presentation.isEnabledAndVisible = project != null
                                         && file != null
                                         && file is DiffContentVirtualFile
                                         && isEnabledAndVisible(project)
  }

{'fraction_non_alphanumeric': 0.07715260017050299, 'fraction_numerical': 0.008525149190110827, 'mean_word_length': 3.411654135338346, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3441496', 'n_tokens_mistral': 690, 'n_tokens_neox': 661, 'n_words': 157}