private void scrollMain(int scrollPosCorrected, final List<ScrollingModel> models) { final int pointX = (int) myEditor.logicalPositionToXY(new LogicalPosition(0, scrollPosCorrected)).getX(); for (ScrollingModel model : models) { model.scrollHorizontally(pointX); } }
private void scrollOther( int scrollPosCorrected, final int maxColumnsOur, int maxColumnsOther, final List<ScrollingModel> models) { int pos2; if (myLeftScroll.getValue() == 0) { pos2 = 0; } else if ((scrollPosCorrected + myLeftScroll.getModel().getExtent()) >= maxColumnsOur) { pos2 = maxColumnsOther + 1; } else { pos2 = (int) (scrollPosCorrected * (((double) maxColumnsOther) / maxColumnsOur)); } final int pointX2 = (int) myEditor.logicalPositionToXY(new LogicalPosition(0, pos2)).getX(); for (ScrollingModel model : models) { model.scrollHorizontally(pointX2); } }
public void doClick(final MouseEvent e, final int width) { RangeHighlighter marker = getNearestRangeHighlighter(e, width); if (marker == null) return; int offset = marker.getStartOffset(); final Document doc = myEditor.getDocument(); if (doc.getLineCount() > 0) { // Necessary to expand folded block even if navigating just before one // Very useful when navigating to first unused import statement. int lineEnd = doc.getLineEndOffset(doc.getLineNumber(offset)); myEditor.getCaretModel().moveToOffset(lineEnd); } myEditor.getCaretModel().moveToOffset(offset); myEditor.getSelectionModel().removeSelection(); ScrollingModel scrollingModel = myEditor.getScrollingModel(); scrollingModel.disableAnimation(); scrollingModel.scrollToCaret(ScrollType.CENTER); scrollingModel.enableAnimation(); fireErrorMarkerClicked(marker, e); }