@Override public void set(String text) { fSource.set(text); fReplaceList.clear(); }
@Override public void set(String text) { fSource.set(text); fReplaceList.clear(); }
@Override public void set(String text) { fTextStore= new StringTextStore(text); fModifiableTextStore.set(""); //$NON-NLS-1$ }
@Override public void set(String text) { fTextStore= new StringTextStore(text); fModifiableTextStore.set(""); //$NON-NLS-1$ }
/** * Commits all buffered replace commands. */ private void commit() { if (fReplaceList.isEmpty()) return; StringBuilder buffer= new StringBuilder(); int delta= 0; for (Replace replace : fReplaceList) { int offset= buffer.length() - delta; buffer.append(fSource.get(offset, replace.offset - offset)); buffer.append(replace.text); delta= getDelta(replace); } int offset= buffer.length() - delta; buffer.append(fSource.get(offset, fSource.getLength() - offset)); fSource.set(buffer.toString()); fReplaceList.clear(); } }
/** * Commits all buffered replace commands. */ private void commit() { if (fReplaceList.isEmpty()) return; StringBuffer buffer= new StringBuffer(); int delta= 0; for (Iterator<Replace> i= fReplaceList.iterator(); i.hasNext(); ) { Replace replace= i.next(); int offset= buffer.length() - delta; buffer.append(fSource.get(offset, replace.offset - offset)); buffer.append(replace.text); delta= getDelta(replace); } int offset= buffer.length() - delta; buffer.append(fSource.get(offset, fSource.getLength() - offset)); fSource.set(buffer.toString()); fReplaceList.clear(); } }
@Override public void replace(int offset, int length, String text) { if (fTextStore != fModifiableTextStore) { String content= fTextStore.get(0, fTextStore.getLength()); fTextStore= fModifiableTextStore; fTextStore.set(content); } fTextStore.replace(offset, length, text); }
@Override public void replace(int offset, int length, String text) { if (fTextStore != fModifiableTextStore) { String content= fTextStore.get(0, fTextStore.getLength()); fTextStore= fModifiableTextStore; fTextStore.set(content); } fTextStore.replace(offset, length, text); }
public void run() { String text = new String(content); int offset = calculateBacklogOffset(); String currentText = getStore().get(offset,getStore().getLength() - offset); currentText = currentText.concat(text); getStore().set(currentText); getTracker().set(currentText); if(isFirstTimeRead) { offset = calculateBacklogOffset(); currentText = getStore().get(offset,getStore().getLength() - offset); getStore().set(currentText); getTracker().set(currentText); } //int newOffset = getStore().getLength() > content.length ? getStore().getLength() - content.length : 0; DocumentEvent event = new DocumentEvent(LogDocument.this, getStore().getLength(), content.length, text); fireDocumentChanged(event); } };
getStore().set(""); getTracker().set(""); try {
@Override public void set(String text, long modificationStamp) { int length= getStore().getLength(); DocumentEvent e= new DocumentEvent(this, 0, length, text); fireDocumentAboutToBeChanged(e); getStore().set(text); getTracker().set(text); fModificationStamp= modificationStamp; fNextModificationStamp= Math.max(fModificationStamp, fNextModificationStamp); e.fModificationStamp= fModificationStamp; fireDocumentChanged(e); }
@Override public void set(String text, long modificationStamp) { int length= getStore().getLength(); DocumentEvent e= new DocumentEvent(this, 0, length, text); fireDocumentAboutToBeChanged(e); getStore().set(text); getTracker().set(text); fModificationStamp= modificationStamp; fNextModificationStamp= Math.max(fModificationStamp, fNextModificationStamp); e.fModificationStamp= fModificationStamp; fireDocumentChanged(e); }
/** * if the monitor parameter is true and the current FileTail instance thread * is not running the Thread will be inovked and the tail begins to update * this document. * * if the monitor parameter is false the FileTail instance thread is notified * to stop at the next possbile exit point. * @param monitor */ public void setMonitor(boolean monitorIn) { if(monitorIn && !monitor) { getStore().set(""); //$NON-NLS-1$ getTracker().set(""); //$NON-NLS-1$ } monitor = monitorIn; reader.setMonitorStatus(monitor); file.setMonitor(monitor); }
@Override public void switchView(String viewName) { // TODO: Optimize the text retrieval and update notification handling // Currently the text must be changed before switchView is called ... // HACK: // Replace the text like set() would do, // but without sending out notifications. // The stop and resume notification methods do not yield // the desired effect String text = transformText(getCAS().getView(viewName).getDocumentText()); getStore().set(text); getTracker().set(text); // Note: Sends out view update notification ((DocumentUimaImpl) mDocument).switchView(viewName); }
/** * Creates a new document with the given initial content. * * @param initialContent the document's initial content */ public Document(String initialContent) { super(); setTextStore(new CopyOnWriteTextStore(new GapTextStore())); setLineTracker(new DefaultLineTracker()); getStore().set(initialContent); getTracker().set(initialContent); completeInitialization(); }
/** * Creates a new document with the given initial content. * * @param initialContent the document's initial content */ public Document(String initialContent) { super(); setTextStore(new CopyOnWriteTextStore(new GapTextStore())); setLineTracker(new DefaultLineTracker()); getStore().set(initialContent); getTracker().set(initialContent); completeInitialization(); }