From 09c9ffd8434f32ae393a13e00a91ef8d471a30c7 Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 14 Aug 2012 16:28:16 +0200 Subject: [PATCH] don't try to modify decompiled code (EA-35877) --- .../generation/surroundWith/SurroundWithHandler.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/generation/surroundWith/SurroundWithHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/generation/surroundWith/SurroundWithHandler.java index 8f79cfe3db92..d8a981c4a7f1 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/generation/surroundWith/SurroundWithHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/generation/surroundWith/SurroundWithHandler.java @@ -45,6 +45,7 @@ import com.intellij.openapi.options.ShowSettingsUtil; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.popup.JBPopupFactory; import com.intellij.openapi.util.TextRange; +import com.intellij.psi.PsiCompiledElement; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; @@ -69,6 +70,11 @@ public class SurroundWithHandler implements CodeInsightActionHandler { } public static void invoke(final Project project, final Editor editor, PsiFile file, Surrounder surrounder) { + if (file instanceof PsiCompiledElement) { + HintManager.getInstance().showErrorHint(editor, "Can't modify decompiled code"); + return; + } + List applicable = buildSurroundActions(project, editor, file, surrounder); if (applicable != null) { showPopup(editor, applicable);