inspection toolwindow: allow view the whole element in preview IDEA-156364
authorDmitry Batkovich <dmitry.batkovich@jetbrains.com>
Wed, 25 May 2016 09:35:30 +0000 (12:35 +0300)
committerDmitry Batkovich <dmitry.batkovich@jetbrains.com>
Wed, 25 May 2016 09:35:30 +0000 (12:35 +0300)
platform/lang-impl/src/com/intellij/codeInspection/ui/ProblemPreviewEditorPresentation.java

index 0971f03528cc151911e99b08dec9ccf39b51e166..b700c8a6196d2c715899b898497b896c9a70d60f 100644 (file)
@@ -70,7 +70,7 @@ public class ProblemPreviewEditorPresentation {
     final boolean[] isUpdated = new boolean[]{false};
     final List<UsageInfo> elements = Arrays.stream(descriptors)
       .filter(myDescriptors::add)
-      .filter(d -> d instanceof ProblemDescriptorBase)
+      .filter(ProblemDescriptorBase.class::isInstance)
       .map(d -> ((ProblemDescriptorBase)d).getPsiElement())
       .filter(e -> e != null && e.isValid())
       .map(ProblemPreviewEditorPresentation::getWholeElement)
@@ -91,7 +91,7 @@ public class ProblemPreviewEditorPresentation {
       if (elements.size() == 1) {
         final PsiElement element = elements.get(0).getElement();
         LOG.assertTrue(element != null);
-        final int offset = element.getTextOffset();
+        final int offset = element.getTextRange().getEndOffset();
         myEditor.getScrollingModel().scrollTo(myEditor.offsetToLogicalPosition(offset), ScrollType.CENTER);
       } else {
         myEditor.getScrollingModel().scrollTo(myEditor.offsetToLogicalPosition(0), ScrollType.CENTER_UP);