From a4402696936774fb85d9b173dcbea9d09783d189 Mon Sep 17 00:00:00 2001 From: Alexander Lobas Date: Thu, 16 Mar 2017 17:12:36 +0300 Subject: [PATCH] EA-81720 - assert: SurroundAction.actionPerformed --- .../com/intellij/uiDesigner/actions/SurroundAction.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/actions/SurroundAction.java b/plugins/ui-designer/src/com/intellij/uiDesigner/actions/SurroundAction.java index 5d3d17a46c85..8991bf7f5fa0 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/actions/SurroundAction.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/actions/SurroundAction.java @@ -61,7 +61,7 @@ public class SurroundAction extends AbstractGuiEditorAction { final Palette palette = Palette.getInstance(editor.getProject()); final ComponentItem cItem = palette.getItem(myComponentClass); - assert cItem != null; + assert cItem != null : myComponentClass; CommandProcessor.getInstance().executeCommand( editor.getProject(), () -> { @@ -176,10 +176,12 @@ public class SurroundAction extends AbstractGuiEditorAction { protected void update(@NotNull final GuiEditor editor, final ArrayList selection, final AnActionEvent e) { FormEditingUtil.remapToActionTargets(selection); RadContainer selectionParent = FormEditingUtil.getSelectionParent(selection); - e.getPresentation().setEnabled(selectionParent != null && + Palette palette = Palette.getInstance(editor.getProject()); + e.getPresentation().setEnabled(palette.getItem(myComponentClass) != null && + (selectionParent != null && ((!selectionParent.getLayoutManager().isGrid() && selection.size() == 1) || isSelectionContiguous(selectionParent, selection)) && - canWrapSelection(selection)); + canWrapSelection(selection))); } private boolean canWrapSelection(final ArrayList selection) {