[by: alexander.doroshko] IDEA-95143 Code Style | Arrangement: 'Rearrange code' action should not be shown in 'Code' menu if it is not available in current context

This commit is contained in:
Denis.Zhdanov
2012-11-20 15:31:44 +04:00
parent 62b76edaa0
commit cb25969429
@@ -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);
}