/** * Returns the line rendered at the specified location. * * @param p The location in this row header. * @return The corresponding line in the editor. * @throws BadLocationException ble If an error occurs. */ private int viewToModelLine(Point p) throws BadLocationException { int offs = textArea.viewToModel(p); return offs>-1 ? textArea.getLineOfOffset(offs) : -1; }
/** * Returns the tracking icons at the specified view position. * * @param p The view position. * @return The tracking icons at that position. If there are no tracking * icons there, this will be an empty array. * @throws BadLocationException If <code>p</code> is invalid. */ public GutterIconInfo[] getTrackingIcons(Point p) throws BadLocationException { int offs = textArea.viewToModel(new Point(0, p.y)); int line = textArea.getLineOfOffset(offs); return iconArea.getTrackingIcons(line); }
private int rowAtPoint(Point p) { int line = 0; try { int offs = textArea.viewToModel(p); if (offs>-1) { line = textArea.getLineOfOffset(offs); } } catch (BadLocationException ble) { ble.printStackTrace(); // Never happens } return line; }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } int selStart = textArea.getSelectionStart(); int selEnd = textArea.getSelectionEnd(); try { int line1 = textArea.getLineOfOffset(selStart); int startOffs = textArea.getLineStartOffset(line1); int line2 = textArea.getLineOfOffset(selEnd); int endOffs = textArea.getLineEndOffset(line2); // Don't remove the last line if no actual chars are selected if (line2>line1) { if (selEnd==textArea.getLineStartOffset(line2)) { endOffs = selEnd; } } textArea.replaceRange(null, startOffs, endOffs); } catch (BadLocationException ble) { ble.printStackTrace(); // Never happens } }
GutterIconInfo bookmark = bookmarks[i]; int offs = bookmark.getMarkedOffset(); int line = textArea.getLineOfOffset(offs); if (line>curLine) { moveTo = bookmark; GutterIconInfo bookmark = bookmarks[i]; int offs = bookmark.getMarkedOffset(); int line = textArea.getLineOfOffset(offs); if (line<curLine) { moveTo = bookmark; int line = textArea.getLineOfOffset(offs); offs = textArea.getLineStartOffset(line); textArea.setCaretPosition(offs);
int line = 0; try { line = textArea.getLineOfOffset(dot); } catch (Exception e) { e.printStackTrace();
int line = textArea.getLineOfOffset(offs); int end = textArea.getLineEndOffset(line); if (line!=textArea.getLineCount()-1) {
int line = textArea.getLineOfOffset(offs); int start = textArea.getLineStartOffset(line); if (offs==start) {
int line = textArea.getLineOfOffset(offs); int start = textArea.getLineStartOffset(line); if (offs==start) {
/** * Returns the line rendered at the specified location. * * @param p The location in this row header. * @return The corresponding line in the editor. * @throws BadLocationException ble If an error occurs. */ private int viewToModelLine(Point p) throws BadLocationException { int offs = textArea.viewToModel(p); return offs>-1 ? textArea.getLineOfOffset(offs) : -1; }
@Override public String getToolTipText(MouseEvent e) { try { int offset = textArea.viewToModel(e.getPoint()); int linha = textArea.getLineOfOffset(offset) + 1; IconePontoDeParada pontoDeParada = getIconePontoDeParada(linha); if (pontoDeParada != null && !pontoDeParada.estaAtivado()) { return DICA_DOS_PONTOS_DE_PARADA + linha; } } catch (BadLocationException ex) { } return null; }
/** * Returns the tracking icons at the specified view position. * * @param p The view position. * @return The tracking icons at that position. If there are no tracking * icons there, this will be an empty array. * @throws BadLocationException If <code>p</code> is invalid. */ public Object[] getTrackingIcons(Point p) throws BadLocationException { int offs = textArea.viewToModel(new Point(0, p.y)); int line = textArea.getLineOfOffset(offs); return iconArea.getTrackingIcons(line); }
/** * Returns the tracking icons at the specified view position. * * @param p The view position. * @return The tracking icons at that position. If there are no tracking * icons there, this will be an empty array. * @throws BadLocationException If <code>p</code> is invalid. */ public Object[] getTrackingIcons(Point p) throws BadLocationException { int offs = textArea.viewToModel(new Point(0, p.y)); int line = textArea.getLineOfOffset(offs); return iconArea.getTrackingIcons(line); }
/** * Returns the tracking icons at the specified view position. * * @param p The view position. * @return The tracking icons at that position. If there are no tracking * icons there, this will be an empty array. * @throws BadLocationException If <code>p</code> is invalid. */ public GutterIconInfo[] getTrackingIcons(Point p) throws BadLocationException { int offs = textArea.viewToModel(new Point(0, p.y)); int line = textArea.getLineOfOffset(offs); return iconArea.getTrackingIcons(line); }
private int rowAtPoint(Point p) { int line = 0; try { int offs = textArea.viewToModel(p); if (offs>-1) { line = textArea.getLineOfOffset(offs); } } catch (BadLocationException ble) { ble.printStackTrace(); // Never happens } return line; }
public void mousePressed(MouseEvent e) { if (bookmarkingEnabled && bookmarkIcon!=null) { try { int offs = textArea.viewToModel(e.getPoint()); if (offs>-1) { int line = textArea.getLineOfOffset(offs); toggleBookmark(line); } } catch (BadLocationException ble) { ble.printStackTrace(); // Never happens } } }
public void mousePressed(MouseEvent e) { if (bookmarkingEnabled && bookmarkIcon!=null) { try { int offs = textArea.viewToModel(e.getPoint()); if (offs>-1) { int line = textArea.getLineOfOffset(offs); toggleBookmark(line); } } catch (BadLocationException ble) { ble.printStackTrace(); // Never happens } } }
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } int selStart = textArea.getSelectionStart(); int selEnd = textArea.getSelectionEnd(); try { int line1 = textArea.getLineOfOffset(selStart); int startOffs = textArea.getLineStartOffset(line1); int line2 = textArea.getLineOfOffset(selEnd); int endOffs = textArea.getLineEndOffset(line2); // Don't remove the last line if no actual chars are selected if (line2>line1) { if (selEnd==textArea.getLineStartOffset(line2)) { endOffs = selEnd; } } textArea.replaceRange(null, startOffs, endOffs); } catch (BadLocationException ble) { ble.printStackTrace(); // Never happens } }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } int selStart = textArea.getSelectionStart(); int selEnd = textArea.getSelectionEnd(); try { int line1 = textArea.getLineOfOffset(selStart); int startOffs = textArea.getLineStartOffset(line1); int line2 = textArea.getLineOfOffset(selEnd); int endOffs = textArea.getLineEndOffset(line2); // Don't remove the last line if no actual chars are selected if (line2>line1) { if (selEnd==textArea.getLineStartOffset(line2)) { endOffs = selEnd; } } textArea.replaceRange(null, startOffs, endOffs); } catch (BadLocationException ble) { ble.printStackTrace(); // Never happens } }
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } int selStart = textArea.getSelectionStart(); int selEnd = textArea.getSelectionEnd(); try { int line1 = textArea.getLineOfOffset(selStart); int startOffs = textArea.getLineStartOffset(line1); int line2 = textArea.getLineOfOffset(selEnd); int endOffs = textArea.getLineEndOffset(line2); // Don't remove the last line if no actual chars are selected if (line2>line1) { if (selEnd==textArea.getLineStartOffset(line2)) { endOffs = selEnd; } } textArea.replaceRange(null, startOffs, endOffs); } catch (BadLocationException ble) { ble.printStackTrace(); // Never happens } }