org.eclipse.xtext.ui.compare
Class StreamContentDocumentProvider

java.lang.Object
  extended by org.eclipse.ui.texteditor.AbstractDocumentProvider
      extended by org.eclipse.xtext.ui.compare.StreamContentDocumentProvider
All Implemented Interfaces:
org.eclipse.ui.texteditor.IDocumentProvider, org.eclipse.ui.texteditor.IDocumentProviderExtension, org.eclipse.ui.texteditor.IDocumentProviderExtension2, org.eclipse.ui.texteditor.IDocumentProviderExtension3, org.eclipse.ui.texteditor.IDocumentProviderExtension4, org.eclipse.ui.texteditor.IDocumentProviderExtension5

public class StreamContentDocumentProvider
extends org.eclipse.ui.texteditor.AbstractDocumentProvider

Author:
Michael Clay - Initial contribution and API

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.ui.texteditor.AbstractDocumentProvider
org.eclipse.ui.texteditor.AbstractDocumentProvider.DocumentProviderOperation, org.eclipse.ui.texteditor.AbstractDocumentProvider.ElementInfo
 
Field Summary
protected  com.google.inject.Provider<org.eclipse.jface.text.IDocumentPartitioner> documentPartitioner
           
protected  com.google.inject.Provider<XtextDocument> documentProvider
           
 
Fields inherited from class org.eclipse.ui.texteditor.AbstractDocumentProvider
PR10806_UC5_ENABLED, PR14469_ENABLED, STATUS_ERROR, STATUS_OK
 
Constructor Summary
StreamContentDocumentProvider()
           
 
Method Summary
protected  org.eclipse.jface.text.source.IAnnotationModel createAnnotationModel(java.lang.Object element)
          Creates an annotation model for the given element.
protected  org.eclipse.jface.text.IDocument createDocument(java.lang.Object element)
          Creates the document for the given element.
protected  XtextDocument createEmptyDocument()
           
protected  XtextResource createResource(java.lang.Object element)
           
protected  void disposeElementInfo(java.lang.Object element, org.eclipse.ui.texteditor.AbstractDocumentProvider.ElementInfo info)
          Disposes of the given element info object.
protected  void doSaveDocument(org.eclipse.core.runtime.IProgressMonitor monitor, java.lang.Object element, org.eclipse.jface.text.IDocument document, boolean overwrite)
          Performs the actual work of saving the given document provided for the given element.
protected  java.lang.String getEncoding(java.lang.Object element)
           
protected  org.eclipse.jface.operation.IRunnableContext getOperationRunner(org.eclipse.core.runtime.IProgressMonitor monitor)
          Returns the runnable context for this document provider.
protected  java.lang.String getString(java.lang.Object input)
           
protected  void loadResource(java.lang.Object element, org.eclipse.emf.ecore.resource.Resource resource)
           
protected  java.lang.String readString(java.io.InputStream inputStream, java.lang.String encoding)
           
protected  java.lang.String readString(org.eclipse.compare.IStreamContentAccessor streamContentAccessor)
           
protected  void setupDocument(java.lang.Object element, org.eclipse.jface.text.IDocument document)
           
 
Methods inherited from class org.eclipse.ui.texteditor.AbstractDocumentProvider
aboutToChange, addElementStateListener, addUnchangedElementListeners, canSaveDocument, changed, connect, connected, createElementInfo, disconnect, disconnected, doResetDocument, doSynchronize, doUpdateStateCache, doValidateState, executeOperation, fireElementContentAboutToBeReplaced, fireElementContentReplaced, fireElementDeleted, fireElementDirtyStateChanged, fireElementMoved, fireElementStateChangeFailed, fireElementStateChanging, fireElementStateValidationChanged, getAnnotationModel, getConnectedElements, getContentType, getDocument, getElementInfo, getModificationStamp, getProgressMonitor, getResetRule, getSaveRule, getStatus, getSynchronizationStamp, getSynchronizeRule, getValidateStateRule, invalidatesState, isDeleted, isModifiable, isNotSynchronizedException, isReadOnly, isStateValidated, isSynchronized, mustSaveDocument, removeElementStateListener, removeUnchangedElementListeners, resetDocument, saveDocument, setCanSaveDocument, setProgressMonitor, synchronize, updateStateCache, validateState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

