From d272009327b16b23905db10b55d109f9216134f6 Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 27 Dec 2011 16:22:39 +0100 Subject: [PATCH] EA-32727 - assert: JavaDocReferenceInspection$RenameReferenceQuickFix.applyFix --- .../javaDoc/JavaDocReferenceInspection.java | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/java/java-impl/src/com/intellij/codeInspection/javaDoc/JavaDocReferenceInspection.java b/java/java-impl/src/com/intellij/codeInspection/javaDoc/JavaDocReferenceInspection.java index 841f8b892567..8f21d5988000 100644 --- a/java/java-impl/src/com/intellij/codeInspection/javaDoc/JavaDocReferenceInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/javaDoc/JavaDocReferenceInspection.java @@ -285,22 +285,28 @@ public class JavaDocReferenceInspection extends BaseLocalInspectionTool { return getName(); } - public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { - final Editor editor = PlatformDataKeys.EDITOR.getData(DataManager.getInstance().getDataContext()); - assert editor != null; - final TextRange textRange = ((ProblemDescriptorImpl)descriptor).getTextRange(); - editor.getSelectionModel().setSelection(textRange.getStartOffset(), textRange.getEndOffset()); + public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) { + final AsyncResult asyncResult = DataManager.getInstance().getDataContextFromFocus(); + asyncResult.doWhenDone(new AsyncResult.Handler() { + @Override + public void run(DataContext dataContext) { + final Editor editor = PlatformDataKeys.EDITOR.getData(dataContext); + assert editor != null; + final TextRange textRange = ((ProblemDescriptorImpl)descriptor).getTextRange(); + editor.getSelectionModel().setSelection(textRange.getStartOffset(), textRange.getEndOffset()); - final String word = editor.getSelectionModel().getSelectedText(); + final String word = editor.getSelectionModel().getSelectedText(); - if (word == null || StringUtil.isEmptyOrSpaces(word)) { - return; - } - final List items = new ArrayList(); - for (String variant : myUnboundParams) { - items.add(LookupElementBuilder.create(variant)); - } - LookupManager.getInstance(project).showLookup(editor, items.toArray(new LookupElement[items.size()])); + if (word == null || StringUtil.isEmptyOrSpaces(word)) { + return; + } + final List items = new ArrayList(); + for (String variant : myUnboundParams) { + items.add(LookupElementBuilder.create(variant)); + } + LookupManager.getInstance(project).showLookup(editor, items.toArray(new LookupElement[items.size()])); + } + }); } }