use of com.intellij.tasks.ChangeListInfo in project intellij-community by JetBrains.
the class SwitchTaskAction method removeTask.
public static void removeTask(@NotNull final Project project, LocalTask task, TaskManager manager) {
if (task.isDefault()) {
Messages.showInfoMessage(project, "Default task cannot be removed", "Cannot Remove");
} else {
List<ChangeListInfo> infos = task.getChangeLists();
List<LocalChangeList> lists = ContainerUtil.mapNotNull(infos, (NullableFunction<ChangeListInfo, LocalChangeList>) changeListInfo -> {
LocalChangeList changeList = ChangeListManager.getInstance(project).getChangeList(changeListInfo.id);
return changeList != null && !changeList.isDefault() ? changeList : null;
});
boolean removeIt = true;
l: for (LocalChangeList list : lists) {
if (!list.getChanges().isEmpty()) {
int result = Messages.showYesNoCancelDialog(project, "Changelist associated with '" + task.getSummary() + "' is not empty.\n" + "Do you want to remove it and move the changes to the active changelist?", "Changelist Not Empty", Messages.getWarningIcon());
switch(result) {
case Messages.YES:
break l;
case Messages.NO:
removeIt = false;
break;
default:
return;
}
}
}
if (removeIt) {
for (LocalChangeList list : lists) {
ChangeListManager.getInstance(project).removeChangeList(list);
}
}
manager.removeTask(task);
}
}
use of com.intellij.tasks.ChangeListInfo in project intellij-community by JetBrains.
the class EditTaskDialog method doOKAction.
@Override
protected void doOKAction() {
myTask.setSummary(mySummary.getText());
if (myChangelist.isVisible()) {
List<ChangeListInfo> changeLists = myTask.getChangeLists();
changeLists.clear();
LocalChangeList item = (LocalChangeList) myChangelist.getSelectedItem();
if (item != null) {
changeLists.add(new ChangeListInfo(item));
}
}
if (myBranch.isVisible()) {
List<BranchInfo> branches = myTask.getBranches();
branches.clear();
VcsTaskHandler.TaskInfo branch = (VcsTaskHandler.TaskInfo) myBranch.getSelectedItem();
if (branch != null) {
List<BranchInfo> infos = BranchInfo.fromTaskInfo(branch, false);
branches.addAll(infos);
}
}
close(OK_EXIT_CODE);
}
Aggregations