Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[gmf-dev] Service.ProviderDescriptor sublasses and isSupportedInExtention(IOperation) calss.

Hi,

I am trying to reduce the scope of several providers to GMF extension points in Sirius. I have just found out that the context and object elements created in several extensions are inspected only for the instanciation of the providers. And I wonder why it is not the case for the next ProviderDescriptor.provide calls.
It seems to occur several org.eclipse.gmf.runtime.diagram.ui extension points: editPolicyProviders, editPartProviders, decoratorProviders, ...

For example, in org.eclipse.gmf.runtime.diagram.ui.internal.services.decorator.DecoratorService.ProviderDescriptor.provides(IOperation):

        /**
         * @see org.eclipse.gmf.runtime.common.core.service.IProvider#provides(org.eclipse.gmf.runtime.common.core.service.IOperation)
         */
        public boolean provides(IOperation operation) {
            if (!policyInitialized){
                policy = getPolicy();
                policyInitialized = true;
            }
            if (policy != null)
                return policy.provides(operation);
            if (provider == null) {
                if (isSupportedInExtention(operation)) {
                    providerConfiguration = null;
                    return getProvider().provides(operation);
                }
                return false;
            }
            return getProvider().provides(operation);
        }

(Note that there is no policy creation proposed in the DecoratorProvider extension)


I was playing with both Sirius and Papyrus. When I define a Sirus context for Sirius decorator providers, if I open a Papyrus diagram directly after the eclipse start, the Sirius decorator provider provide method is not called, the context does its job. But If I open a Sirius diagram and then a Papyrus diagram, the Sirius decorator provider has been initialized and its provide method is called (it returns false as expected and does not add a Sirius decorator on a Papyrus diagram) but I expected my Sirius provider to be inspected only in a Sirius context as I have just defined in our plugin.xml (https://git.eclipse.org/r/#/c/26846/).

I thought the context could be used to help the services to reduce the IProviders.provides() method calls, ie to filter the list of enabled providers in the current context. But it appears it is only used as support for on-demand loading (GMF Developer Guide > Programmer's Guide > Runtime > Developper Guide to the Diagram Runtime > Services).

Am I right or is it a bug ?

Regards,

Maxime





Back to the top