void () { myTaskManager.getState().createChangelist = myCreateChangelist.isSelected(); myTaskManager.getState().shelveChanges = myShelveChanges.isSelected(); myTaskManager.getState().createBranch = myCreateBranch.isSelected(); myTaskManager.getState().useBranch = myUseBranch.isSelected(); if (myShelveChanges.isSelected()) { myTaskManager.shelveChanges(myPreviousTask, myPreviousTask.getSummary()); } if (myCreateChangelist.isSelected()) { myTaskManager.createChangeList(myTask, myChangelistName.getText()); } else { ChangeListManager changeListManager = ChangeListManager.getInstance(myProject); String comment = TaskUtil.getChangeListComment(myTask); changeListManager.editComment(changeListManager.getDefaultListName(), comment); } if (myCreateBranch.isSelected()) { VcsTaskHandler.TaskInfo branchFrom = (VcsTaskHandler.TaskInfo)myBranchFrom.getSelectedItem(); Runnable createBranch = () -> myTaskManager.createBranch(myTask, myPreviousTask, myBranchName.getText(), branchFrom); VcsTaskHandler.TaskInfo[] current = myVcsTaskHandler.getCurrentTasks(); if (branchFrom != null && (current.length == 0 || !current[0].equals(branchFrom))) { myVcsTaskHandler.switchToTask(branchFrom, createBranch); } else { createBranch.run(); } } if (myUseBranch.isSelected()) { VcsTaskHandler.TaskInfo branch = (VcsTaskHandler.TaskInfo)myUseBranchCombo.getSelectedItem(); if (branch != null) { VcsTaskHandler.TaskInfo[] tasks = myVcsTaskHandler.getCurrentTasks(); TaskManagerImpl.addBranches(myPreviousTask, tasks, true); myVcsTaskHandler.switchToTask(branch, () -> TaskManagerImpl.addBranches(myTask, new VcsTaskHandler.TaskInfo[]{branch}, false)); } } }