Class SReferenceLinkAdapter

    • Constructor Detail

      • SReferenceLinkAdapter

        protected SReferenceLinkAdapter​(@NotNull
                                        String name)
    • Method Detail

      • getName

        @NotNull
        public String getName()
        Description copied from interface: SNamedElement
        Presentation of the element for an end-user. Unlike identity, the name is deemed user-friendly and shall not be used for persistence.
        Specified by:
        getName in interface SNamedElement
        Returns:
        name of the meta element
      • getOwner

        @NotNull
        public abstract SAbstractConcept getOwner()
        Description copied from interface: SConceptFeature
        Retrieves concept where the feature has been declared. Note, this concept doesn't necessarily match concept of the node when this feature has been obtained through node's meta-model accessors, instead, the feature may originate from one of concept's ancestors.
        Specified by:
        getOwner in interface SConceptFeature
        Returns:
        concept this feature is declared in
      • isOptional

        public boolean isOptional()
        Description copied from interface: SAbstractLink
        This link may contain no elements.
        Specified by:
        isOptional in interface SAbstractLink
      • isReference

        public boolean isReference()
        Description copied from interface: SAbstractLink
        True for references, false for containment relationships.
        Specified by:
        isReference in interface SAbstractLink
      • getScope

        public SScope getScope​(SNode referenceNode)
        Description copied from interface: SReferenceLink
        Builds and returns a scope for this reference in the given context.
        Specified by:
        getScope in interface SReferenceLink
        Parameters:
        referenceNode - node containing the reference, registered in the repository
      • getScope

        public SScope getScope​(SNode contextNode,
                               @Nullable
                               SContainmentLink link,
                               int index)
        Description copied from interface: SReferenceLink
        This method allows to build a scope for the reference before its node has been registered in the repository.

        In this case you must provide the nearest available ancestor node as a context node and the location within it where the reference will be placed.

        Example: while typing a new statement in the middle of a statement list, the context menu builds a scope before the statement has been created, in order to offer, among other things, all local variables defined up to this point in code. This is achieved by passing the statement list as a context node, "statement" link as the second parameter and the index of the statement within the statement list as the last parameter.

        Specified by:
        getScope in interface SReferenceLink
        Parameters:
        contextNode - the nearest ancestor of the node containing the reference
        link - containment link in the contextNode
        index - position within the link
      • serialize

        public abstract String serialize()