Package org.eclipse.xtext.linking.lazy
Class LazyLinkingResource
- 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
-
- 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:
StorageAwareResource
public class LazyLinkingResource extends XtextResource
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LazyLinkingResource.CyclicLinkingException
protected static class
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 static java.lang.String
CYCLIC_LINKING_DECTECTION_COUNTER_LIMIT
Determines the limit that is used to switch from a counter to a set to detect cyclic linking.protected int
cyclicLinkingDectectionCounterLimit
protected java.util.LinkedHashSet<org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode>>
resolving
static java.lang.String
UNRESOLVEABLE_PROXIES_KEY
The cache key for a Set of uri fragments that cannot be resolved.-
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 LazyLinkingResource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
addLazyProxyInformation(org.eclipse.emf.ecore.EObject obj, org.eclipse.emf.ecore.EReference ref, INode node)
void
clearLazyProxyInformation()
protected void
createAndAddDiagnostic(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode> triple)
protected void
createAndAddDiagnostic(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode> triple, IllegalNodeException ex)
protected org.eclipse.emf.ecore.resource.Resource.Diagnostic
createDiagnostic(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode> triple, DiagnosticMessage message)
protected DiagnosticMessage
createDiagnosticMessage(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode> triple)
protected ILinkingDiagnosticMessageProvider.ILinkingDiagnosticContext
createDiagnosticMessageContext(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode> triple)
protected void
doLinking()
protected void
doLoad(java.io.InputStream inputStream, java.util.Map<?,?> options)
protected void
doResolveLazyCrossReference(org.eclipse.emf.ecore.InternalEObject source, org.eclipse.emf.ecore.EStructuralFeature crossRef)
Ensures that all the lazy proxy values that are referenced bycrossRef
are replaced by non-lazy proxies or resolved instances.protected java.util.List<org.eclipse.emf.ecore.resource.Resource.Diagnostic>
getDiagnosticList(DiagnosticMessage message)
ILinkingDiagnosticMessageProvider
getDiagnosticMessageProvider()
LazyURIEncoder
getEncoder()
org.eclipse.emf.ecore.EObject
getEObject(java.lang.String uriFragment)
protected org.eclipse.emf.ecore.EObject
getEObject(java.lang.String uriFragment, org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode> triple)
protected java.util.List<org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode>>
getLazyProxyInformation()
Returns the list of installed lazy linking proxies encoded as aTriple
of the owning object, the reference and the node that holds the raw text for the link.org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode>
getLazyProxyInformation(int idx)
LinkingHelper
getLinkingHelper()
ILinkingService
getLinkingService()
protected java.lang.String
getReferences(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode> triple, java.util.LinkedHashSet<org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode>> resolving2)
protected java.util.Set<java.lang.String>
getUnresolvableURIFragments()
protected org.eclipse.emf.ecore.EObject
handleCyclicResolution(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode> triple)
boolean
hasLazyProxyInformation(int idx)
boolean
isEagerLinking()
protected boolean
isPotentialLazyCrossReference(org.eclipse.emf.ecore.EStructuralFeature feature)
Returntrue
if the given feature may hold a proxy that has to be resolved.protected boolean
isUnresolveableProxyCacheable(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode> triple)
void
markUnresolvable(org.eclipse.emf.ecore.EObject referenced)
Marks the given proxy as unresolvable.protected void
removeDiagnostic(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode> triple)
org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode>
removeLazyProxyInformation(int idx)
protected void
resolveLazyCrossReference(org.eclipse.emf.ecore.InternalEObject source, org.eclipse.emf.ecore.EStructuralFeature crossRef)
If the givencrossRef
may hold lazy linking proxies, they are attempted to be resolved.void
resolveLazyCrossReferences(org.eclipse.xtext.util.CancelIndicator mon)
resolves any lazy cross references in this resource, adding Issues for unresolvable elements to this resource.void
setDiagnosticMessageProvider(ILinkingDiagnosticMessageProvider diagnosticMessageProvider)
void
setEagerLinking(boolean eagerLinking)
void
setEncoder(LazyURIEncoder encoder)
void
setLinkingHelper(LinkingHelper linkingHelper)
void
setLinkingService(ILinkingService linkingService)
-
Methods inherited from class org.eclipse.xtext.resource.XtextResource
addSyntaxDiagnostic, addSyntaxErrors, basicGetEObject, clearCache, clearErrorsAndWarnings, clearInternalState, createReader, doSave, doUnload, 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, updateInternalState, updateInternalState, 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, getIDForEObject, getIntrinsicIDToEObjectMap, getResourceSet, getTimeStamp, getUnloadingContents, getURI, getURIConverter, getURIFragmentRootSegment, getWarnings, handleLoadResponse, handleSaveResponse, isAttachedDetachedHelperRequired, isContentZipEntry, isLoaded, isLoading, isModified, isTrackingModification, load, 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
-
-
-
-
Field Detail
-
UNRESOLVEABLE_PROXIES_KEY
public static final java.lang.String UNRESOLVEABLE_PROXIES_KEY
The cache key for a Set of uri fragments that cannot be resolved.- Since:
- 2.4
- See Also:
- Constant Field Values
-
CYCLIC_LINKING_DECTECTION_COUNTER_LIMIT
public static final java.lang.String CYCLIC_LINKING_DECTECTION_COUNTER_LIMIT
Determines the limit that is used to switch from a counter to a set to detect cyclic linking.- Since:
- 2.16
- See Also:
- Constant Field Values
-
cyclicLinkingDectectionCounterLimit
@Named("CYCLIC_LINKING_DECTECTION_COUNTER_LIMIT") @Inject(optional=true) protected int cyclicLinkingDectectionCounterLimit
-
resolving
protected java.util.LinkedHashSet<org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode>> resolving
- Since:
- 2.4
-
-
Method Detail
-
doLoad
protected void doLoad(java.io.InputStream inputStream, java.util.Map<?,?> options) throws java.io.IOException
- Overrides:
doLoad
in classXtextResource
- Throws:
java.io.IOException
-
doLinking
protected void doLinking()
- Overrides:
doLinking
in classXtextResource
-
resolveLazyCrossReferences
public void resolveLazyCrossReferences(org.eclipse.xtext.util.CancelIndicator mon)
resolves any lazy cross references in this resource, adding Issues for unresolvable elements to this resource. This resource might still contain resolvable proxies after this method has been called.- Parameters:
mon
- aCancelIndicator
can be used to stop the resolution.
-
resolveLazyCrossReference
protected void resolveLazyCrossReference(org.eclipse.emf.ecore.InternalEObject source, org.eclipse.emf.ecore.EStructuralFeature crossRef)
If the givencrossRef
may hold lazy linking proxies, they are attempted to be resolved.
-
doResolveLazyCrossReference
protected void doResolveLazyCrossReference(org.eclipse.emf.ecore.InternalEObject source, org.eclipse.emf.ecore.EStructuralFeature crossRef)
Ensures that all the lazy proxy values that are referenced bycrossRef
are replaced by non-lazy proxies or resolved instances.- Since:
- 2.4
-
isPotentialLazyCrossReference
protected boolean isPotentialLazyCrossReference(org.eclipse.emf.ecore.EStructuralFeature feature)
Returntrue
if the given feature may hold a proxy that has to be resolved. This is supposed to be an internal hook which allows to resolve proxies even in cases where EMF prohibits proxies, e.g. in case of opposite references.- Since:
- 2.4
-
getEObject
public org.eclipse.emf.ecore.EObject getEObject(java.lang.String uriFragment)
- Specified by:
getEObject
in interfaceorg.eclipse.emf.ecore.resource.Resource
- Overrides:
getEObject
in classXtextResource
-
getEObject
protected org.eclipse.emf.ecore.EObject getEObject(java.lang.String uriFragment, org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode> triple) throws java.lang.AssertionError
- Throws:
java.lang.AssertionError
- Since:
- 2.4
-
isUnresolveableProxyCacheable
protected boolean isUnresolveableProxyCacheable(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode> triple)
- Since:
- 2.1
-
handleCyclicResolution
protected org.eclipse.emf.ecore.EObject handleCyclicResolution(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode> triple) throws java.lang.AssertionError
- Throws:
java.lang.AssertionError
-
getReferences
protected java.lang.String getReferences(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode> triple, java.util.LinkedHashSet<org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode>> resolving2)
-
createAndAddDiagnostic
protected void createAndAddDiagnostic(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode> triple)
-
createAndAddDiagnostic
protected void createAndAddDiagnostic(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode> triple, IllegalNodeException ex)
- Since:
- 2.3
-
removeDiagnostic
protected void removeDiagnostic(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode> triple)
-
createDiagnostic
protected org.eclipse.emf.ecore.resource.Resource.Diagnostic createDiagnostic(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode> triple, DiagnosticMessage message)
-
getDiagnosticList
protected java.util.List<org.eclipse.emf.ecore.resource.Resource.Diagnostic> getDiagnosticList(DiagnosticMessage message) throws java.lang.AssertionError
- Throws:
java.lang.AssertionError
-
createDiagnosticMessage
protected DiagnosticMessage createDiagnosticMessage(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode> triple)
-
createDiagnosticMessageContext
protected ILinkingDiagnosticMessageProvider.ILinkingDiagnosticContext createDiagnosticMessageContext(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode> triple)
-
setLinkingService
public void setLinkingService(ILinkingService linkingService)
-
getLinkingService
public ILinkingService getLinkingService()
-
setEncoder
public void setEncoder(LazyURIEncoder encoder)
-
getEncoder
public LazyURIEncoder getEncoder()
-
setEagerLinking
public void setEagerLinking(boolean eagerLinking)
-
isEagerLinking
public boolean isEagerLinking()
-
getDiagnosticMessageProvider
public ILinkingDiagnosticMessageProvider getDiagnosticMessageProvider()
-
setDiagnosticMessageProvider
public void setDiagnosticMessageProvider(ILinkingDiagnosticMessageProvider diagnosticMessageProvider)
-
getLinkingHelper
public LinkingHelper getLinkingHelper()
-
setLinkingHelper
public void setLinkingHelper(LinkingHelper linkingHelper)
-
markUnresolvable
public void markUnresolvable(org.eclipse.emf.ecore.EObject referenced)
Marks the given proxy as unresolvable. Further attempts to resolve it by means ofgetEObject(String)
will yieldnull
.- Since:
- 2.4
-
getUnresolvableURIFragments
protected java.util.Set<java.lang.String> getUnresolvableURIFragments()
- Since:
- 2.4
-
getLazyProxyInformation
protected java.util.List<org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode>> getLazyProxyInformation()
Returns the list of installed lazy linking proxies encoded as aTriple
of the owning object, the reference and the node that holds the raw text for the link.- Since:
- 2.23
-
addLazyProxyInformation
public int addLazyProxyInformation(org.eclipse.emf.ecore.EObject obj, org.eclipse.emf.ecore.EReference ref, INode node)
- Since:
- 2.7
-
hasLazyProxyInformation
public boolean hasLazyProxyInformation(int idx)
- Since:
- 2.7
-
getLazyProxyInformation
public org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode> getLazyProxyInformation(int idx)
- Since:
- 2.7
-
removeLazyProxyInformation
public org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,INode> removeLazyProxyInformation(int idx)
- Since:
- 2.7
-
clearLazyProxyInformation
public void clearLazyProxyInformation()
- Since:
- 2.7
-
-