diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/action/RearrangeCodeAction.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/action/RearrangeCodeAction.java index e0085ba12e77..1906a47aa724 100644 --- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/action/RearrangeCodeAction.java +++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/action/RearrangeCodeAction.java @@ -15,7 +15,6 @@ */ package com.intellij.application.options.codeStyle.arrangement.action; -import com.intellij.lang.Language; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.LangDataKeys; @@ -45,11 +44,8 @@ public class RearrangeCodeAction extends AnAction { @Override public void update(AnActionEvent e) { - Language language = LangDataKeys.LANGUAGE.getData(e.getDataContext()); - boolean enabled = false; - if (language != null) { - enabled = Rearranger.EXTENSION.forLanguage(language) != null; - } + PsiFile file = LangDataKeys.PSI_FILE.getData(e.getDataContext()); + boolean enabled = file != null && Rearranger.EXTENSION.forLanguage(file.getLanguage()) != null; e.getPresentation().setEnabled(enabled); }