/** * Notifies listener about a document change. */ private void fireDocumentChanged() { DocumentEvent ev = new DocumentEvent(); ev.fDocument = this; fireDocumentChanged(ev); }
public void run() { DocumentEvent event = new DocumentEvent(LogDocument.this, getStore().getLength(),0,""); //$NON-NLS-1$ fireDocumentAboutToBeChanged(event); } };
interface Event { void accept(EventVisitor visitor); } class DocumentEventImpl implements Event { @Override void accept(EventVisitor visitor) { visitor.visitDocumentEvent(new DocumentEvent(){ // concrete document event stuff }); } } class MailEventImpl implements Event { ... } public void divideEvent(Event event) { event.accept(new EventDivider()); }
@Inject public XtextDocument(DocumentTokenSource tokenSource, ITextEditComposer composer) { this.tokenSource = tokenSource; tokenSource.computeDamageRegion(new DocumentEvent(this, 0, getLength(), this.get())); this.composer = composer; }
return new DocumentEvent(document, offset, length, text.toString());
return new DocumentEvent(document, offset, length, text);
@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); }
@Override public void replace(int pos, int length, String text, long modificationStamp) throws BadLocationException { if ((0 > pos) || (0 > length) || (pos + length > getLength())) throw new BadLocationException(); DocumentEvent e= new DocumentEvent(this, pos, length, text); fireDocumentAboutToBeChanged(e); getStore().replace(pos, length, text); getTracker().replace(pos, length, text); fModificationStamp= modificationStamp; fNextModificationStamp= Math.max(fModificationStamp, fNextModificationStamp); e.fModificationStamp= fModificationStamp; fireDocumentChanged(e); }
@Override public void replace(int pos, int length, String text, long modificationStamp) throws BadLocationException { if ((0 > pos) || (0 > length) || (pos + length > getLength())) throw new BadLocationException(); DocumentEvent e= new DocumentEvent(this, pos, length, text); fireDocumentAboutToBeChanged(e); getStore().replace(pos, length, text); getTracker().replace(pos, length, text); fModificationStamp= modificationStamp; fNextModificationStamp= Math.max(fModificationStamp, fNextModificationStamp); e.fModificationStamp= fModificationStamp; fireDocumentChanged(e); }
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); } };
@Override public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) { if (oldInput == fDocument) { if (fDocument != null) fDocument.removeDocumentListener(this); if (fIsIncrementalReconciler) { synchronized (fDirtyRegionQueue) { fDirtyRegionQueue.purgeQueue(); } if (fDocument != null && fDocument.getLength() > 0 && fThread.isDirty() && fThread.isAlive()) { DocumentEvent e= new DocumentEvent(fDocument, 0, fDocument.getLength(), ""); //$NON-NLS-1$ createDirtyRegion(e); fThread.reset(); fThread.suspendCallerWhileDirty(); } } fDocument= null; } }
@Override public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) { if (oldInput == fDocument) { if (fDocument != null) fDocument.removeDocumentListener(this); if (fIsIncrementalReconciler) { synchronized (fDirtyRegionQueue) { fDirtyRegionQueue.purgeQueue(); } if (fDocument != null && fDocument.getLength() > 0 && fThread.isDirty() && fThread.isAlive()) { DocumentEvent e= new DocumentEvent(fDocument, 0, fDocument.getLength(), ""); //$NON-NLS-1$ createDirtyRegion(e); fThread.reset(); fThread.suspendCallerWhileDirty(); } } fDocument= null; } }
/** * Forces the reconciler to reconcile the structure of the whole document. * Clients may extend this method. */ protected void forceReconciling() { if (fDocument != null) { if (!fThread.isDirty()&& fThread.isAlive()) aboutToBeReconciled(); if (fThread.isActive()) fProgressMonitor.setCanceled(true); if (fIsIncrementalReconciler) { DocumentEvent e= new DocumentEvent(fDocument, 0, fDocument.getLength(), fDocument.get()); createDirtyRegion(e); } startReconciling(); } }
if (isFirstTimeRead) { listener.fileChanged(LogViewerPlugin.getResourceString("tail.loading.file",new String[]{path}).toCharArray(),true); DocumentEvent event = new DocumentEvent(); event.fText = doc.get(); documentAboutToBeChanged(event);
/** * Forces the reconciler to reconcile the structure of the whole document. * Clients may extend this method. */ protected void forceReconciling() { if (fDocument != null) { if (!fThread.isDirty()&& fThread.isAlive()) aboutToBeReconciled(); if (fThread.isActive()) fProgressMonitor.setCanceled(true); if (fIsIncrementalReconciler) { DocumentEvent e= new DocumentEvent(fDocument, 0, fDocument.getLength(), fDocument.get()); createDirtyRegion(e); } startReconciling(); } }
DocumentEvent event = new DocumentEvent(newState, startOffset, length, text); diffContexts.add(new HighlightedPositionDiffContext(oldState, event, oldPositions, newPositions)); } else {
try { String text= document.get(region.getOffset(), region.getLength()); DocumentEvent de= new DocumentEvent(document, region.getOffset(), region.getLength(), text); damage= getDamage(de, false); } catch (BadLocationException x) {
try { String text= document.get(region.getOffset(), region.getLength()); DocumentEvent de= new DocumentEvent(document, region.getOffset(), region.getLength(), text); damage= getDamage(de, false); } catch (BadLocationException x) {
try { String text= document.get(region.getOffset(), region.getLength()); DocumentEvent de= new DocumentEvent(document, region.getOffset(), region.getLength(), text); damage= getDamage(de, false); } catch (BadLocationException x) {