use of com.intellij.tasks.impl.TaskManagerImpl in project intellij-community by JetBrains.
the class CloseTaskAction method actionPerformed.
public void actionPerformed(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()) {
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(), "Cannot Set State For Issue");
}
}
}
}
use of com.intellij.tasks.impl.TaskManagerImpl in project intellij-community by JetBrains.
the class OpenTaskDialog method createTask.
public void createTask() {
final TaskManagerImpl taskManager = (TaskManagerImpl) TaskManager.getManager(myProject);
if (myUpdateState.isSelected()) {
final CustomTaskState taskState = myTaskStateCombo.getSelectedState();
final TaskRepository repository = myTask.getRepository();
if (repository != null && taskState != null) {
try {
repository.setTaskState(myTask, taskState);
repository.setPreferredOpenTaskState(taskState);
} catch (Exception ex) {
Messages.showErrorDialog(myProject, ex.getMessage(), "Cannot Set State For Issue");
LOG.warn(ex);
}
}
}
taskManager.activateTask(myTask, isClearContext());
if (myTask.getType() == TaskType.EXCEPTION && AnalyzeTaskStacktraceAction.hasTexts(myTask)) {
AnalyzeTaskStacktraceAction.analyzeStacktrace(myTask, myProject);
}
for (TaskDialogPanel panel : myPanels) {
panel.commit();
}
}
use of com.intellij.tasks.impl.TaskManagerImpl in project intellij-community by JetBrains.
the class TaskSettingsTest method testCarriageReturnInFormat.
public void testCarriageReturnInFormat() throws Exception {
TaskRepository repository = new YouTrackRepository();
String format = "foo \n bar";
repository.setCommitMessageFormat(format);
((TaskManagerImpl) myTaskManager).setRepositories(Collections.singletonList(repository));
TaskManagerImpl.Config config = ((TaskManagerImpl) myTaskManager).getState();
Element element = XmlSerializer.serialize(config);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
JDOMUtil.writeDocument(new Document(element), stream, "\n");
Element element1 = JDOMUtil.load(new ByteArrayInputStream(stream.toByteArray()));
TaskManagerImpl.Config deserialize = XmlSerializer.deserialize(element1, TaskManagerImpl.Config.class);
((TaskManagerImpl) myTaskManager).loadState(deserialize);
TaskRepository[] repositories = myTaskManager.getAllRepositories();
assertEquals(format, repositories[0].getCommitMessageFormat());
}
use of com.intellij.tasks.impl.TaskManagerImpl in project intellij-community by JetBrains.
the class TaskCompletionTest method configureRepository.
private TestRepository configureRepository(LocalTaskImpl... tasks) {
TaskManagerImpl manager = getManager();
TestRepository repository = new TestRepository(tasks);
manager.setRepositories(Arrays.asList(repository));
manager.getState().updateEnabled = false;
return repository;
}
use of com.intellij.tasks.impl.TaskManagerImpl in project intellij-community by JetBrains.
the class TaskManagerTest method testBranchNameSuggestion.
public void testBranchNameSuggestion() throws Exception {
TaskTestUtil.TaskBuilder task = new TaskTestUtil.TaskBuilder("IDEA-666", "Bad news", null);
TaskManagerImpl taskManager = myTaskManager;
assertEquals("IDEA-666", taskManager.suggestBranchName(task));
String format = taskManager.getState().branchNameFormat;
try {
taskManager.getState().branchNameFormat = "feature/{id}";
assertEquals("feature/IDEA-666", taskManager.suggestBranchName(task));
taskManager.getState().branchNameFormat = "{id}_{summary}";
assertEquals("IDEA-666_Bad-news", taskManager.suggestBranchName(task));
} finally {
taskManager.getState().branchNameFormat = format;
}
}
Aggregations