From 670f07c4f4fa14bdeea137ef085508091321ee22 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Tue, 2 Apr 2013 16:47:11 +0400 Subject: [PATCH] IDEA-103813 Character codes instead of characters when creating a new task: read action missed (cherry picked from commit 044f548f9b973d07ed59b81fe7d59651d37c44b3) --- .../intellij/tasks/generic/GenericRepository.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/GenericRepository.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/GenericRepository.java index 6cf5f1e8f235..8245c9eb9500 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/GenericRepository.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/GenericRepository.java @@ -1,7 +1,9 @@ package com.intellij.tasks.generic; +import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.project.ProjectManager; import com.intellij.openapi.util.Comparing; +import com.intellij.openapi.util.Computable; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.XmlElementFactory; import com.intellij.psi.xml.XmlTag; @@ -105,8 +107,15 @@ public class GenericRepository extends BaseRepositoryImpl { String id = matcher.group(placeholders.indexOf(ID_PLACEHOLDER) + 1); String summary = matcher.group(placeholders.indexOf(SUMMARY_PLACEHOLDER) + 1); if (myResponseType == ResponseType.XML && summary != null) { - XmlTag text = XmlElementFactory.getInstance(ProjectManager.getInstance().getDefaultProject()).createTagFromText("" + summary + ""); - summary = XmlUtil.decode(text.getValue().getTrimmedText()); + final String finalSummary = summary; + summary = ApplicationManager.getApplication().runReadAction(new Computable() { + @Override + public String compute() { + XmlElementFactory factory = XmlElementFactory.getInstance(ProjectManager.getInstance().getDefaultProject()); + XmlTag text = factory.createTagFromText("" + finalSummary + ""); + return XmlUtil.decode(text.getValue().getTrimmedText()); + } + }); } tasks.add(new GenericTask(id, summary, this)); }