mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
editing branch
This commit is contained in:
@@ -54,7 +54,9 @@
|
||||
</component>
|
||||
<component id="573e5" class="javax.swing.JTextField" binding="mySummary">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="300" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
|
||||
@@ -33,6 +33,8 @@ import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -56,7 +58,7 @@ public class EditTaskDialog extends DialogWrapper {
|
||||
protected EditTaskDialog(Project project, LocalTaskImpl task) {
|
||||
super(project);
|
||||
myTask = task;
|
||||
setTitle("Edit Task " + task.getId());
|
||||
setTitle("Edit Task " + (task.isIssue() ? task.getId() : ""));
|
||||
|
||||
// mySummary.putClientProperty(DialogWrapperPeer.HAVE_INITIAL_SELECTION, "");
|
||||
mySummary.setText(task.getSummary());
|
||||
@@ -71,12 +73,16 @@ public class EditTaskDialog extends DialogWrapper {
|
||||
else {
|
||||
ChangeListManager changeListManager = ChangeListManager.getInstance(project);
|
||||
List<LocalChangeList> changeLists = changeListManager.getChangeLists();
|
||||
changeLists.add(null);
|
||||
myChangelist.setModel(new CollectionComboBoxModel<LocalChangeList>(changeLists));
|
||||
final List<ChangeListInfo> lists = task.getChangeLists();
|
||||
if (!lists.isEmpty()) {
|
||||
LocalChangeList list = changeListManager.getChangeList(lists.get(0).id);
|
||||
myChangelist.setSelectedItem(list);
|
||||
}
|
||||
else {
|
||||
myChangelist.setSelectedItem(null);
|
||||
}
|
||||
|
||||
VcsTaskHandler[] handlers = VcsTaskHandler.getAllHandlers(project);
|
||||
if (handlers.length == 0) {
|
||||
@@ -85,7 +91,9 @@ public class EditTaskDialog extends DialogWrapper {
|
||||
}
|
||||
else {
|
||||
VcsTaskHandler.TaskInfo[] tasks = handlers[0].getAllExistingTasks();
|
||||
myBranch.setModel(new DefaultComboBoxModel(tasks));
|
||||
ArrayList<VcsTaskHandler.TaskInfo> infos = new ArrayList<VcsTaskHandler.TaskInfo>(Arrays.asList(tasks));
|
||||
infos.add(null);
|
||||
myBranch.setModel(new CollectionComboBoxModel<VcsTaskHandler.TaskInfo>(infos));
|
||||
final List<BranchInfo> branches = task.getBranches();
|
||||
if (!branches.isEmpty()) {
|
||||
VcsTaskHandler.TaskInfo info = ContainerUtil.find(tasks, new Condition<VcsTaskHandler.TaskInfo>() {
|
||||
@@ -96,6 +104,9 @@ public class EditTaskDialog extends DialogWrapper {
|
||||
});
|
||||
myBranch.setSelectedItem(info);
|
||||
}
|
||||
else {
|
||||
myBranch.setSelectedItem(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
init();
|
||||
@@ -113,7 +124,13 @@ public class EditTaskDialog extends DialogWrapper {
|
||||
}
|
||||
}
|
||||
if (myBranch.isVisible()) {
|
||||
// todo
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user