ModCommand (@NotNull ActionContext context, @NotNull PsiVariable variable) { final List<PsiReferenceExpression> references = collectReferences(variable); Map<PsiExpression, List<PsiExpression>> effects = collectSideEffects(variable, references); if (effects.isEmpty()) { return new RemoveVariableSideEffectAware(variable, false).perform(context); } else { return new ModChooseAction(JavaBundle.message("popup.title.remove.unused.variable"), List.of(new RemoveVariableSideEffectAware(variable, true), new RemoveVariableSideEffectAware(variable, false))); } }