@Override public void replace(int offset, int length, String text, AttributeSet attrs) throws BadLocationException { // CHECKSTYLE:OFF String oldValue = TextFieldPropertyChange.this.getText(); // CHECKSTYLE:ON this.ignoreEvents = true; super.replace(offset, length, text, attrs); this.ignoreEvents = false; String newValue = TextFieldPropertyChange.this.getText(); if (!oldValue.equals(newValue)) { TextFieldPropertyChange.this.firePropertyChange(TEXT_PROPERTY, oldValue, newValue); } }
private void doSetMessage(final IMessage message) { try { this.messageTitleLabel.setForeground(MessageUI.getColor(message)); this.messageTitleLabel.setText(message.getText()); this.messageTypeLabel.setIcon(MessageUI.getIcon(message, getIcon())); this.messageTextArea.setForeground(MessageUI.getColor(message)); this.messageDocument.replace(0, this.messageDocument.getLength(), message.getDescription(), null); } catch (final Exception exception) { // TODO_NOW: handle exception } }
/** * Replaces existing text. * * @param offset offset value. * @param length length value. * @param text replacement text. * @param attrs text attributes. * @throws BadLocationException Bad Location Error. */ public void replace(int offset, int length, String text, AttributeSet attrs) throws BadLocationException { text = extractAscciCharsOnly(text); debug("replace(), text=" + text + ", cursorKeyPressed=" + cursorKeyPressed); int caretPosition = editor.getCaretPosition(); super.replace(offset, length, text, attrs); if (cursorKeyPressed) { highlightCompletedText(caretPosition); } }
super.replace(offset, length, string, as);