void () { if (myRanges != null) { return; } SelectionModel selectionModel = myEditor.getSelectionModel(); if (!selectionModel.hasSelection()) { myVirtualFiles = VirtualFile.EMPTY_ARRAY; myRanges = TextRange.EMPTY_ARRAY; return; } myVirtualFiles = new VirtualFile[]{FileDocumentManager.getInstance().getFile(myEditor.getDocument())}; int[] selectionStarts = selectionModel.getBlockSelectionStarts(); int[] selectionEnds = selectionModel.getBlockSelectionEnds(); myRanges = new TextRange[selectionStarts.length]; for (int i = 0; i < selectionStarts.length; ++i) { myRanges[i] = new TextRange(selectionStarts[i], selectionEnds[i]); } }