## IEEFExtReferenceViewerFilterProvider

This extension point allows the contribution of an `org.eclipse.eef.ide.ui.ext.widgets.reference.api.IEEFExtReferenceViewerFilterProvider` which can be used to filter the content of the tree viewers used to display the objects that can be selected and where an object can be created using the reference widget.

    <extension
          point="org.eclipse.eef.ide.ui.ext.widgets.reference.eefExtReferenceViewerFilterProvider">
        <descriptor
              class="org.eclipse.sirius.ui.properties.ext.widgets.reference.internal.EEFExtReferenceViewerFilterProvider"
              description="%viewerFilterProvider.Description"
              id="org.eclipse.sirius.ui.properties.ext.widgets.reference.viewerFilterProvider"
              label="%viewerFilterProvider.Label">
        </descriptor>
    </extension>

Example of the contribution of a viewer filter provider. This contribution will let a plugin filter the content displayed in the tree viewers used to show where a new value can be created and which value can be selected for a reference. Eclipse Sirius provides the following basic implementation which is used to filter everything not contained in a semantic resource:

    import java.util.ArrayList;
    import java.util.List;

    import org.eclipse.eef.ide.ui.ext.widgets.reference.api.IEEFExtReferenceViewerFilterProvider;
    import org.eclipse.emf.ecore.resource.Resource;
    import org.eclipse.jface.viewers.Viewer;
    import org.eclipse.jface.viewers.ViewerFilter;
    import org.eclipse.sirius.business.api.session.Session;
    import org.eclipse.sirius.business.api.session.SessionManager;

    public class EEFExtReferenceViewerFilterProvider implements IEEFExtReferenceViewerFilterProvider {

        @Override
        public List<ViewerFilter> getViewerFilters(ContextKind contextKind) {
            List<ViewerFilter> viewerFilters = new ArrayList<>();

            ViewerFilter viewFilter = new ViewerFilter() {
                @Override
                public boolean select(Viewer viewer, Object parentElement, Object element) {
                    // Used to filter aird, odesign, etc
                    if (element instanceof Resource) {
                        Session session = SessionManager.INSTANCE.getSession((Resource) element);
                        return session != null;
                    }
                    return true;
                }
            };

            viewerFilters.add(viewFilter);
            return viewerFilters;
        }

    }

This example requires at least the following dependencies:

- org.eclipse.eef.ide.ui.ext.widgets.reference
- org.eclipse.emf.ecore
- org.eclipse.jface.viewers
- org.eclipse.sirius