Class QlScopeProvider

java.lang.Object
org.eclipse.xtext.scoping.impl.AbstractScopeProvider
com._1c.g5.v8.dt.ql.scoping.QlScopeProvider
All Implemented Interfaces:
org.eclipse.xtext.scoping.impl.IDelegatingScopeProvider, org.eclipse.xtext.scoping.IScopeProvider
Direct Known Subclasses:
QlDcsScopeProvider, RightQlScopeProvider

public class QlScopeProvider extends org.eclipse.xtext.scoping.impl.AbstractScopeProvider implements org.eclipse.xtext.scoping.impl.IDelegatingScopeProvider
This class contains custom scoping description. see : http://www.eclipse.org/Xtext/documentation/latest/xtext.html#scoping on how and when to use it
  • Field Details

  • Constructor Details

    • QlScopeProvider

      public QlScopeProvider()
  • Method Details

    • createUserDataForTypes

      public static Map<String,String> createUserDataForTypes(DbViewFieldDef child)
      Creates special data for indexing DbViewFieldDef elements. This special data contains information about returning types. Data about of returning types available by key TYPES_USER_DATA_INTNL or TYPES_USER_DATA_RU
      Parameters:
      child - indexing DbViewFieldDef, can't be null
      Returns:
      special data for indexing DbViewFieldDef elements, never null
    • getScope

      public org.eclipse.xtext.scoping.IScope getScope(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference)
      Specified by:
      getScope in interface org.eclipse.xtext.scoping.IScopeProvider
    • getDelegate

      public org.eclipse.xtext.scoping.IScopeProvider getDelegate()
      Specified by:
      getDelegate in interface org.eclipse.xtext.scoping.impl.IDelegatingScopeProvider
    • createScope

      protected org.eclipse.xtext.scoping.IScope createScope(org.eclipse.xtext.scoping.IScope parent, Iterable<org.eclipse.xtext.resource.IEObjectDescription> descrs)
      Created scope for gotten list of IEObjectDescription
      Parameters:
      parent - parent scope, can't be null
      descrs - , list of IEObjectDescription, can't be null
      Returns:
      created IScope, never null
    • createFakeEObjectDescription

      protected List<org.eclipse.xtext.resource.IEObjectDescription> createFakeEObjectDescription(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference)
      Create fake IEObjectDescription This action need for all refers in model will be resolve. In validation stage check all refers and show correct warning or error messages
      Parameters:
      context -
      reference -
      Returns:
      list of IEObjectDescription
    • defineAllowedDbView

      protected QlScopeProvider.AllowedDbViewType[] defineAllowedDbView(boolean isTable, org.eclipse.emf.ecore.EObject context)
      Define allowed DbViewElement for context
      Parameters:
      isTable -
      context -
      Returns:
      types of allowed DbViewElement as QlScopeProvider.AllowedDbViewType
    • defineAllowedDbViewForRightContext

      protected QlScopeProvider.AllowedDbViewType[] defineAllowedDbViewForRightContext(boolean isTable, org.eclipse.emf.ecore.EObject context)
      Define allowed DbViewElement for context
      Parameters:
      isTable -
      context -
      Returns:
      types of allowed DbViewElement as QlScopeProvider.AllowedDbViewType
    • defineAllowedDbViewForExpressionInQSExpression

      protected QlScopeProvider.AllowedDbViewType[] defineAllowedDbViewForExpressionInQSExpression(org.eclipse.emf.ecore.EObject context)
      Define allowed DbViewElement for context, which is QuerySchemaExpression
      Parameters:
      context -
      Returns:
      types of allowed DbViewElement as QlScopeProvider.AllowedDbViewType
    • defineAllowedDbViewForExpressionInSelectQuery

      protected QlScopeProvider.AllowedDbViewType[] defineAllowedDbViewForExpressionInSelectQuery(org.eclipse.emf.ecore.EObject context, QuerySchemaExpression expr)
      Define allowed DbViewElement for context, which is QuerySchemaExpression. This context part of select query, not operator of select query
      Parameters:
      context -
      Returns:
      types of allowed DbViewElement as QlScopeProvider.AllowedDbViewType
    • defineAllowedDbViewForExpressionInSelectOperator

      protected QlScopeProvider.AllowedDbViewType[] defineAllowedDbViewForExpressionInSelectOperator(org.eclipse.emf.ecore.EObject context, QuerySchemaExpression expr)
      Define allowed DbViewElement for context, which is QuerySchemaExpression. This context part of operator of select query
      Parameters:
      context -
      Returns:
      types of allowed DbViewElement as QlScopeProvider.AllowedDbViewType
    • createDescriptions

      protected org.eclipse.xtext.scoping.IScope createDescriptions(Iterable<QlScopeProvider.AllowedDbViewType> allowedType, org.eclipse.emf.ecore.EObject context)
      Parameters:
      allowedType - type of QlScopeProvider.AllowedDbViewType for getting actual IScope, can't be null
      context - actual context of ql query, can't be null
      Returns:
      IScope of allowed DbViewElement, never null
    • getAllowedDbView

      protected org.eclipse.xtext.scoping.IScope getAllowedDbView(QlScopeProvider.AllowedDbViewType type, org.eclipse.emf.ecore.EObject context)
      Parameters:
      type - of QlScopeProvider.AllowedDbViewType for getting actual IScope, can't be null
      actual - context of ql query, can't be null
      Returns:
      IScope of allowed DbViewElement, never null
    • getInnerFieldsFromSourceSection

      protected Collection<org.eclipse.xtext.resource.IEObjectDescription> getInnerFieldsFromSourceSection(QuerySchemaOperator operator)
      Gets descriptions of all inner fields from source section of operator
      Parameters:
      operator - QuerySchemaOperator with source section, can't be null
      Returns:
      collection of the IEObjectDescription of inner fields from source section
    • getAllowedDbViewSource

      protected org.eclipse.xtext.scoping.IScope getAllowedDbViewSource(org.eclipse.emf.ecore.EObject context)
      Gets allowed from source section
      Parameters:
      context - actual context, can't be null
      Returns:
      IScope of allowed DbViewElement, never null
    • getTableParameterFields

      protected Collection<org.eclipse.xtext.resource.IEObjectDescription> getTableParameterFields(org.eclipse.emf.ecore.EObject context)
      Gets descriptions of all fields for parameter of source table
      Parameters:
      context - context object from parameter of source table, each parameter has own set of allowed fields, cannot be null
      Returns:
      collection of the IEObjectDescription fields for parameter of source table, never null
    • isVirtualTableParameter

      protected boolean isVirtualTableParameter(org.eclipse.emf.ecore.EObject context)
      Checks that context corresponding to the source table parameter
      Parameters:
      context - context EObject, cannot be null
      Returns:
      true if context corresponding to the source table parameter, false otherwise
    • getDescriptionTempTable

      protected org.eclipse.xtext.scoping.IScope getDescriptionTempTable(org.eclipse.emf.ecore.EObject context)
      Gets allowed dbView from description temp table
      Parameters:
      context - actual context, can't be null
      Returns:
      IScope of allowed DbViewElement, never null
    • getAllowedDbViewThisQuery

      protected org.eclipse.xtext.scoping.IScope getAllowedDbViewThisQuery(org.eclipse.emf.ecore.EObject context, boolean withAlias)
      Gets allowed DbViewElement by current QuerySchemaSelectQuery
      Parameters:
      context - actual context of ql query, can't be null
      withAlias - true if returning IScope should contains only fields with real alias, false if returning IScope should contains only fields without real alias
      Returns:
      IScope of allowed DbViewElement, never null