Class BlankTemplateProvider

  • All Implemented Interfaces:
    TemplateProvider

    public class BlankTemplateProvider
    extends java.lang.Object
    implements TemplateProvider
    TemplateProvider that provides a templates simply containing empty instances of the corresponding EClass and its concrete sub classes.
    Author:
    Lucas Koehler
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canProvideTemplates​(org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EReference reference)
      Queries whether the provider can provide templates that may be assigned to the given reference of the given owner object.
      protected Template createTemplate​(org.eclipse.emf.ecore.EClass type, org.eclipse.emf.ecore.EObject instance)
      Creates a blank template for the given type.
      protected java.lang.String getDisplayName​(org.eclipse.emf.ecore.EClass type)
      Fetch the display name for the given EClass.
      java.util.Set<Template> provideTemplates​(org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EReference reference)
      Obtains templates wrapping objects that can be assigned to the given reference of the given owner object.
      java.util.Set<Template> provideTemplates​(org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EReference reference, EClassSelectionStrategy eClassSelectionStrategy)
      The actual method which creates the templates.
      protected void setBundleResolver​(BundleResolver bundleResolver)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • canProvideTemplates

        public boolean canProvideTemplates​(org.eclipse.emf.ecore.EObject owner,
                                           org.eclipse.emf.ecore.EReference reference)
        Description copied from interface: TemplateProvider
        Queries whether the provider can provide templates that may be assigned to the given reference of the given owner object.
        Specified by:
        canProvideTemplates in interface TemplateProvider
        Parameters:
        owner - the object owning a reference to be assigned from a template
        reference - a reference feature of the owner that is to be assigned from a template. If the reference is a containment then the owner would be the container of the template
        Returns:
        whether I have any templates to offer
      • provideTemplates

        public java.util.Set<Template> provideTemplates​(org.eclipse.emf.ecore.EObject owner,
                                                        org.eclipse.emf.ecore.EReference reference)
        Description copied from interface: TemplateProvider
        Obtains templates wrapping objects that can be assigned to the given reference of the given owner object. This will only be called for an owner and reference for which the receiver previously answered true to an invocation of the TemplateProvider.canProvideTemplates(EObject, EReference) query.
        Specified by:
        provideTemplates in interface TemplateProvider
        Parameters:
        owner - the object owning a reference to be assigned from a template
        reference - a reference feature of the owner that is to be assigned from a template. If the reference is a containment then the owner would be the container of the template
        Returns:
        my available templates, or an empty set if none (never null)
      • provideTemplates

        public java.util.Set<Template> provideTemplates​(org.eclipse.emf.ecore.EObject owner,
                                                        org.eclipse.emf.ecore.EReference reference,
                                                        EClassSelectionStrategy eClassSelectionStrategy)
        The actual method which creates the templates. This Method uses the provided EClassSelectionStrategy to filter possible templates.
        Parameters:
        owner - The EObject to which the templates should be added
        reference - The EReference to which the templates should be added
        eClassSelectionStrategy - The EClassSelectionStrategy to use for filtering
        Returns:
        The Set of Templates created by this TemplateProvider
      • createTemplate

        protected Template createTemplate​(org.eclipse.emf.ecore.EClass type,
                                          org.eclipse.emf.ecore.EObject instance)
        Creates a blank template for the given type.
        Parameters:
        type - the type of the instance to wrap in a template
        instance - the instance of the template type
        Returns:
        The blank Template
      • getDisplayName

        protected java.lang.String getDisplayName​(org.eclipse.emf.ecore.EClass type)
        Fetch the display name for the given EClass.
        Parameters:
        type - the EClass to get the display name for
        Returns:
        the display name