Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » DecoratorProvider configuration
DecoratorProvider configuration [message #78875] Mon, 20 November 2006 09:56 Go to next message
Eclipse UserFriend
Hello,

as far as I understood, the <object> elements of the decorator extension
entry in plugin.xml is used to specify all potential decoration targets.

In fact, my provider's "provides()" method is called for objects of
almost every type, even if I specify a single distinct type as <object>.

Further, the extension point documentation is misleading here because it
states the plugin id as optional. But it seems to be mandatory, actually.


Thanks for your help,

Martin.
Re: DecoratorProvider configuration [message #78962 is a reply to message #78875] Mon, 20 November 2006 16:52 Go to previous messageGo to next message
Eclipse UserFriend
Martin,

The DecoratorService always checks the plugin.xml to see that it
provides for the type of decorator target before calling the provides()
method on a provider. Did you add the ID of your object type to the
list of decoratorTargets in the plugin.xml? It should look something
like this:

<decoratorProvider
class=" org.eclipse.gmf.runtime.diagram.ui.providers.internal.Diagra mDecoratorProvider ">
<Priority name="Lowest">
</Priority>
<object
class=" org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPar t(org.eclipse.gmf.runtime.diagram.ui) "
id="PRIMARY_VIEW">
</object>
<context decoratorTargets="PRIMARY_VIEW">
</context>
</decoratorProvider>

I hope this helps.

- Cherie

Martin Herbort wrote:
>
> Hello,
>
> as far as I understood, the <object> elements of the decorator extension
> entry in plugin.xml is used to specify all potential decoration targets.
>
> In fact, my provider's "provides()" method is called for objects of
> almost every type, even if I specify a single distinct type as <object>.
>
> Further, the extension point documentation is misleading here because it
> states the plugin id as optional. But it seems to be mandatory, actually.
>
>
> Thanks for your help,
>
> Martin.
Re: DecoratorProvider configuration [message #79225 is a reply to message #78962] Tue, 21 November 2006 08:35 Go to previous messageGo to next message
Eclipse UserFriend
Hi Cherie,

yes, that is indeed how it should work ;-)
I did configure my plugin.xml definitely analogous to your examlple.

But anyway, my provider's provides() method is called for any edit part
whose semantic element is in the SAME ecore model as the one edit part
specified in my plugin.xml.

I noticed that provides() is NOT called for those edit parts whose sem.
elements are located in a DIFFERENT ecore model.

(Yeah, we're using multiple ecore models simultaneously)

We believe here, that this GMF feature was working in the recent past.
So, is it a bug since the last release?

Regards,

Martin


Cherie Revells schrieb:
> Martin,
>
> The DecoratorService always checks the plugin.xml to see that it
> provides for the type of decorator target before calling the provides()
> method on a provider. Did you add the ID of your object type to the
> list of decoratorTargets in the plugin.xml? It should look something
> like this:
>
> <decoratorProvider
> class=" org.eclipse.gmf.runtime.diagram.ui.providers.internal.Diagra mDecoratorProvider ">
>
> <Priority name="Lowest">
> </Priority>
> <object
> class=" org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPar t(org.eclipse.gmf.runtime.diagram.ui) "
> id="PRIMARY_VIEW">
> </object>
> <context decoratorTargets="PRIMARY_VIEW">
> </context>
> </decoratorProvider>
>
> I hope this helps.
>
> - Cherie
>
> Martin Herbort wrote:
>>
>> Hello,
>>
>> as far as I understood, the <object> elements of the decorator
>> extension entry in plugin.xml is used to specify all potential
>> decoration targets.
>>
>> In fact, my provider's "provides()" method is called for objects of
>> almost every type, even if I specify a single distinct type as <object>.
>>
>> Further, the extension point documentation is misleading here because
>> it states the plugin id as optional. But it seems to be mandatory,
>> actually.
>>
>>
>> Thanks for your help,
>>
>> Martin.
Re: DecoratorProvider configuration [message #79251 is a reply to message #79225] Tue, 21 November 2006 08:48 Go to previous messageGo to next message
Eclipse UserFriend
Martin,

Just to clarify, is the problem that your provides() method is being
called when it shouldn't be or is it not being called when it should be?
If the plugin of the editpart class you have specified in your xml has
not yet been loaded, you may also need to add the plugin in parenthesis
so that the class loader can find it.

Could you send me the criteria you are using in your decorator extension
point defining which editparts you are providing for? Did you write the
decorator extension code yourself or is this generated code?

Thanks,
Cherie

Martin Herbort wrote:
> Hi Cherie,
>
> yes, that is indeed how it should work ;-)
> I did configure my plugin.xml definitely analogous to your examlple.
>
> But anyway, my provider's provides() method is called for any edit part
> whose semantic element is in the SAME ecore model as the one edit part
> specified in my plugin.xml.
>
> I noticed that provides() is NOT called for those edit parts whose sem.
> elements are located in a DIFFERENT ecore model.
>
> (Yeah, we're using multiple ecore models simultaneously)
>
> We believe here, that this GMF feature was working in the recent past.
> So, is it a bug since the last release?
>
> Regards,
>
> Martin
>
>
> Cherie Revells schrieb:
>> Martin,
>>
>> The DecoratorService always checks the plugin.xml to see that it
>> provides for the type of decorator target before calling the
>> provides() method on a provider. Did you add the ID of your object
>> type to the list of decoratorTargets in the plugin.xml? It should
>> look something like this:
>>
>> <decoratorProvider
>> class=" org.eclipse.gmf.runtime.diagram.ui.providers.internal.Diagra mDecoratorProvider ">
>>
>> <Priority name="Lowest">
>> </Priority>
>> <object
>> class=" org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPar t(org.eclipse.gmf.runtime.diagram.ui) "
>> id="PRIMARY_VIEW">
>> </object>
>> <context decoratorTargets="PRIMARY_VIEW">
>> </context>
>> </decoratorProvider>
>>
>> I hope this helps.
>>
>> - Cherie
>>
>> Martin Herbort wrote:
>>>
>>> Hello,
>>>
>>> as far as I understood, the <object> elements of the decorator
>>> extension entry in plugin.xml is used to specify all potential
>>> decoration targets.
>>>
>>> In fact, my provider's "provides()" method is called for objects of
>>> almost every type, even if I specify a single distinct type as <object>.
>>>
>>> Further, the extension point documentation is misleading here because
>>> it states the plugin id as optional. But it seems to be mandatory,
>>> actually.
>>>
>>>
>>> Thanks for your help,
>>>
>>> Martin.
Re: DecoratorProvider configuration [message #79280 is a reply to message #79251] Tue, 21 November 2006 09:11 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

it is being called when it shouldn't be (oh yeah!).

I wrote the decorator extension by myself.
Finding the plugin isn't the problem because I already specified the
correct plugin (see below).

Thanks in advance,

Martin

My extension specification:

<extension
point="org.eclipse.gmf.runtime.diagram.ui.decoratorProviders ">
<decoratorProvider
class="mosaicpl.diagram.providers.VarIconDecoratorProvider" >
<Priority
name="Medium">
</Priority>
<object

class=" mosaicpl.diagram.edit.parts.ClassNameEditPart(MoSAicPL.diagr am) "
id="schneewittchen">
</object>
<context
decoratorTargets="schneewittchen">
</context>
</decoratorProvider>
</extension>

Cherie Revells schrieb:
> Martin,
>
> Just to clarify, is the problem that your provides() method is being
> called when it shouldn't be or is it not being called when it should be?
> If the plugin of the editpart class you have specified in your xml has
> not yet been loaded, you may also need to add the plugin in parenthesis
> so that the class loader can find it.
>
> Could you send me the criteria you are using in your decorator extension
> point defining which editparts you are providing for? Did you write the
> decorator extension code yourself or is this generated code?
>
> Thanks,
> Cherie
>
> Martin Herbort wrote:
>> Hi Cherie,
>>
>> yes, that is indeed how it should work ;-)
>> I did configure my plugin.xml definitely analogous to your examlple.
>>
>> But anyway, my provider's provides() method is called for any edit
>> part whose semantic element is in the SAME ecore model as the one edit
>> part specified in my plugin.xml.
>>
>> I noticed that provides() is NOT called for those edit parts whose
>> sem. elements are located in a DIFFERENT ecore model.
>>
>> (Yeah, we're using multiple ecore models simultaneously)
>>
>> We believe here, that this GMF feature was working in the recent past.
>> So, is it a bug since the last release?
>>
>> Regards,
>>
>> Martin
>>
>>
>> Cherie Revells schrieb:
>>> Martin,
>>>
>>> The DecoratorService always checks the plugin.xml to see that it
>>> provides for the type of decorator target before calling the
>>> provides() method on a provider. Did you add the ID of your object
>>> type to the list of decoratorTargets in the plugin.xml? It should
>>> look something like this:
>>>
>>> <decoratorProvider
>>> class=" org.eclipse.gmf.runtime.diagram.ui.providers.internal.Diagra mDecoratorProvider ">
>>>
>>> <Priority name="Lowest">
>>> </Priority>
>>> <object
>>> class=" org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPar t(org.eclipse.gmf.runtime.diagram.ui) "
>>> id="PRIMARY_VIEW">
>>> </object>
>>> <context decoratorTargets="PRIMARY_VIEW">
>>> </context>
>>> </decoratorProvider>
>>>
>>> I hope this helps.
>>>
>>> - Cherie
>>>
>>> Martin Herbort wrote:
>>>>
>>>> Hello,
>>>>
>>>> as far as I understood, the <object> elements of the decorator
>>>> extension entry in plugin.xml is used to specify all potential
>>>> decoration targets.
>>>>
>>>> In fact, my provider's "provides()" method is called for objects of
>>>> almost every type, even if I specify a single distinct type as
>>>> <object>.
>>>>
>>>> Further, the extension point documentation is misleading here
>>>> because it states the plugin id as optional. But it seems to be
>>>> mandatory, actually.
>>>>
>>>>
>>>> Thanks for your help,
>>>>
>>>> Martin.
Re: DecoratorProvider configuration [message #79352 is a reply to message #79280] Tue, 21 November 2006 10:37 Go to previous messageGo to next message
Eclipse UserFriend
Martin,

Are you saying that the provides() method is being called for an
editpart that is not a mosaicpl.diagram.edit.parts.ClassNameEditPart or
a subclass of this editpart? There is no criteria being specified
regarding the semantic element so the semantic element should have no
effect on whether the provides() method is called or not.

Regards,
Cherie

Martin Herbort wrote:
>
> Hello,
>
> it is being called when it shouldn't be (oh yeah!).
>
> I wrote the decorator extension by myself.
> Finding the plugin isn't the problem because I already specified the
> correct plugin (see below).
>
> Thanks in advance,
>
> Martin
>
> My extension specification:
>
> <extension
> point="org.eclipse.gmf.runtime.diagram.ui.decoratorProviders ">
> <decoratorProvider
> class="mosaicpl.diagram.providers.VarIconDecoratorProvider" >
> <Priority
> name="Medium">
> </Priority>
> <object
>
> class=" mosaicpl.diagram.edit.parts.ClassNameEditPart(MoSAicPL.diagr am) "
> id="schneewittchen">
> </object>
> <context
> decoratorTargets="schneewittchen">
> </context>
> </decoratorProvider>
> </extension>
>
> Cherie Revells schrieb:
>> Martin,
>>
>> Just to clarify, is the problem that your provides() method is being
>> called when it shouldn't be or is it not being called when it should
>> be? If the plugin of the editpart class you have specified in your
>> xml has not yet been loaded, you may also need to add the plugin in
>> parenthesis so that the class loader can find it.
>>
>> Could you send me the criteria you are using in your decorator
>> extension point defining which editparts you are providing for? Did
>> you write the decorator extension code yourself or is this generated
>> code?
>>
>> Thanks,
>> Cherie
>>
>> Martin Herbort wrote:
>>> Hi Cherie,
>>>
>>> yes, that is indeed how it should work ;-)
>>> I did configure my plugin.xml definitely analogous to your examlple.
>>>
>>> But anyway, my provider's provides() method is called for any edit
>>> part whose semantic element is in the SAME ecore model as the one
>>> edit part specified in my plugin.xml.
>>>
>>> I noticed that provides() is NOT called for those edit parts whose
>>> sem. elements are located in a DIFFERENT ecore model.
>>>
>>> (Yeah, we're using multiple ecore models simultaneously)
>>>
>>> We believe here, that this GMF feature was working in the recent
>>> past. So, is it a bug since the last release?
>>>
>>> Regards,
>>>
>>> Martin
>>>
>>>
>>> Cherie Revells schrieb:
>>>> Martin,
>>>>
>>>> The DecoratorService always checks the plugin.xml to see that it
>>>> provides for the type of decorator target before calling the
>>>> provides() method on a provider. Did you add the ID of your object
>>>> type to the list of decoratorTargets in the plugin.xml? It should
>>>> look something like this:
>>>>
>>>> <decoratorProvider
>>>> class=" org.eclipse.gmf.runtime.diagram.ui.providers.internal.Diagra mDecoratorProvider ">
>>>>
>>>> <Priority name="Lowest">
>>>> </Priority>
>>>> <object
>>>> class=" org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPar t(org.eclipse.gmf.runtime.diagram.ui) "
>>>> id="PRIMARY_VIEW">
>>>> </object>
>>>> <context decoratorTargets="PRIMARY_VIEW">
>>>> </context>
>>>> </decoratorProvider>
>>>>
>>>> I hope this helps.
>>>>
>>>> - Cherie
>>>>
>>>> Martin Herbort wrote:
>>>>>
>>>>> Hello,
>>>>>
>>>>> as far as I understood, the <object> elements of the decorator
>>>>> extension entry in plugin.xml is used to specify all potential
>>>>> decoration targets.
>>>>>
>>>>> In fact, my provider's "provides()" method is called for objects of
>>>>> almost every type, even if I specify a single distinct type as
>>>>> <object>.
>>>>>
>>>>> Further, the extension point documentation is misleading here
>>>>> because it states the plugin id as optional. But it seems to be
>>>>> mandatory, actually.
>>>>>
>>>>>
>>>>> Thanks for your help,
>>>>>
>>>>> Martin.
Re: DecoratorProvider configuration [message #79500 is a reply to message #79352] Tue, 21 November 2006 13:01 Go to previous message
Eclipse UserFriend
Martin,

I'm sorry, but I made a mistake. If your decorator provider has not
previously been consulted to see if it provides, it will consult with
the criteria in the plugin.xml file first to see if it should load your
plugin and ask your provider if it can provide. If your decorator
provider class has already been called, then the criteria in the
plugin.xml file will NOT be consulted and the provides() method will be
called on the provider only.

The criteria in the plugin.xml file of your decorator provider extension
should be used to defer loading of your plugin when it is not required.
The code in the provides() method will need to duplicate the check
that is in your plugin.xml file. If you don't need to defer loading of
your plugin, then you don't even need to worry about specifying this
criteria in your plugin.xml file.

ADVANCED NOTES:
1. This was a performance enhancement to avoid reading the plugin.xml
file everytime. Unfortunately, this performance enhancement was not
made across all the services. In order to see the behavior of a
service, you need to check the XService.ProviderDescriptor.provides()
method. In the DecoratorService, you will see this code:
if (provider == null) {
if (isSupportedInExtention(operation)) {
providerConfiguration = null;
return getProvider().provides(operation);
}
return false;
}
The isSupportedInExtention(operation) call consults the plugin.xml file.
In this case, this will only happen if the provider is null (i.e. it
has not previously been asked if it provides).

2. There is another way to defer loading of the plugin without writing
all this plugin.xml criteria. You could also put your provider class in
a package which you add to the exceptions list in your plugin.xml file
to avoid loading this package. From the Eclipse docs: "The 'exceptions'
attribute is used to specify a list of packages which must not cause the
bundle to be activated when classes or resources are loaded from them."

This may or may not work for you depending on your code. For an example
of this, look at the following package in the Logic Diagram Example:
org.eclipse.gmf.examples.runtime.diagram.logic.internal.nona ctivating
Search for references to this in the plugin.xml.

I hope this helps. Sorry for the confusion. :-(

Regards,
Cherie

Cherie Revells wrote:
> Martin,
>
> Are you saying that the provides() method is being called for an
> editpart that is not a mosaicpl.diagram.edit.parts.ClassNameEditPart or
> a subclass of this editpart? There is no criteria being specified
> regarding the semantic element so the semantic element should have no
> effect on whether the provides() method is called or not.
>
> Regards,
> Cherie
>
> Martin Herbort wrote:
>>
>> Hello,
>>
>> it is being called when it shouldn't be (oh yeah!).
>>
>> I wrote the decorator extension by myself.
>> Finding the plugin isn't the problem because I already specified the
>> correct plugin (see below).
>>
>> Thanks in advance,
>>
>> Martin
>>
>> My extension specification:
>>
>> <extension
>> point="org.eclipse.gmf.runtime.diagram.ui.decoratorProviders ">
>> <decoratorProvider
>> class="mosaicpl.diagram.providers.VarIconDecoratorProvider" >
>> <Priority
>> name="Medium">
>> </Priority>
>> <object
>>
>> class=" mosaicpl.diagram.edit.parts.ClassNameEditPart(MoSAicPL.diagr am) "
>> id="schneewittchen">
>> </object>
>> <context
>> decoratorTargets="schneewittchen">
>> </context>
>> </decoratorProvider>
>> </extension>
>>
>> Cherie Revells schrieb:
>>> Martin,
>>>
>>> Just to clarify, is the problem that your provides() method is being
>>> called when it shouldn't be or is it not being called when it should
>>> be? If the plugin of the editpart class you have specified in your
>>> xml has not yet been loaded, you may also need to add the plugin in
>>> parenthesis so that the class loader can find it.
>>>
>>> Could you send me the criteria you are using in your decorator
>>> extension point defining which editparts you are providing for? Did
>>> you write the decorator extension code yourself or is this generated
>>> code?
>>>
>>> Thanks,
>>> Cherie
>>>
>>> Martin Herbort wrote:
>>>> Hi Cherie,
>>>>
>>>> yes, that is indeed how it should work ;-)
>>>> I did configure my plugin.xml definitely analogous to your examlple.
>>>>
>>>> But anyway, my provider's provides() method is called for any edit
>>>> part whose semantic element is in the SAME ecore model as the one
>>>> edit part specified in my plugin.xml.
>>>>
>>>> I noticed that provides() is NOT called for those edit parts whose
>>>> sem. elements are located in a DIFFERENT ecore model.
>>>>
>>>> (Yeah, we're using multiple ecore models simultaneously)
>>>>
>>>> We believe here, that this GMF feature was working in the recent
>>>> past. So, is it a bug since the last release?
>>>>
>>>> Regards,
>>>>
>>>> Martin
>>>>
>>>>
>>>> Cherie Revells schrieb:
>>>>> Martin,
>>>>>
>>>>> The DecoratorService always checks the plugin.xml to see that it
>>>>> provides for the type of decorator target before calling the
>>>>> provides() method on a provider. Did you add the ID of your object
>>>>> type to the list of decoratorTargets in the plugin.xml? It should
>>>>> look something like this:
>>>>>
>>>>> <decoratorProvider
>>>>> class=" org.eclipse.gmf.runtime.diagram.ui.providers.internal.Diagra mDecoratorProvider ">
>>>>>
>>>>> <Priority name="Lowest">
>>>>> </Priority>
>>>>> <object
>>>>> class=" org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPar t(org.eclipse.gmf.runtime.diagram.ui) "
>>>>> id="PRIMARY_VIEW">
>>>>> </object>
>>>>> <context decoratorTargets="PRIMARY_VIEW">
>>>>> </context>
>>>>> </decoratorProvider>
>>>>>
>>>>> I hope this helps.
>>>>>
>>>>> - Cherie
>>>>>
>>>>> Martin Herbort wrote:
>>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> as far as I understood, the <object> elements of the decorator
>>>>>> extension entry in plugin.xml is used to specify all potential
>>>>>> decoration targets.
>>>>>>
>>>>>> In fact, my provider's "provides()" method is called for objects
>>>>>> of almost every type, even if I specify a single distinct type as
>>>>>> <object>.
>>>>>>
>>>>>> Further, the extension point documentation is misleading here
>>>>>> because it states the plugin id as optional. But it seems to be
>>>>>> mandatory, actually.
>>>>>>
>>>>>>
>>>>>> Thanks for your help,
>>>>>>
>>>>>> Martin.
Previous Topic:org.eclipse.emf.codegen.jet.JETException: InvocationTargetException for BMPM Tutorial
Next Topic:Can I close compartment and maintain overall size of figure ?
Goto Forum:
  


Current Time: Thu Apr 24 03:00:41 EDT 2025

Powered by FUDForum. Page generated in 0.05010 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top