void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { if (!(element instanceof GrTypeCastExpression)) return; GrExpression operand = ((GrTypeCastExpression)element).getOperand(); GrTypeElement type = ((GrTypeCastExpression)element).getCastTypeElement(); if (type == null) return; if (operand == null) return; GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(context.project()); GrExpression safeCast = factory.createExpressionFromText(operand.getText() + " as " + type.getText()); ((GrTypeCastExpression)element).replaceWithExpression(safeCast, true); }