@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } String content = e.getActionCommand(); if (content != null) { textArea.replaceSelection(content); } else { UIManager.getLookAndFeel().provideErrorFeedback(textArea); } }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } Date today = new Date(); DateFormat timeDateStamp = DateFormat.getDateTimeInstance(); String dateString = timeDateStamp.format(today); textArea.replaceSelection(dateString); }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { RSyntaxTextArea rsta = (RSyntaxTextArea)textArea; bracketInfo = RSyntaxUtilities.getMatchingBracketPosition(rsta, bracketInfo); if (bracketInfo.y>-1) { // Go to the position AFTER the bracket so the previous // bracket (which we were just on) is highlighted. rsta.setCaretPosition(bracketInfo.y+1); } else { UIManager.getLookAndFeel().provideErrorFeedback(rsta); } }
@Override public String getMessage() { String text = null; try { String word = textArea.getText(range.getStartOffset(), getLength()); text = MSG.getString("OccurrenceOf"); text = MessageFormat.format(text, word); } catch (BadLocationException ble) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); } return text; }
@Override public void mouseClicked(MouseEvent e) { Component source = (Component)e.getSource(); if (source instanceof Marker) { ((Marker)source).mouseClicked(e); return; } int line = yToLine(e.getY()); if (line>-1) { try { int offs = textArea.getLineStartOffset(line); textArea.setCaretPosition(offs); } catch (BadLocationException ble) { // Never happens UIManager.getLookAndFeel().provideErrorFeedback(textArea); } } }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } textArea.replaceSelection("\n"); }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } textArea.replaceSelection("\t"); }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } try { int end = textArea.getSelectionStart(); int start = getPreviousWordStart(textArea, end); if (end>start) { textArea.getDocument().remove(start, end-start); } } catch (BadLocationException ex) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); } }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } String selection = textArea.getSelectedText(); if (selection!=null) { textArea.replaceSelection(selection.toLowerCase()); } textArea.requestFocusInWindow(); }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } String selection = textArea.getSelectedText(); if (selection!=null) { textArea.replaceSelection(selection.toUpperCase()); } textArea.requestFocusInWindow(); }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { Gutter gutter = RSyntaxUtilities.getGutter(textArea); if (gutter!=null) { int line = textArea.getCaretLineNumber(); try { gutter.toggleBookmark(line); } catch (BadLocationException ble) { // Never happens UIManager.getLookAndFeel(). provideErrorFeedback(textArea); ble.printStackTrace(); } } }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { RSyntaxTextArea rsta = (RSyntaxTextArea)textArea; if (rsta.isCodeFoldingEnabled()) { Fold fold = getClosestFold(rsta); if (fold!=null) { fold.setCollapsed(collapse); } RSyntaxUtilities.possiblyRepaintGutter(textArea); } else { UIManager.getLookAndFeel().provideErrorFeedback(rsta); } }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { RSyntaxTextArea rsta = (RSyntaxTextArea)textArea; if (rsta.isCodeFoldingEnabled()) { Fold fold = getClosestFold(rsta); if (fold!=null) { fold.toggleCollapsedState(); } RSyntaxUtilities.possiblyRepaintGutter(textArea); } else { UIManager.getLookAndFeel().provideErrorFeedback(rsta); } }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { try { int offs = textArea.getCaretPosition(); int begOffs = getWordStart(textArea, offs); if (select) { textArea.moveCaretPosition(begOffs); } else { textArea.setCaretPosition(begOffs); } } catch (BadLocationException ble) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); } }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { try { int offs = textArea.getCaretPosition(); int endOffs = getWordEnd(textArea, offs); if (select) { textArea.moveCaretPosition(endOffs); } else { textArea.setCaretPosition(endOffs); } } catch (BadLocationException ble) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); } }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { RSyntaxTextArea rsta = (RSyntaxTextArea)textArea; if (rsta.isCodeFoldingEnabled()) { FoldCollapser collapser = new FoldCollapser(); collapser.collapseFolds(rsta.getFoldManager()); RSyntaxUtilities.possiblyRepaintGutter(textArea); } else { UIManager.getLookAndFeel().provideErrorFeedback(rsta); } }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { RSyntaxTextArea rsta = (RSyntaxTextArea)textArea; if (rsta.isCodeFoldingEnabled()) { FoldCollapser collapser = new FoldCollapser() { @Override public boolean getShouldCollapse(Fold fold) { return true; } }; collapser.collapseFolds(rsta.getFoldManager()); RSyntaxUtilities.possiblyRepaintGutter(textArea); } else { UIManager.getLookAndFeel().provideErrorFeedback(rsta); } }
@Override public void setVisible(boolean visible) { if (list.getModel().getSize()==0) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } super.setVisible(visible); updateTextAreaCaret(visible); if (visible) { SwingUtilities.invokeLater(() -> { requestFocus(); if (list.getModel().getSize()>0) { list.setSelectedIndex(0); } list.requestFocusInWindow(); }); } }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { RSyntaxTextArea rsta = (RSyntaxTextArea)textArea; if (rsta.isCodeFoldingEnabled()) { FoldManager fm = rsta.getFoldManager(); for (int i=0; i<fm.getFoldCount(); i++) { expand(fm.getFold(i)); } RSyntaxUtilities.possiblyRepaintGutter(rsta); } else { UIManager.getLookAndFeel().provideErrorFeedback(rsta); } }