Class ProblemResource

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
tools.refinery.language.resource.ProblemResource
All Implemented Interfaces:
org.eclipse.emf.common.notify.Notifier, org.eclipse.emf.ecore.resource.Resource, org.eclipse.emf.ecore.resource.Resource.Internal

public class ProblemResource extends org.eclipse.xtext.resource.DerivedStateAwareResource
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    Our own version of LazyLinkingResource.CyclicLinkingException, because the tripe field in the original one is not accessible.
    protected static class 
    Marks all diagnostics inserted by ProblemResource with a common superclass so that they can later be removed.

    Nested classes/interfaces inherited from class org.eclipse.xtext.linking.lazy.LazyLinkingResource

    org.eclipse.xtext.linking.lazy.LazyLinkingResource.CyclicLinkingException, org.eclipse.xtext.linking.lazy.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 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 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 inherited from class org.eclipse.xtext.resource.DerivedStateAwareResource

    fullyInitialized, 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
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    addOrReplaceDiagnostic(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,org.eclipse.xtext.nodemodel.INode> triple, org.eclipse.xtext.diagnostics.DiagnosticMessage message)
    Adds a diagnostic message while maintaining the invariant that at most one ProblemResource.ProblemResourceLinkingDiagnostic is added to the ResourceImpl.getErrors() list.
    protected void
    createAndAddAmbiguousReferenceDiagnostic(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,org.eclipse.xtext.nodemodel.INode> triple)
     
    protected void
    createAndAddDiagnostic(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,org.eclipse.xtext.nodemodel.INode> triple)
     
    protected void
    createAndAddDiagnostic(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,org.eclipse.xtext.nodemodel.INode> triple, org.eclipse.xtext.linking.impl.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,org.eclipse.xtext.nodemodel.INode> triple, org.eclipse.xtext.diagnostics.DiagnosticMessage message)
     
    protected org.eclipse.emf.ecore.EObject
    getEObject(String uriFragment, org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,org.eclipse.xtext.nodemodel.INode> triple)
    Tries to resolve a reference and emits a diagnostic if the reference is unresolvable or ambiguous.
    protected org.eclipse.emf.ecore.EObject
    handleCyclicResolution(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,org.eclipse.xtext.nodemodel.INode> triple)
     
    protected void
    removeDiagnostic(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,org.eclipse.xtext.nodemodel.INode> triple)
    Removes the ProblemResource.ProblemResourceLinkingDiagnostic corresponding to the given node, if prevesent, from the ResourceImpl.getErrors() list.
    protected void
    updateInternalState(org.eclipse.xtext.parser.IParseResult oldParseResult, org.eclipse.xtext.parser.IParseResult newParseResult)
     

    Methods inherited from class org.eclipse.xtext.resource.DerivedStateAwareResource

    clearInternalState, discardDerivedState, doDiscardDerivedState, doGetContents, doUnload, getContents, getEObjectForURIFragmentRootSegment, getUnloadingContents, getURIFragmentRootSegment, installDerivedState, isFullyInitialized, isInitializing, setDerivedStateComputer, setFullyInitialized, updateInternalState

    Methods inherited from class org.eclipse.xtext.resource.persistence.StorageAwareResource

    customReadNodeModel, customWriteNodeModel, getEObject, getPortableURIs, getResourceDescription, getResourceStorageFacade, getUnresolvableURIFragments, isLoadedFromStorage, load, loadFromStorage, setIsLoadedFromStorage, setResourceDescription

    Methods inherited from class org.eclipse.xtext.linking.lazy.LazyLinkingResource

    addLazyProxyInformation, clearLazyProxyInformation, createDiagnosticMessage, createDiagnosticMessageContext, doLinking, doLoad, doResolveLazyCrossReference, getDiagnosticList, getDiagnosticMessageProvider, getEncoder, getLazyProxyInformation, getLazyProxyInformation, getLinkingHelper, getLinkingService, getReferences, hasLazyProxyInformation, isEagerLinking, isPotentialLazyCrossReference, isUnresolveableProxyCacheable, markUnresolvable, removeLazyProxyInformation, resolveLazyCrossReference, resolveLazyCrossReferences, setDiagnosticMessageProvider, setEagerLinking, setEncoder, setLinkingHelper, setLinkingService

    Methods inherited from class org.eclipse.xtext.resource.XtextResource

    addSyntaxDiagnostic, addSyntaxErrors, basicGetEObject, basicSetResourceSet, clearCache, clearErrorsAndWarnings, createReader, doSave, getCache, getConcreteSyntaxValidator, getEncoding, getEntryPoint, getFragmentProvider, getLanguageName, getLinker, getModificationStamp, getParser, getParseResult, getParseResultWrapper, getResourceServiceProvider, getSerializer, getUnloader, getURIFragment, internalGetParseResult, isValidationDisabled, reattachModificationTracker, relink, reparse, setCache, setEncodingFromOptions, setEntryPoint, setFragmentProvider, setInjectedParser, setLanguageName, setLinker, setModificationStamp, setParser, setParseResult, setResourceServiceProvider, setSerializer, setUnloader, setValidationDisabled, unload, update, validateConcreteSyntax, wrap

    Methods inherited from class org.eclipse.emf.ecore.resource.impl.ResourceImpl

    addModificationTrackingAdapters, attached, attachedHelper, 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.eclipse.emf.common.notify.Notifier

    eAdapters, eDeliver, eNotify, eSetDeliver
  • Constructor Details

    • ProblemResource

      public ProblemResource()
  • Method Details

    • updateInternalState

      protected void updateInternalState(org.eclipse.xtext.parser.IParseResult oldParseResult, org.eclipse.xtext.parser.IParseResult newParseResult)
      Overrides:
      updateInternalState in class org.eclipse.xtext.resource.DerivedStateAwareResource
    • getEObject

      protected org.eclipse.emf.ecore.EObject getEObject(String uriFragment, org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,org.eclipse.xtext.nodemodel.INode> triple) throws AssertionError
      Tries to resolve a reference and emits a diagnostic if the reference is unresolvable or ambiguous.

      This method was copied from LazyLinkingResource.getEObject(String, Triple), but we modified it to also handle ambiguous references.

      Overrides:
      getEObject in class org.eclipse.xtext.linking.lazy.LazyLinkingResource
      Parameters:
      uriFragment - The URI fragment to resolve.
      triple - The linking triple.
      Returns:
      The resolved EObject.
      Throws:
      AssertionError - If the URI fragment is unresolvable.
    • handleCyclicResolution

      protected org.eclipse.emf.ecore.EObject handleCyclicResolution(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,org.eclipse.xtext.nodemodel.INode> triple) throws AssertionError
      Overrides:
      handleCyclicResolution in class org.eclipse.xtext.linking.lazy.LazyLinkingResource
      Throws:
      AssertionError
    • createAndAddDiagnostic

      protected void createAndAddDiagnostic(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,org.eclipse.xtext.nodemodel.INode> triple)
      Overrides:
      createAndAddDiagnostic in class org.eclipse.xtext.linking.lazy.LazyLinkingResource
    • createAndAddDiagnostic

      protected void createAndAddDiagnostic(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,org.eclipse.xtext.nodemodel.INode> triple, org.eclipse.xtext.linking.impl.IllegalNodeException ex)
      Overrides:
      createAndAddDiagnostic in class org.eclipse.xtext.linking.lazy.LazyLinkingResource
    • createAndAddAmbiguousReferenceDiagnostic

      protected void createAndAddAmbiguousReferenceDiagnostic(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,org.eclipse.xtext.nodemodel.INode> triple)
    • addOrReplaceDiagnostic

      protected void addOrReplaceDiagnostic(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,org.eclipse.xtext.nodemodel.INode> triple, org.eclipse.xtext.diagnostics.DiagnosticMessage message)
      Adds a diagnostic message while maintaining the invariant that at most one ProblemResource.ProblemResourceLinkingDiagnostic is added to the ResourceImpl.getErrors() list.
      Parameters:
      triple - The triple to add the diagnostic for.
      message - The diagnostic message. Must have Severity.ERROR.
    • removeDiagnostic

      protected void removeDiagnostic(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,org.eclipse.xtext.nodemodel.INode> triple)
      Removes the ProblemResource.ProblemResourceLinkingDiagnostic corresponding to the given node, if prevesent, from the ResourceImpl.getErrors() list.
      Overrides:
      removeDiagnostic in class org.eclipse.xtext.linking.lazy.LazyLinkingResource
      Parameters:
      triple - The triple to add the diagnostic for.
    • 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,org.eclipse.xtext.nodemodel.INode> triple, org.eclipse.xtext.diagnostics.DiagnosticMessage message)
      Overrides:
      createDiagnostic in class org.eclipse.xtext.linking.lazy.LazyLinkingResource