ModCommand (@NotNull ActionContext context) { PsiClassType aClass = getRuntimeExceptionAtCaret(context); PsiMethod method = PsiTreeUtil.getParentOfType(context.findLeaf(), PsiMethod.class); if (method == null) return ModCommand.nop(); ModCommand command = AddExceptionToThrowsFix.addExceptionsToThrowsList(context.project(), method, Collections.singleton(aClass), myProcessHierarchy); if (command == null) { return new ModChooseAction(QuickFixBundle.message("add.runtime.exception.to.throws.header"), List.of( new AddRuntimeExceptionToThrowsAction(ThreeState.YES), new AddRuntimeExceptionToThrowsAction(ThreeState.NO) )); } return command; }