Package org.eclipse.xtext.resource
Class DerivedStateAwareResource
- java.lang.Object
-
- org.eclipse.emf.common.notify.impl.BasicNotifierImpl
-
- org.eclipse.emf.common.notify.impl.NotifierImpl
-
- org.eclipse.emf.ecore.resource.impl.ResourceImpl
-
- org.eclipse.xtext.resource.XtextResource
-
- org.eclipse.xtext.linking.lazy.LazyLinkingResource
-
- org.eclipse.xtext.resource.persistence.StorageAwareResource
-
- org.eclipse.xtext.resource.DerivedStateAwareResource
-
- 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:
GrammarResource
public class DerivedStateAwareResource extends StorageAwareResource
Adds a hook for late initialization to be used to create derived state.- Since:
- 2.1
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.xtext.linking.lazy.LazyLinkingResource
LazyLinkingResource.CyclicLinkingException, LazyLinkingResource.DiagnosticMessageContext
-
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>, org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EObservableAdapterList, org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EScannableAdapterList
-
Nested classes/interfaces inherited from interface org.eclipse.emf.ecore.resource.Resource
org.eclipse.emf.ecore.resource.Resource.Diagnostic, org.eclipse.emf.ecore.resource.Resource.Factory, org.eclipse.emf.ecore.resource.Resource.Internal, org.eclipse.emf.ecore.resource.Resource.IOWrappedException
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
fullyInitialized
Iftrue
, the contents list of the resource is complete.protected boolean
isInitializing
-
Fields inherited from class org.eclipse.xtext.resource.persistence.StorageAwareResource
UNRESOLVABLE_FRAGMENT
-
Fields inherited from class org.eclipse.xtext.linking.lazy.LazyLinkingResource
CYCLIC_LINKING_DECTECTION_COUNTER_LIMIT, cyclicLinkingDectectionCounterLimit, resolving, UNRESOLVEABLE_PROXIES_KEY
-
Fields inherited from class org.eclipse.xtext.resource.XtextResource
isUpdating, operationCanceledManager, OPTION_ENCODING, OPTION_FORMAT, OPTION_RESOLVE_ALL, OPTION_SERIALIZATION_OPTIONS
-
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
-
Fields inherited from interface org.eclipse.emf.ecore.resource.Resource
OPTION_CIPHER, OPTION_LINE_DELIMITER, OPTION_LINE_DELIMITER_UNSPECIFIED, OPTION_SAVE_ONLY_IF_CHANGED, OPTION_SAVE_ONLY_IF_CHANGED_FILE_BUFFER, OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER, OPTION_ZIP, RESOURCE__CONTENTS, RESOURCE__ERRORS, RESOURCE__IS_LOADED, RESOURCE__IS_MODIFIED, RESOURCE__IS_TRACKING_MODIFICATION, RESOURCE__RESOURCE_SET, RESOURCE__TIME_STAMP, RESOURCE__URI, RESOURCE__WARNINGS
-
-
Constructor Summary
Constructors Constructor Description DerivedStateAwareResource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
clearInternalState()
void
discardDerivedState()
protected void
doDiscardDerivedState()
protected org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EObject>
doGetContents()
protected void
doUnload()
Copied fromResourceImpl.doUnload()
but doesn't callgetContents()
to avoid derived state computation.org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EObject>
getContents()
protected org.eclipse.emf.ecore.EObject
getEObjectForURIFragmentRootSegment(java.lang.String uriFragmentRootSegment)
protected java.util.List<org.eclipse.emf.ecore.EObject>
getUnloadingContents()
protected java.lang.String
getURIFragmentRootSegment(org.eclipse.emf.ecore.EObject eObject)
void
installDerivedState(boolean preIndexingPhase)
boolean
isFullyInitialized()
Iftrue
, the contents list of the resource is complete.boolean
isInitializing()
void
setDerivedStateComputer(IDerivedStateComputer lateInitialization)
void
setFullyInitialized(boolean fullyInitialized)
External means to mark a resource as fully initialized, e.g.protected void
updateInternalState(IParseResult newParseResult)
Overridden to make sure that the cache is initialized duringloading
.protected void
updateInternalState(IParseResult oldParseResult, IParseResult newParseResult)
-
Methods inherited from class org.eclipse.xtext.resource.persistence.StorageAwareResource
getEObject, getPortableURIs, getResourceDescription, getResourceStorageFacade, getUnresolvableURIFragments, isLoadedFromStorage, load, loadFromStorage, setIsLoadedFromStorage, setResourceDescription
-
Methods inherited from class org.eclipse.xtext.linking.lazy.LazyLinkingResource
addLazyProxyInformation, clearLazyProxyInformation, createAndAddDiagnostic, createAndAddDiagnostic, createDiagnostic, createDiagnosticMessage, createDiagnosticMessageContext, doLinking, doLoad, doResolveLazyCrossReference, getDiagnosticList, getDiagnosticMessageProvider, getEncoder, getEObject, getLazyProxyInformation, getLazyProxyInformation, getLinkingHelper, getLinkingService, getReferences, handleCyclicResolution, hasLazyProxyInformation, isEagerLinking, isPotentialLazyCrossReference, isUnresolveableProxyCacheable, markUnresolvable, removeDiagnostic, removeLazyProxyInformation, resolveLazyCrossReference, resolveLazyCrossReferences, setDiagnosticMessageProvider, setEagerLinking, setEncoder, setLinkingHelper, setLinkingService
-
Methods inherited from class org.eclipse.xtext.resource.XtextResource
addSyntaxDiagnostic, addSyntaxErrors, basicGetEObject, clearCache, clearErrorsAndWarnings, createReader, doSave, getCache, getConcreteSyntaxValidator, getEncoding, getEntryPoint, getFragmentProvider, getLanguageName, getLinker, getModificationStamp, getParser, getParseResult, getResourceServiceProvider, getSerializer, getUnloader, getURIFragment, isValidationDisabled, reattachModificationTracker, relink, reparse, setCache, setEncodingFromOptions, setEntryPoint, setFragmentProvider, setInjectedParser, setLanguageName, setLinker, setModificationStamp, setParser, setParseResult, setResourceServiceProvider, setSerializer, setUnloader, setValidationDisabled, unload, update, validateConcreteSyntax
-
Methods inherited from class org.eclipse.emf.ecore.resource.impl.ResourceImpl
addModificationTrackingAdapters, attached, attachedHelper, basicSetResourceSet, createModificationTrackingAdapter, delete, detached, detachedHelper, getAllContents, getAllProperContents, getAllProperContents, getDefaultURIConverter, getEObject, getEObjectByID, getErrors, getIDForEObject, getIntrinsicIDToEObjectMap, getResourceSet, getTimeStamp, getURI, getURIConverter, getWarnings, handleLoadResponse, handleSaveResponse, isAttachedDetachedHelperRequired, isContentZipEntry, isLoaded, isLoading, isModified, isTrackingModification, load, mergeMaps, newContentZipEntry, removeModificationTrackingAdapters, save, save, saveOnlyIfChangedWithFileBuffer, saveOnlyIfChangedWithMemoryBuffer, setIntrinsicIDToEObjectMap, setLoaded, setModified, setTimeStamp, setTrackingModification, setURI, supportIDRelativeURIFragmentPaths, 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
-
-
-
-
Method Detail
-
setDerivedStateComputer
public void setDerivedStateComputer(IDerivedStateComputer lateInitialization)
-
isFullyInitialized
public boolean isFullyInitialized()
Iftrue
, the contents list of the resource is complete. Does not necessarily apply to the contents of the elements itself.- Since:
- 2.7
-
setFullyInitialized
public void setFullyInitialized(boolean fullyInitialized)
External means to mark a resource as fully initialized, e.g. if it was created programmatically.- Since:
- 2.8
-
isInitializing
public boolean isInitializing()
- Since:
- 2.7
-
getContents
public org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EObject> getContents()
As soon as an external client tries to access the content of the resource, the
derived state
will be added to the content of this resource.- Specified by:
getContents
in interfaceorg.eclipse.emf.ecore.resource.Resource
- Overrides:
getContents
in classorg.eclipse.emf.ecore.resource.impl.ResourceImpl
-
doGetContents
protected org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EObject> doGetContents()
- Returns:
- the contents without the side effect of installing the derived the state.
- Since:
- 2.4
-
getUnloadingContents
protected java.util.List<org.eclipse.emf.ecore.EObject> getUnloadingContents()
- Overrides:
getUnloadingContents
in classorg.eclipse.emf.ecore.resource.impl.ResourceImpl
- Since:
- 2.8
-
doUnload
protected void doUnload()
Copied fromResourceImpl.doUnload()
but doesn't callgetContents()
to avoid derived state computation.- Overrides:
doUnload
in classStorageAwareResource
- Since:
- 2.8
-
clearInternalState
protected void clearInternalState()
- Overrides:
clearInternalState
in classStorageAwareResource
- Since:
- 2.4
-
updateInternalState
protected void updateInternalState(IParseResult oldParseResult, IParseResult newParseResult)
- Overrides:
updateInternalState
in classXtextResource
- 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
-
updateInternalState
protected void updateInternalState(IParseResult newParseResult)
Overridden to make sure that the cache is initialized duringloading
.- Overrides:
updateInternalState
in classXtextResource
-
getURIFragmentRootSegment
protected java.lang.String getURIFragmentRootSegment(org.eclipse.emf.ecore.EObject eObject)
Overridden to make sure that we do not initialize a resource just to compute the root URI fragment for the parse result.
- Overrides:
getURIFragmentRootSegment
in classorg.eclipse.emf.ecore.resource.impl.ResourceImpl
-
getEObjectForURIFragmentRootSegment
protected org.eclipse.emf.ecore.EObject getEObjectForURIFragmentRootSegment(java.lang.String uriFragmentRootSegment)
Not specialized because we want to obtain a fully working root instance when the resource is queried with the root fragment.
- Overrides:
getEObjectForURIFragmentRootSegment
in classorg.eclipse.emf.ecore.resource.impl.ResourceImpl
-
discardDerivedState
public void discardDerivedState()
-
installDerivedState
public void installDerivedState(boolean preIndexingPhase)
-
doDiscardDerivedState
protected void doDiscardDerivedState()
- Since:
- 2.9
-
-