void (@NotNull AnActionEvent e) { Project project = e.getProject(); assert project != null; TaskManagerImpl taskManager = (TaskManagerImpl)TaskManager.getManager(project); LocalTask task = taskManager.getActiveTask(); CloseTaskDialog dialog = new CloseTaskDialog(project, task); if (dialog.showAndGet()) { ((LocalTaskImpl)task).setClosed(true); final CustomTaskState taskState = dialog.getCloseIssueState(); if (taskState != null) { try { TaskRepository repository = task.getRepository(); assert repository != null; repository.setTaskState(task, taskState); repository.setPreferredCloseTaskState(taskState); } catch (Exception e1) { Messages.showErrorDialog(project, e1.getMessage(), TaskBundle.message("dialog.title.cannot.set.state.for.issue")); } } } }