org.eclipse.xtext.resource
Class XtextResource

java.lang.Object
  extended by org.eclipse.emf.common.notify.impl.BasicNotifierImpl
      extended by org.eclipse.emf.common.notify.impl.NotifierImpl
          extended by org.eclipse.emf.ecore.resource.impl.ResourceImpl
              extended by org.eclipse.xtext.resource.XtextResource
All Implemented Interfaces:
org.eclipse.emf.common.notify.Notifier, org.eclipse.emf.ecore.resource.Resource, org.eclipse.emf.ecore.resource.Resource.Internal
Direct Known Subclasses:
LazyLinkingResource

public class XtextResource
extends org.eclipse.emf.ecore.resource.impl.ResourceImpl

An EMF resource that reads and writes models of an Xtext DSL.

Author:
Jan Köhnlein, Heiko Behrens, Dennis Hübner, Moritz Eysholdt, Sebastian Zarnekow, Sven Efftinge

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.emf.ecore.resource.impl.ResourceImpl
org.eclipse.emf.ecore.resource.impl.ResourceImpl.ContentsEList<E extends java.lang.Object & org.eclipse.emf.ecore.EObject>, org.eclipse.emf.ecore.resource.impl.ResourceImpl.ModificationTrackingAdapter
 
Nested classes/interfaces inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl
org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EAdapterList<E extends java.lang.Object & org.eclipse.emf.common.notify.Adapter>
 
Field Summary
protected  boolean isUpdating
           
static java.lang.String OPTION_ENCODING
           
static java.lang.String OPTION_FORMAT
          Deprecated. use SaveOptions.addTo(Map) instead.
static java.lang.String OPTION_RESOLVE_ALL
           
static java.lang.String OPTION_SERIALIZATION_OPTIONS
          Deprecated. use SaveOptions.addTo(Map) instead.
 
Fields inherited from class org.eclipse.emf.ecore.resource.impl.ResourceImpl
contents, defaultDeleteOptions, defaultLoadOptions, defaultSaveOptions, errors, intrinsicIDToEObjectMap, isLoaded, isLoading, isModified, modificationTrackingAdapter, resourceSet, timeStamp, unloadingContents, uri, warnings
 
Fields inherited from class org.eclipse.emf.common.notify.impl.NotifierImpl
eAdapters, EDELIVER, eFlags, ELAST_NOTIFIER_FLAG
 
Constructor Summary
XtextResource()
           
XtextResource(org.eclipse.emf.common.util.URI uri)
           
 
Method Summary
protected  void addSyntaxErrors()
           
protected  void clearErrorsAndWarnings()
           
protected  void clearInternalState()
           
protected  void doLinking()
           
protected  void doLoad(java.io.InputStream inputStream, java.util.Map<?,?> options)
           
 void doSave(java.io.OutputStream outputStream, java.util.Map<?,?> options)
           
protected  void doUnload()
           
 IResourceScopeCache getCache()
           
 IConcreteSyntaxValidator getConcreteSyntaxValidator()
           
 java.lang.String getEncoding()
           
 org.eclipse.emf.ecore.EObject getEObject(java.lang.String uriFragment)
           
 IFragmentProvider getFragmentProvider()
           
 java.lang.String getLanguageName()
           
 ILinker getLinker()
           
 IParser getParser()
           
 IParseResult getParseResult()
           
 IResourceServiceProvider getResourceServiceProvider()
           
 ISerializer getSerializer()
           
 IReferableElementsUnloader getUnloader()
           
 java.lang.String getURIFragment(org.eclipse.emf.ecore.EObject object)
           
 boolean isValidationDisabled()
           
protected  void reattachModificationTracker(org.eclipse.emf.ecore.EObject element)
           
 void reparse(java.lang.String newContent)
           
 void setCache(IResourceScopeCache cache)
           
protected  void setEncodingFromOptions(java.util.Map<?,?> options)
           
 void setFragmentProvider(IFragmentProvider fragmentProvider)
           
protected  void setInjectedParser(IParser parser)
           
 void setLanguageName(java.lang.String languageName)
           
 void setLinker(ILinker linker)
           
 void setParser(IParser parser)
           
 void setParseResult(IParseResult parseResult)
           
 void setResourceServiceProvider(IResourceServiceProvider resourceServiceProvider)
           
 void setSerializer(ISerializer serializer)
           
 void setUnloader(IReferableElementsUnloader unloader)
           
 void setValidationDisabled(boolean validationDisabled)
           
protected  void unload(org.eclipse.emf.ecore.EObject oldRootObject)
           
 void update(int offset, int replacedTextLength, java.lang.String newText)
           
protected  void updateInternalState(IParseResult newParseResult)
           
protected  void updateInternalState(IParseResult oldParseResult, IParseResult newParseResult)
           
 java.util.List<org.eclipse.emf.common.util.Diagnostic> validateConcreteSyntax()
           
 
Methods inherited from class org.eclipse.emf.ecore.resource.impl.ResourceImpl
addModificationTrackingAdapters, attached, attachedHelper, basicSetResourceSet, createModificationTrackingAdapter, delete, detached, detachedHelper, getAllContents, getAllProperContents, getAllProperContents, getContents, getDefaultURIConverter, getEObject, getEObjectByID, getEObjectForURIFragmentRootSegment, getErrors, getIntrinsicIDToEObjectMap, getResourceSet, getTimeStamp, getURI, getURIConverter, getURIFragmentRootSegment, getWarnings, isAttachedDetachedHelperRequired, isContentZipEntry, isLoaded, isLoading, isModified, isTrackingModification, load, load, mergeMaps, newContentZipEntry, removeModificationTrackingAdapters, save, save, saveOnlyIfChangedWithFileBuffer, saveOnlyIfChangedWithMemoryBuffer, setIntrinsicIDToEObjectMap, setLoaded, setModified, setTimeStamp, setTrackingModification, setURI, toKeyString, toString, unload, unloaded, useZip
 
