Class BslResource

  • All Implemented Interfaces:
    org.eclipse.emf.common.notify.Notifier, org.eclipse.emf.ecore.resource.Resource, org.eclipse.emf.ecore.resource.Resource.Internal, org.eclipse.xtext.resource.IBatchLinkableResource, org.eclipse.xtext.resource.ISynchronizable<BslResource>

    public class BslResource
    extends org.eclipse.xtext.resource.DerivedStateAwareResource
    implements org.eclipse.xtext.resource.IBatchLinkableResource, org.eclipse.xtext.resource.ISynchronizable<BslResource>
    Special DerivedStateAwareResource for Bsl language
    More light creating/deleting diagnostic error message
    Special processing error for "semicolon"
    • Nested Class Summary

      • 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 
      Modifier and Type Field Description
      protected Set<org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,​org.eclipse.emf.ecore.EReference,​org.eclipse.xtext.nodemodel.INode>> resolving  
      protected Set<String> unresolving  
      • 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, 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, intrinsicIDToEObjectMap, isLoaded, isLoading, isModified, modificationTrackingAdapter, resourceSet, timeStamp, unloadingContents, uri
      • 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
      BslResource()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void acquireUpdateLock()
      Acquire read lock for update operation of resource.
      protected void addSyntaxErrors()  
      protected void clearErrorsAndWarnings()  
      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 void doLinking()  
      protected void doLoad​(InputStream inputStream, Map<?,​?> options)  
      protected void doUnload()  
      <Result> Result execute​(org.eclipse.xtext.util.concurrent.IUnitOfWork<Result,​? super BslResource> unit)  
      org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EObject> getContents()  
      protected List<org.eclipse.emf.ecore.resource.Resource.Diagnostic> getDiagnosticList​(org.eclipse.xtext.diagnostics.DiagnosticMessage message)  
      org.eclipse.emf.ecore.EObject getEObject​(String uriFragment)  
      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)
      Source code gets from LazyLinkingResource#getEObject(String uriFragment, Triple triple) for replace collection resolving to the thread safe variant
      int getLastUpdateContentShift()
      Gets difference between new added text and replace text length in update operation for module
      int getLastUpdatePosition()
      Gets offset in the module for begin of last modification
      Object getLock()  
      List<Method> getMethod​(CaseInsensitiveString name)
      Gets methods from Module by name
      Method getReparseMethod()
      Gets last reparsing method from Module
      org.eclipse.emf.ecore.EObject getSourceEObject​(String uriFragment)
      Gets EObject from resource by URI.fragment() without installing lazy proxy URI for the resource items
      protected Set<String> getUnresolvableURIFragments()  
      String getURIFragmentByContainer​(org.eclipse.emf.ecore.EObject eObject)
      Gets fragment of the uri for EObject without using IFragmentProvider
      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)  
      void installDerivedState​(boolean preIndexingPhase)  
      void installProxiesForBlock​(Block block)
      Install lazy proxy URI for all StaticFeatureAccess in Block's statements
      protected void installTypeState​(Module module, org.eclipse.xtext.util.CancelIndicator monitor)
      Install type system for BSL module
      boolean isDeepAnalysing()
      Checks that resource needs deep analyze processing.
      boolean isLinkedBatch()
      Checks that system of type, cross reference serializer and building types of contextDef was ended
      boolean isMultiThreadProcessing()
      Checks that resource processing in multi thread
      boolean isOnlyMethodReparse()
      Checks that last editting in Module corresponding only to the one Method
      void linkBatched​(org.eclipse.xtext.util.CancelIndicator monitor)  
      void releaseUpdateLock()
      Releases read lock forupdate operation of resource.
      protected void removeDiagnostic​(org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,​org.eclipse.emf.ecore.EReference,​org.eclipse.xtext.nodemodel.INode> triple)  
      void reparse​(String newContent)  
      void resolveImportedNames​(org.eclipse.xtext.util.CancelIndicator monitor)
      Resolves imported names
      boolean resolveLazyCrossReferenceMode()
      Gets actual mode of resolve lazy cross reference operation
      void resolveLazyCrossReferences​(org.eclipse.xtext.util.CancelIndicator mon)  
      void setDeepAnalysis​(boolean isDeepAnalysis)
      Sets that resource needs deep analyze.
      void setMultiThreadProcessing​(boolean multiThreadProcessing)
      Sets that resource processing in multi thread
      void setResolveLazyCrossReferenceMode​(boolean resolveLazyCrossReferences)
      Sets special check for skipping resolve lazy cross references operation and turn off/on updating handle model for this resource
      void skipCachedMethods()
      Skips all cached Methods of resource
      void update​(int offset, int replacedTextLength, String newText)  
      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, getEObjectForURIFragmentRootSegment, getUnloadingContents, getURIFragmentRootSegment, isFullyInitialized, isInitializing, setDerivedStateComputer, setFullyInitialized, updateInternalState
      • Methods inherited from class org.eclipse.xtext.resource.persistence.StorageAwareResource

        getPortableURIs, getResourceDescription, getResourceStorageFacade, isLoadedFromStorage, load, loadFromStorage, setIsLoadedFromStorage, setResourceDescription
      • Methods inherited from class org.eclipse.xtext.linking.lazy.LazyLinkingResource

        addLazyProxyInformation, clearLazyProxyInformation, createAndAddDiagnostic, createAndAddDiagnostic, createDiagnosticMessage, createDiagnosticMessageContext, doResolveLazyCrossReference, getDiagnosticMessageProvider, getEncoder, getLazyProxyInformation, getLinkingHelper, getLinkingService, getReferences, hasLazyProxyInformation, isEagerLinking, isPotentialLazyCrossReference, isUnresolveableProxyCacheable, markUnresolvable, removeLazyProxyInformation, resolveLazyCrossReference, setDiagnosticMessageProvider, setEagerLinking, setEncoder, setLinkingHelper, setLinkingService
      • Methods inherited from class org.eclipse.xtext.resource.XtextResource

        addSyntaxDiagnostic, basicGetEObject, createReader, doSave, getCache, getConcreteSyntaxValidator, getEncoding, getEntryPoint, getFragmentProvider, getLanguageName, getLinker, getModificationStamp, getParser, getParseResult, getResourceServiceProvider, getSerializer, getUnloader, getURIFragment, isValidationDisabled, reattachModificationTracker, relink, setCache, setEncodingFromOptions, setEntryPoint, setFragmentProvider, setInjectedParser, setLanguageName, setLinker, setModificationStamp, setParser, setParseResult, setResourceServiceProvider, setSerializer, setUnloader, setValidationDisabled, unload, 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
      • Methods inherited from interface org.eclipse.emf.common.notify.Notifier

        eAdapters, eDeliver, eNotify, eSetDeliver
    • Field Detail

      • resolving

        protected Set<org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,​org.eclipse.emf.ecore.EReference,​org.eclipse.xtext.nodemodel.INode>> resolving
      • unresolving

        protected Set<String> unresolving
    • Constructor Detail

      • BslResource

        public BslResource()
    • Method Detail

      • linkBatched

        public void linkBatched​(org.eclipse.xtext.util.CancelIndicator monitor)
        Specified by:
        linkBatched in interface org.eclipse.xtext.resource.IBatchLinkableResource
      • resolveImportedNames

        public void resolveImportedNames​(org.eclipse.xtext.util.CancelIndicator monitor)
        Resolves imported names
        Parameters:
        monitor - current CancelIndicator, maybe null
      • getContents

        public org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EObject> getContents()
        Specified by:
        getContents in interface org.eclipse.emf.ecore.resource.Resource
        Overrides:
        getContents in class org.eclipse.xtext.resource.DerivedStateAwareResource
      • getLock

        public Object getLock()
        Specified by:
        getLock in interface org.eclipse.xtext.resource.ISynchronizable<BslResource>
      • execute

        public <Result> Result execute​(org.eclipse.xtext.util.concurrent.IUnitOfWork<Result,​? super BslResource> unit)
                                throws Exception
        Specified by:
        execute in interface org.eclipse.xtext.resource.ISynchronizable<BslResource>
        Throws:
        Exception
      • isMultiThreadProcessing

        public boolean isMultiThreadProcessing()
        Checks that resource processing in multi thread
        Returns:
        true if resource processing in multi thread, false otherwise
      • setMultiThreadProcessing

        public void setMultiThreadProcessing​(boolean multiThreadProcessing)
        Sets that resource processing in multi thread
        Parameters:
        multiThreadProcessing - true if resource must be processed in multi thread
      • getEObject

        public org.eclipse.emf.ecore.EObject getEObject​(String uriFragment)
        Specified by:
        getEObject in interface org.eclipse.emf.ecore.resource.Resource
        Overrides:
        getEObject in class org.eclipse.xtext.resource.persistence.StorageAwareResource
      • getSourceEObject

        public org.eclipse.emf.ecore.EObject getSourceEObject​(String uriFragment)
        Gets EObject from resource by URI.fragment() without installing lazy proxy URI for the resource items
        Parameters:
        uriFragment - uri fragment URI.fragment() for getting resource EObject, cannot be null
        Returns:
        EObject corresponding to the URI fragment or null if object wasn't found
      • reparse

        public void reparse​(String newContent)
                     throws IOException
        Overrides:
        reparse in class org.eclipse.xtext.resource.XtextResource
        Throws:
        IOException
      • update

        public void update​(int offset,
                           int replacedTextLength,
                           String newText)
        Overrides:
        update in class org.eclipse.xtext.resource.XtextResource
      • getLastUpdatePosition

        public int getLastUpdatePosition()
        Gets offset in the module for begin of last modification
        Returns:
        offset in the module for begin of last modification
      • getURIFragmentByContainer

        public String getURIFragmentByContainer​(org.eclipse.emf.ecore.EObject eObject)
        Gets fragment of the uri for EObject without using IFragmentProvider
        Parameters:
        eObject - EObject for getting URI fragment, cannot be null
        Returns:
        fragment of the uri for EObject, never null
      • getLastUpdateContentShift

        public int getLastUpdateContentShift()
        Gets difference between new added text and replace text length in update operation for module
        Returns:
        difference between new added text and replace text length
      • acquireUpdateLock

        public void acquireUpdateLock()
        Acquire read lock for update operation of resource. See update(int, int, String) which protected by write lock. Use this method for getting always actual state of IParseResult of the resource Client should call releaseUpdateLock() after processing actual IParseResult will be end
      • releaseUpdateLock

        public void releaseUpdateLock()
        Releases read lock forupdate operation of resource. See acquireUpdateLock()
      • setResolveLazyCrossReferenceMode

        public void setResolveLazyCrossReferenceMode​(boolean resolveLazyCrossReferences)
        Sets special check for skipping resolve lazy cross references operation and turn off/on updating handle model for this resource
        Parameters:
        resolveLazyCrossReferences - true if opeation of resolving lazy cross references in not need and handle model should not be updated, false if resolve lazy cross references enable and handle model should be updated
      • resolveLazyCrossReferenceMode

        public boolean resolveLazyCrossReferenceMode()
        Gets actual mode of resolve lazy cross reference operation
        Returns:
        true opeation of resolving lazy cross references in not need and handle model should not be updated, false if resolve lazy cross references enable and handle model should be updated
      • resolveLazyCrossReferences

        public void resolveLazyCrossReferences​(org.eclipse.xtext.util.CancelIndicator mon)
        Overrides:
        resolveLazyCrossReferences in class org.eclipse.xtext.linking.lazy.LazyLinkingResource
      • installDerivedState

        public void installDerivedState​(boolean preIndexingPhase)
        Overrides:
        installDerivedState in class org.eclipse.xtext.resource.DerivedStateAwareResource
      • installProxiesForBlock

        public void installProxiesForBlock​(Block block)
        Install lazy proxy URI for all StaticFeatureAccess in Block's statements
        Parameters:
        block - Block for installing lazy proxies, cannot be null
      • getMethod

        public List<Method> getMethod​(CaseInsensitiveString name)
        Gets methods from Module by name
        Parameters:
        name - name of the method, can't be null
        Returns:
        list of the methods with name equals to name, can'be null if there is no methods with the name
      • isOnlyMethodReparse

        public boolean isOnlyMethodReparse()
        Checks that last editting in Module corresponding only to the one Method
        Returns:
        true if last editting in Module corresponding only to the one Method, false otherwise
      • isLinkedBatch

        public boolean isLinkedBatch()
        Checks that system of type, cross reference serializer and building types of contextDef was ended
        Returns:
        true if system of type, cross reference serializer and building types of contextDef was ended, false otherwise
      • skipCachedMethods

        public void skipCachedMethods()
        Skips all cached Methods of resource
      • isDeepAnalysing

        public boolean isDeepAnalysing()
        Checks that resource needs deep analyze processing. Deep analyzing includes full processing in Type System, computing all references description, and full validation with all check modes
        Returns:
        true if resource needs deep analyze processing, false otherwise
      • setDeepAnalysis

        public void setDeepAnalysis​(boolean isDeepAnalysis)
        Sets that resource needs deep analyze. Deep analyzing includes full processing in Type System, computing all references description, and full validation with all check modes
        Parameters:
        isDeepAnalysis - true if that resource needs deep analyze, false otherwise
      • doLinking

        protected void doLinking()
        Overrides:
        doLinking in class org.eclipse.xtext.linking.lazy.LazyLinkingResource
      • getUnresolvableURIFragments

        protected Set<String> getUnresolvableURIFragments()
        Overrides:
        getUnresolvableURIFragments in class org.eclipse.xtext.resource.persistence.StorageAwareResource
      • 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
        Source code gets from LazyLinkingResource#getEObject(String uriFragment, Triple triple) for replace collection resolving to the thread safe variant
        Overrides:
        getEObject in class org.eclipse.xtext.linking.lazy.LazyLinkingResource
        Throws:
        AssertionError
      • 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
      • installTypeState

        protected void installTypeState​(Module module,
                                        org.eclipse.xtext.util.CancelIndicator monitor)
        Install type system for BSL module
        Parameters:
        module - BSL module
      • 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
      • 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)
        Overrides:
        removeDiagnostic in class org.eclipse.xtext.linking.lazy.LazyLinkingResource
      • addSyntaxErrors

        protected void addSyntaxErrors()
        Overrides:
        addSyntaxErrors in class org.eclipse.xtext.resource.XtextResource
      • getDiagnosticList

        protected List<org.eclipse.emf.ecore.resource.Resource.Diagnostic> getDiagnosticList​(org.eclipse.xtext.diagnostics.DiagnosticMessage message)
                                                                                      throws AssertionError
        Overrides:
        getDiagnosticList in class org.eclipse.xtext.linking.lazy.LazyLinkingResource
        Throws:
        AssertionError
      • 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
      • clearErrorsAndWarnings

        protected void clearErrorsAndWarnings()
        Overrides:
        clearErrorsAndWarnings in class org.eclipse.xtext.resource.XtextResource
      • doUnload

        protected void doUnload()
        Overrides:
        doUnload in class org.eclipse.xtext.resource.DerivedStateAwareResource
      • doLoad

        protected void doLoad​(InputStream inputStream,
                              Map<?,​?> options)
                       throws IOException
        Overrides:
        doLoad in class org.eclipse.xtext.linking.lazy.LazyLinkingResource
        Throws:
        IOException