Class XtextStructureHelper
- java.lang.Object
-
- com._1c.g5.ides.core.handle.impl.xtext.XtextStructureHelper
-
public class XtextStructureHelper extends Object
A useful superclass for Xtext-based structure builders.- See Also:
StructureHelper
-
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.handly.model.impl.support.StructureHelper
helper
protected org.eclipse.xtext.linking.impl.LinkingHelper
linkingHelper
protected org.eclipse.xtext.resource.ILocationInFileProvider
locationProvider
protected Map<org.eclipse.handly.model.IElement,Object>
newElements
protected org.eclipse.xtext.naming.IQualifiedNameConverter
qualifiedNameConverter
protected org.eclipse.xtext.naming.IQualifiedNameProvider
qualifiedNameProvider
protected org.eclipse.xtext.resource.IResourceServiceProvider
resourceServiceProvider
-
Constructor Summary
Constructors Modifier Constructor Description protected
XtextStructureHelper(Map<org.eclipse.handly.model.IElement,Object> newElements, org.eclipse.xtext.resource.IResourceServiceProvider resourceServiceProvider)
Constructs a new structure helper.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addChild(org.eclipse.handly.model.impl.support.Body parentBody, org.eclipse.handly.model.IElement element, org.eclipse.handly.model.impl.support.Body body)
Remembers the given element with body as a child for the given parent body.protected void
complete(org.eclipse.handly.model.impl.support.Body body)
Completes body.protected String
getCrossRefValue(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EReference eReference)
Returns the value of the given single-valued cross-reference in the given object, applying the appropriate converter to the value obtained directly from the associated source.protected String[]
getCrossRefValues(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EReference eReference)
Returns the value(s) of the given cross-reference in the given boject, applying the appropriate converter to the value(s) obtained directly from the asssociated source.protected org.eclipse.handly.util.TextRange
getFullRange(org.eclipse.emf.ecore.EObject eObject)
Returns the text range for the given object.protected String
getFullyQualifiedName(org.eclipse.emf.ecore.EObject eObject)
Returns the fully qualified name for the given object.protected org.eclipse.handly.util.TextRange
getIdentifyingRange(org.eclipse.emf.ecore.EObject eObject)
Returns the identifying text range for the given object.protected org.eclipse.handly.util.TextRange
toTextRange(org.eclipse.xtext.util.ITextRegion region)
Converts the given region to a text range.
-
-
-
Field Detail
-
resourceServiceProvider
protected final org.eclipse.xtext.resource.IResourceServiceProvider resourceServiceProvider
-
qualifiedNameProvider
protected final org.eclipse.xtext.naming.IQualifiedNameProvider qualifiedNameProvider
-
qualifiedNameConverter
protected final org.eclipse.xtext.naming.IQualifiedNameConverter qualifiedNameConverter
-
linkingHelper
protected final org.eclipse.xtext.linking.impl.LinkingHelper linkingHelper
-
locationProvider
protected final org.eclipse.xtext.resource.ILocationInFileProvider locationProvider
-
helper
protected final org.eclipse.handly.model.impl.support.StructureHelper helper
-
-
Constructor Detail
-
XtextStructureHelper
protected XtextStructureHelper(Map<org.eclipse.handly.model.IElement,Object> newElements, org.eclipse.xtext.resource.IResourceServiceProvider resourceServiceProvider)
Constructs a new structure helper.- Parameters:
newElements
- the map to populate with stucture elements (notnull
)resourceServiceProvider
- Xtext'sIResourceServiceProvider
for the language (notnull
)
-
-
Method Detail
-
getFullyQualifiedName
protected String getFullyQualifiedName(org.eclipse.emf.ecore.EObject eObject)
Returns the fully qualified name for the given object.- Parameters:
eObject
- the object (notnull
)- Returns:
- the fully qualified name of the given object,
or
null
if not applicable to the object
-
getCrossRefValue
protected String getCrossRefValue(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EReference eReference)
Returns the value of the given single-valued cross-reference in the given object, applying the appropriate converter to the value obtained directly from the associated source.- Parameters:
eObject
- the object (notnull
)eReference
- the single-valued cross-reference (notnull
)- Returns:
- the value of the given single-valued cross-reference,
or
null
if not set or cannot be obtained from the source
-
getCrossRefValues
protected String[] getCrossRefValues(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EReference eReference)
Returns the value(s) of the given cross-reference in the given boject, applying the appropriate converter to the value(s) obtained directly from the asssociated source.- Parameters:
eObject
- the object (notnull
)eReference
- the cross-reference (notnull
)- Returns:
- the array containing the values of the given cross-reference
(never
null
, but may be empty)
-
getFullRange
protected org.eclipse.handly.util.TextRange getFullRange(org.eclipse.emf.ecore.EObject eObject)
Returns the text range for the given object.- Parameters:
eObject
- the object (notnull
)- Returns:
- the requested text range or
null
if unknown
-
getIdentifyingRange
protected org.eclipse.handly.util.TextRange getIdentifyingRange(org.eclipse.emf.ecore.EObject eObject)
Returns the identifying text range for the given object.- Parameters:
eObject
- the object (notnull
)- Returns:
- the requested text range or
null
if unknown
-
toTextRange
protected org.eclipse.handly.util.TextRange toTextRange(org.eclipse.xtext.util.ITextRegion region)
Converts the given region to a text range. If the given region isnull
or empty,null
is returned.- Parameters:
region
-ITextRegion
ornull
- Returns:
- the converted text range (or
null
if region isnull
or region is empty)
-
complete
protected void complete(org.eclipse.handly.model.impl.support.Body body)
Completes body.- Parameters:
body
- the body to complete (not null)
-
addChild
protected void addChild(org.eclipse.handly.model.impl.support.Body parentBody, org.eclipse.handly.model.IElement element, org.eclipse.handly.model.impl.support.Body body)
Remembers the given element with body as a child for the given parent body.- Parameters:
parentBody
- the handle for a child element (not null)element
- the handle for a child element (not null)body
- the body of child element (not null)
-
-