IDEA-115693 Exception on Show Bookmarks

This commit is contained in:
Vassiliy
2013-11-04 13:41:08 +04:00
parent 757a12c7d6
commit 32a0e7c560
2 changed files with 8 additions and 5 deletions
@@ -89,6 +89,7 @@ public interface DetailView extends UserDataHolder {
return myFile;
}
@Nullable
public LogicalPosition getNavigate() {
return myNavigate;
}
@@ -101,7 +102,7 @@ public interface DetailView extends UserDataHolder {
private final LogicalPosition myNavigate;
private final TextAttributes myAttributes;
public PreviewEditorState(VirtualFile file, LogicalPosition navigate, TextAttributes attributes) {
public PreviewEditorState(VirtualFile file, @Nullable LogicalPosition navigate, TextAttributes attributes) {
myFile = file;
myNavigate = navigate;
@@ -156,14 +156,16 @@ public class DetailViewImpl extends JPanel implements DetailView, UserDataHolder
add(getEditor().getComponent(), BorderLayout.CENTER);
}
getEditor().getCaretModel().moveToLogicalPosition(positionToNavigate);
validate();
getEditor().getScrollingModel().scrollToCaret(ScrollType.CENTER);
if (positionToNavigate != null) {
getEditor().getCaretModel().moveToLogicalPosition(positionToNavigate);
validate();
getEditor().getScrollingModel().scrollToCaret(ScrollType.CENTER);
}
getEditor().setBorder(IdeBorderFactory.createBorder(SideBorder.TOP));
clearHightlighting();
if (lineAttributes != null) {
if (lineAttributes != null && positionToNavigate != null) {
myHighlighter = getEditor().getMarkupModel().addLineHighlighter(positionToNavigate.line, HighlighterLayer.SELECTION - 1,
lineAttributes);
}