documentProvider

@Inject
protected com.google.inject.Provider<XtextDocument> documentProvider

documentPartitioner

@Inject
protected com.google.inject.Provider<org.eclipse.jface.text.IDocumentPartitioner> documentPartitioner
Constructor Detail

StreamContentDocumentProvider

public StreamContentDocumentProvider()
Method Detail

createEmptyDocument

protected XtextDocument createEmptyDocument()

createDocument

protected org.eclipse.jface.text.IDocument createDocument(java.lang.Object element)
                                                   throws org.eclipse.core.runtime.CoreException
Description copied from class: org.eclipse.ui.texteditor.AbstractDocumentProvider
Creates the document for the given element.

Subclasses must implement this method.

Specified by:
createDocument in class org.eclipse.ui.texteditor.AbstractDocumentProvider
Parameters:
element - the element
Returns:
the document
Throws:
org.eclipse.core.runtime.CoreException - if the document could not be created

setupDocument

protected void setupDocument(java.lang.Object element,
                             org.eclipse.jface.text.IDocument document)

createResource

protected XtextResource createResource(java.lang.Object element)

loadResource

protected void loadResource(java.lang.Object element,
                            org.eclipse.emf.ecore.resource.Resource resource)

createAnnotationModel

protected org.eclipse.jface.text.source.IAnnotationModel createAnnotationModel(java.lang.Object element)
                                                                        throws org.eclipse.core.runtime.CoreException
Description copied from class: org.eclipse.ui.texteditor.AbstractDocumentProvider
Creates an annotation model for the given element.

Subclasses must implement this method.

Specified by:
createAnnotationModel in class org.eclipse.ui.texteditor.AbstractDocumentProvider
Parameters:
element - the element
Returns:
the annotation model or null if none
Throws:
org.eclipse.core.runtime.CoreException - if the annotation model could not be created

doSaveDocument

protected void doSaveDocument(org.eclipse.core.runtime.IProgressMonitor monitor,
                              java.lang.Object element,
                              org.eclipse.jface.text.IDocument document,
                              boolean overwrite)
                       throws org.eclipse.core.runtime.CoreException
Description copied from class: org.eclipse.ui.texteditor.AbstractDocumentProvider
Performs the actual work of saving the given document provided for the given element.

Subclasses must implement this method.

Specified by:
doSaveDocument in class org.eclipse.ui.texteditor.AbstractDocumentProvider
Parameters:
monitor - a progress monitor to report progress and request cancelation
element - the element
document - the document
overwrite - indicates whether an overwrite should happen if necessary
Throws:
org.eclipse.core.runtime.CoreException - if document could not be stored to the given element

getOperationRunner

protected org.eclipse.jface.operation.IRunnableContext getOperationRunner(org.eclipse.core.runtime.IProgressMonitor monitor)
Description copied from class: org.eclipse.ui.texteditor.AbstractDocumentProvider
Returns the runnable context for this document provider.

Specified by:
getOperationRunner in class org.eclipse.ui.texteditor.AbstractDocumentProvider
Parameters:
monitor - a progress monitor to track the operation
Returns:
the runnable context for this document provider

disposeElementInfo

protected void disposeElementInfo(java.lang.Object element,
                                  org.eclipse.ui.texteditor.AbstractDocumentProvider.ElementInfo info)
Description copied from class: org.eclipse.ui.texteditor.AbstractDocumentProvider
Disposes of the given element info object.

This method is called when an element info is disposed. The AbstractDocumentProvider implementation of this method does nothing. Subclasses may reimplement.

Overrides:
disposeElementInfo in class org.eclipse.ui.texteditor.AbstractDocumentProvider
Parameters:
element - the element
info - the element info object

getEncoding

protected java.lang.String getEncoding(java.lang.Object element)

getString

protected java.lang.String getString(java.lang.Object input)

readString

protected java.lang.String readString(org.eclipse.compare.IStreamContentAccessor streamContentAccessor)
                               throws org.eclipse.core.runtime.CoreException
Throws:
org.eclipse.core.runtime.CoreException

readString

protected java.lang.String readString(java.io.InputStream inputStream,
                                      java.lang.String encoding)