Search in sources :

Example 1 with BufferChangedEvent

use of org.eclipse.jdt.core.BufferChangedEvent in project che by eclipse.

the class DocumentAdapter method close.

/*
	 * @see IBuffer#close()
	 */
public void close() {
    if (isClosed())
        return;
    IDocument d = fDocument;
    fDocument = new Document();
    fIsClosed = true;
    d.removeDocumentListener(this);
    //
    //		if (fTextFileBuffer != null) {
    //			ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager();
    //			try {
    //				if (fFileStore != null)
    //					manager.disconnectFileStore(fFileStore, new NullProgressMonitor());
    //				else
    //					manager.disconnect(fPath, fLocationKind, new NullProgressMonitor());
    //			} catch (CoreException x) {
    //				// ignore
    //			}
    //			fTextFileBuffer = null;
    //		}
    fireBufferChanged(new BufferChangedEvent(this, 0, 0, null));
    fBufferListeners.clear();
}
Also used : Document(org.eclipse.jface.text.Document) IDocument(org.eclipse.jface.text.IDocument) BufferChangedEvent(org.eclipse.jdt.core.BufferChangedEvent) IDocument(org.eclipse.jface.text.IDocument)

Example 2 with BufferChangedEvent

use of org.eclipse.jdt.core.BufferChangedEvent in project eclipse.jdt.ls by eclipse.

the class DocumentAdapter method close.

@Override
public void close() {
    synchronized (lock) {
        if (fIsClosed) {
            return;
        }
        fIsClosed = true;
        fDocument.removeDocumentListener(this);
        if (fTextFileBuffer != null) {
            try {
                ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager();
                manager.disconnect(fFile.getFullPath(), LocationKind.NORMALIZE, null);
            } catch (CoreException x) {
            // ignore
            }
            fTextFileBuffer = null;
        }
        fireBufferChanged(new BufferChangedEvent(this, 0, 0, null));
        fBufferListeners.clear();
        fDocument = null;
    }
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) ITextFileBufferManager(org.eclipse.core.filebuffers.ITextFileBufferManager) BufferChangedEvent(org.eclipse.jdt.core.BufferChangedEvent)

Aggregations

BufferChangedEvent (org.eclipse.jdt.core.BufferChangedEvent)2 ITextFileBufferManager (org.eclipse.core.filebuffers.ITextFileBufferManager)1 CoreException (org.eclipse.core.runtime.CoreException)1 Document (org.eclipse.jface.text.Document)1 IDocument (org.eclipse.jface.text.IDocument)1