public void lineGetSegments(BidiSegmentEvent event) { if (redraws()) event.segments= getBidiLineSegments(event.lineOffset, event.lineText); } });
@Override public void lineGetSegments(BidiSegmentEvent event) { if (redraws()) { try { event.segments= getBidiLineSegments(getDocument(), baseLevel, widgetOffset2ModelOffset(event.lineOffset), event.lineText); } catch (BadLocationException e) { // don't touch the segments } } } });
@Override public void lineGetSegments(BidiSegmentEvent event) { if (redraws()) { try { event.segments= getBidiLineSegments(getDocument(), baseLevel, widgetOffset2ModelOffset(event.lineOffset), event.lineText); } catch (BadLocationException e) { // don't touch the segments } } } });
/** * Returns a segmentation of the given line appropriate for BIDI rendering. The default * implementation returns only the string literals of a java code line as segments. * * @param widgetLineOffset the offset of the line * @param line the content of the line * @return the line's BIDI segmentation */ protected int[] getBidiLineSegments(int widgetLineOffset, String line) { if (line != null && line.length() > 0) { int lineOffset= widgetOffset2ModelOffset(widgetLineOffset); try { return getBidiLineSegments(getDocument(), lineOffset); } catch (BadLocationException x) { return null; // don't segment line in this case } } return null; }