Methods inherited from class org.eclipse.emf.common.notify.impl.NotifierImpl
eAdapters, eBasicAdapters, eDeliver, eSetDeliver
 
Methods inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl
eBasicAdapterArray, eBasicHasAdapters, eNotificationRequired, eNotify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OPTION_RESOLVE_ALL

public static final java.lang.String OPTION_RESOLVE_ALL

OPTION_FORMAT

@Deprecated
public static final java.lang.String OPTION_FORMAT
Deprecated. use SaveOptions.addTo(Map) instead.

OPTION_SERIALIZATION_OPTIONS

@Deprecated
public static final java.lang.String OPTION_SERIALIZATION_OPTIONS
Deprecated. use SaveOptions.addTo(Map) instead.

OPTION_ENCODING

public static final java.lang.String OPTION_ENCODING

isUpdating

protected volatile boolean isUpdating
Since:
2.1
Constructor Detail

XtextResource

public XtextResource(org.eclipse.emf.common.util.URI uri)

XtextResource

public XtextResource()
Method Detail

getResourceServiceProvider

public IResourceServiceProvider getResourceServiceProvider()

setResourceServiceProvider

public void setResourceServiceProvider(IResourceServiceProvider resourceServiceProvider)

setInjectedParser

@Inject
protected void setInjectedParser(IParser parser)

getParseResult

@Nullable
public IParseResult getParseResult()

doLoad

protected void doLoad(java.io.InputStream inputStream,
                      java.util.Map<?,?> options)
               throws java.io.IOException
Overrides:
doLoad in class org.eclipse.emf.ecore.resource.impl.ResourceImpl
Throws:
java.io.IOException

setEncodingFromOptions

protected void setEncodingFromOptions(java.util.Map<?,?> options)

getEncoding

public java.lang.String getEncoding()

reparse

public void reparse(java.lang.String newContent)
             throws java.io.IOException
Throws:
java.io.IOException

reattachModificationTracker

protected void reattachModificationTracker(org.eclipse.emf.ecore.EObject element)

doUnload

protected void doUnload()
Overrides:
doUnload in class org.eclipse.emf.ecore.resource.impl.ResourceImpl

update

public void update(int offset,
                   int replacedTextLength,
                   java.lang.String newText)

updateInternalState

protected void updateInternalState(IParseResult oldParseResult,
                                   IParseResult newParseResult)
Parameters:
oldParseResult - the previous parse result that should be detached if necessary.
newParseResult - the current parse result that should be attached to the content of this resource
Since:
2.1

updateInternalState

protected void updateInternalState(IParseResult newParseResult)

clearErrorsAndWarnings

protected void clearErrorsAndWarnings()

addSyntaxErrors

protected void addSyntaxErrors()

unload

protected void unload(org.eclipse.emf.ecore.EObject oldRootObject)

clearInternalState

protected void clearInternalState()

doLinking

protected void doLinking()

getEObject

public org.eclipse.emf.ecore.EObject getEObject(java.lang.String uriFragment)
Specified by:
getEObject in interface org.eclipse.emf.ecore.resource.Resource
Overrides:
getEObject in class org.eclipse.emf.ecore.resource.impl.ResourceImpl

getURIFragment

public java.lang.String getURIFragment(org.eclipse.emf.ecore.EObject object)
Specified by:
getURIFragment in interface org.eclipse.emf.ecore.resource.Resource
Overrides:
getURIFragment in class org.eclipse.emf.ecore.resource.impl.ResourceImpl

doSave

public void doSave(java.io.OutputStream outputStream,
                   java.util.Map<?,?> options)
            throws java.io.IOException
Overrides:
doSave in class org.eclipse.emf.ecore.resource.impl.ResourceImpl
Throws:
java.io.IOException

getParser

public IParser getParser()

setParser

public void setParser(IParser parser)

getConcreteSyntaxValidator

public IConcreteSyntaxValidator getConcreteSyntaxValidator()

validateConcreteSyntax

public java.util.List<org.eclipse.emf.common.util.Diagnostic> validateConcreteSyntax()

getLinker

public ILinker getLinker()

setLinker

public void setLinker(ILinker linker)

getFragmentProvider

public IFragmentProvider getFragmentProvider()

setFragmentProvider

public void setFragmentProvider(IFragmentProvider fragmentProvider)

getSerializer

public ISerializer getSerializer()

setSerializer

public void setSerializer(ISerializer serializer)

setParseResult

public void setParseResult(IParseResult parseResult)

isValidationDisabled

public boolean isValidationDisabled()

setValidationDisabled

public void setValidationDisabled(boolean validationDisabled)

setUnloader

public void setUnloader(IReferableElementsUnloader unloader)

getUnloader

public IReferableElementsUnloader getUnloader()

getCache

public IResourceScopeCache getCache()

setCache

public void setCache(IResourceScopeCache cache)

getLanguageName

public java.lang.String getLanguageName()

setLanguageName

public void setLanguageName(java.lang.String languageName)
Since:
2.3