private DocOp.ModifyUndoEdit getModifyUndoEdit() { if (getType() == DocumentEvent.EventType.CHANGE) { throw new IllegalStateException("Cannot be called for CHANGE events."); // NOI18N } if (modifyUndoEdit == null) { modifyUndoEdit = (DocOp.ModifyUndoEdit) findEdit(DocOp.ModifyUndoEdit.class); } return modifyUndoEdit; }
private DocumentContent.Edit getModifyUndoEdit() { if (getType() == DocumentEvent.EventType.CHANGE) { throw new IllegalStateException("Cannot be called for CHANGE events."); // NOI18N } if (modifyUndoEdit == null) { modifyUndoEdit = (DocumentContent.Edit)findEdit(DocumentContent.Edit.class); } return modifyUndoEdit; }
/** Get the count of '\n' (line-feeds) contained in the inserted/removed text. */ public int getLFCount() { if (getType() == DocumentEvent.EventType.CHANGE) { throw new IllegalStateException("Not available for CHANGE events"); // NOI18N } if (lfCount == -1) { String text = getText(); int lfCnt = 0; for (int i = text.length() - 1; i >= 0; i--) { if (text.charAt(i) == '\n') { lfCnt++; } } lfCount = lfCnt; } return lfCount; }
public String getDrawLayerName() { if (getType() != DocumentEvent.EventType.CHANGE) { throw new IllegalStateException("Can be called for CHANGE events only."); // NOI18N } DrawLayerChange dlc = (DrawLayerChange)findEdit(DrawLayerChange.class); return (dlc != null) ? dlc.getDrawLayerName() : null; }
public int getDrawLayerVisibility() { if (getType() != DocumentEvent.EventType.CHANGE) { throw new IllegalStateException("Can be called for CHANGE events only."); // NOI18N } DrawLayerChange dlc = (DrawLayerChange)findEdit(DrawLayerChange.class); return (dlc != null) ? dlc.getDrawLayerVisibility() : -1; }
public String getDrawLayerName() { if (getType() != DocumentEvent.EventType.CHANGE) { throw new IllegalStateException("Can be called for CHANGE events only."); // NOI18N } DrawLayerChange dlc = (DrawLayerChange) findEdit(DrawLayerChange.class); return (dlc != null) ? dlc.getDrawLayerName() : null; }
private FixLineSyntaxState getFixLineSyntaxState() { if (getType() == DocumentEvent.EventType.CHANGE) { throw new IllegalStateException("Cannot be called for CHANGE events."); // NOI18N } if (fixLineSyntaxState == null) { fixLineSyntaxState = ((FixLineSyntaxState.BeforeLineUndo)findEdit( FixLineSyntaxState.BeforeLineUndo.class)).getMaster(); } return fixLineSyntaxState; }
public int getDrawLayerVisibility() { if (getType() != DocumentEvent.EventType.CHANGE) { throw new IllegalStateException("Can be called for CHANGE events only."); // NOI18N } DrawLayerChange dlc = (DrawLayerChange) findEdit(DrawLayerChange.class); return (dlc != null) ? dlc.getDrawLayerVisibility() : -1; }
/** Get the offset at which the updating of the syntax stopped so there * are no more changes in the tokens after this point. */ public int getSyntaxUpdateOffset() { if (getType() == DocumentEvent.EventType.CHANGE) { throw new IllegalStateException("Not available for CHANGE events"); // NOI18N } return getFixLineSyntaxState().getSyntaxUpdateOffset(); }
private boolean isLastModifyUndoEdit() { if (getType() == DocumentEvent.EventType.CHANGE) { return true; // OK in this case } BaseDocument doc = (BaseDocument) getDocument(); doc.extWriteLock(); // lock to sync if ongoing doc change try { // #8692 check last modify undo edit if (doc.lastModifyUndoEdit == null) { return true; // OK in this case } DocOp.ModifyUndoEdit undoEdit = getModifyUndoEdit(); return (undoEdit == doc.lastModifyUndoEdit); } finally { doc.extWriteUnlock(); } }
private boolean isLastModifyUndoEdit() { if (getType() == DocumentEvent.EventType.CHANGE) { return true; // OK in this case } BaseDocument doc = (BaseDocument)getDocument(); doc.extWriteLock(); // lock to sync if ongoing doc change try { // #8692 check last modify undo edit if (doc.lastModifyUndoEdit == null) { return true; // OK in this case } DocumentContent.Edit undoEdit = getModifyUndoEdit(); return (undoEdit == doc.lastModifyUndoEdit); } finally { doc.extWriteUnlock(); } }
if (getType() == DocumentEvent.EventType.INSERT) { // last was insert if (evt.getType() == DocumentEvent.EventType.INSERT) { // adding insert to insert String text = getText(); String evtText = evt.getText(); if (evt.getType() == DocumentEvent.EventType.INSERT) { // adding insert to remove } else { // adding remove to remove