Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [ECP] How to properly extend EMFStoreUIProvider
[ECP] How to properly extend EMFStoreUIProvider [message #1391261] Mon, 30 June 2014 17:08 Go to next message
Olivier Labrosse is currently offline Olivier LabrosseFriend
Messages: 49
Registered: November 2011
Member
Hi,

I wish to support synthetic items with specific child descriptors, in the Model Explorer, while using EMFStore for persistence.

Is there a proper way to extend the EMFStoreUIProvider in order to override the fillContextMenu() method? The point would be to check for instances of said synthetic items, and act accordingly to fetch their list of child descriptors.

From what I could find out, the provider name has to match the EMFStoreProvider's in order to get share/commit/etc. functionality in a 3.x application. I'm concerned about contributing my own providers with a name that clashes with the EMFStore ones.

Thanks very much once again for your much appreciated support.

-Olivier

P.S.: if it were proper for you to add an "else if (element instanceof IChildCreationExtender)" in the DefaultUIProvider#fillContextMenuForProject() method, I could submit a bugzilla for it. Anyone wishing to use synthetic items could then simply implement that interface.
Re: [ECP] How to properly extend EMFStoreUIProvider [message #1391693 is a reply to message #1391261] Tue, 01 July 2014 09:08 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi Oliver,

the UI Provider uses the content provider, which are generated by EMF
(edit bundle). So, I would adapt the item provider in order to change
the structure of the tree.

Best regards

Jonas

Am 30.06.2014 19:08, schrieb Olivier Labrosse:
> Hi,
>
> I wish to support synthetic items with specific child descriptors, in
> the Model Explorer, while using EMFStore for persistence.
>
> Is there a proper way to extend the EMFStoreUIProvider in order to
> override the fillContextMenu() method? The point would be to check for
> instances of said synthetic items, and act accordingly to fetch their
> list of child descriptors.
>
> From what I could find out, the provider name has to match the
> EMFStoreProvider's in order to get share/commit/etc. functionality in a
> 3.x application. I'm concerned about contributing my own providers with
> a name that clashes with the EMFStore ones.
>
> Thanks very much once again for your much appreciated support.
>
> -Olivier
>
> P.S.: if it were proper for you to add an "else if (element instanceof
> IChildCreationExtender)" in the
> DefaultUIProvider#fillContextMenuForProject() method, I could submit a
> bugzilla for it. Anyone wishing to use synthetic items could then
> simply implement that interface.
Re: [ECP] How to properly extend EMFStoreUIProvider [message #1391726 is a reply to message #1391693] Tue, 01 July 2014 10:09 Go to previous messageGo to next message
Annamalai Mising name is currently offline Annamalai Mising nameFriend
Messages: 126
Registered: July 2009
Senior Member
Hi Oliver

I have tried to do that for my Model Explorer. I followed this link Have
a look http://www.eclipse.org/forums/index.php/t/230983/

But i also need to customise the ContextMenu based on the selected
Synthetic node and didnt find any facility to achieve the same.

Regards
Malai

On 7/1/2014 2:38 PM, Jonas Helming wrote:
> Hi Oliver,
>
> the UI Provider uses the content provider, which are generated by EMF
> (edit bundle). So, I would adapt the item provider in order to change
> the structure of the tree.
>
> Best regards
>
> Jonas
>
> Am 30.06.2014 19:08, schrieb Olivier Labrosse:
>> Hi,
>>
>> I wish to support synthetic items with specific child descriptors, in
>> the Model Explorer, while using EMFStore for persistence.
>>
>> Is there a proper way to extend the EMFStoreUIProvider in order to
>> override the fillContextMenu() method? The point would be to check for
>> instances of said synthetic items, and act accordingly to fetch their
>> list of child descriptors.
>>
>> From what I could find out, the provider name has to match the
>> EMFStoreProvider's in order to get share/commit/etc. functionality in a
>> 3.x application. I'm concerned about contributing my own providers with
>> a name that clashes with the EMFStore ones.
>>
>> Thanks very much once again for your much appreciated support.
>>
>> -Olivier
>>
>> P.S.: if it were proper for you to add an "else if (element instanceof
>> IChildCreationExtender)" in the
>> DefaultUIProvider#fillContextMenuForProject() method, I could submit a
>> bugzilla for it. Anyone wishing to use synthetic items could then
>> simply implement that interface.
>
Re: [ECP] How to properly extend EMFStoreUIProvider [message #1391891 is a reply to message #1391726] Tue, 01 July 2014 15:09 Go to previous messageGo to next message
Olivier Labrosse is currently offline Olivier LabrosseFriend
Messages: 49
Registered: November 2011
Member
Thank you Malai and Jonas for your replies.

Thing is, the problem is not in the tree structure. You'll notice I suggested a possible fix to my issue that involved changing the context menu; herein lies the problem.

The context menu is already being filled with "create child" menu items (see ModelExplorerView#fillContextMenu()), and I intend to make use of this for synthetic items as well as EObjects, if only for consistence sake. As you know, synthetic items aren't EObjects, and although the EMF book suggests making them into full-fledged ItemProviders, they can be simple POJOs if the Viewer's ContentProvider is your own custom implementation that supports them.

What I'm suggesting is that any UIProvider, or at least the DefaultUIProvider, should support synthetic item child descriptors. Maybe, instead of what I previously suggested, it's the ChildrenDescriptorCollector that should accept any Object, and deal with both EObjects and IChildCreationExtenders. All I know is that, without this, I would have to create my own view, which is overkill for such a simple requirement.

So I guess my question is threefold: Am I missing something? If not, should we update DefaultUIProvider and/or ChildrenDescriptorCollector in order to support child descriptors coming from synthetic items? And if not that either, then is it safe to simply contribute an extension of EMFStoreUIProvider or will it break patterns due to identical names?

Thanks again!

Annamalai Chockalingam wrote on Tue, 01 July 2014 06:09
Hi Oliver

I have tried to do that for my Model Explorer. I followed this link Have
a look http://www.eclipse.org/forums/index.php/t/230983/

But i also need to customise the ContextMenu based on the selected
Synthetic node and didnt find any facility to achieve the same.

Regards
Malai

On 7/1/2014 2:38 PM, Jonas Helming wrote:
> Hi Oliver,
>
> the UI Provider uses the content provider, which are generated by EMF
> (edit bundle). So, I would adapt the item provider in order to change
> the structure of the tree.
>
> Best regards
>
> Jonas
>
> Am 30.06.2014 19:08, schrieb Olivier Labrosse:
>> Hi,
>>
>> I wish to support synthetic items with specific child descriptors, in
>> the Model Explorer, while using EMFStore for persistence.
>>
>> Is there a proper way to extend the EMFStoreUIProvider in order to
>> override the fillContextMenu() method? The point would be to check for
>> instances of said synthetic items, and act accordingly to fetch their
>> list of child descriptors.
>>
>> From what I could find out, the provider name has to match the
>> EMFStoreProvider's in order to get share/commit/etc. functionality in a
>> 3.x application. I'm concerned about contributing my own providers with
>> a name that clashes with the EMFStore ones.
>>
>> Thanks very much once again for your much appreciated support.
>>
>> -Olivier
>>
>> P.S.: if it were proper for you to add an "else if (element instanceof
>> IChildCreationExtender)" in the
>> DefaultUIProvider#fillContextMenuForProject() method, I could submit a
>> bugzilla for it. Anyone wishing to use synthetic items could then
>> simply implement that interface.
>

Re: [ECP] How to properly extend EMFStoreUIProvider [message #1392384 is a reply to message #1391891] Wed, 02 July 2014 08:47 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi,

sorry, I misunderstood your question in the first place. An simple
alternative would be to add the menu entries you need using the default
Eclipse menu extension point. Have you tried that?

Best regards

Jonas

Am 01.07.2014 17:09, schrieb Olivier Labrosse:
> Thank you Malai and Jonas for your replies.
>
> Thing is, the problem is not in the tree structure. You'll notice I
> suggested a possible fix to my issue that involved changing the context
> menu; herein lies the problem.
>
> The context menu is already being filled with "create child" menu items
> (see ModelExplorerView#fillContextMenu()), and I intend to make use of
> this for synthetic items as well as EObjects, if only for consistence
> sake. As you know, synthetic items aren't EObjects, and although the
> EMF book suggests making them into full-fledged ItemProviders, they can
> be simple POJOs if the Viewer's ContentProvider is your own custom
> implementation that supports them.
>
> What I'm suggesting is that any UIProvider, or at least the
> DefaultUIProvider, should support synthetic item child descriptors.
> Maybe, instead of what I previously suggested, it's the
> ChildrenDescriptorCollector that should accept any Object, and deal with
> both EObjects and IChildCreationExtenders. All I know is that, without
> this, I would have to create my own view, which is overkill for such a
> simple requirement.
>
> So I guess my question is threefold: Am I missing something? If not,
> should we update DefaultUIProvider and/or ChildrenDescriptorCollector in
> order to support child descriptors coming from synthetic items? And if
> not that either, then is it safe to simply contribute an extension of
> EMFStoreUIProvider or will it break patterns due to identical names?
>
> Thanks again!
>
> Annamalai Chockalingam wrote on Tue, 01 July 2014 06:09
>> Hi Oliver
>>
>> I have tried to do that for my Model Explorer. I followed this link
>> Have a look http://www.eclipse.org/forums/index.php/t/230983/
>>
>> But i also need to customise the ContextMenu based on the selected
>> Synthetic node and didnt find any facility to achieve the same.
>>
>> Regards
>> Malai
>>
>> On 7/1/2014 2:38 PM, Jonas Helming wrote:
>> > Hi Oliver,
>> >
>> > the UI Provider uses the content provider, which are generated by EMF
>> > (edit bundle). So, I would adapt the item provider in order to change
>> > the structure of the tree.
>> >
>> > Best regards
>> >
>> > Jonas
>> >
>> > Am 30.06.2014 19:08, schrieb Olivier Labrosse:
>> >> Hi,
>> >>
>> >> I wish to support synthetic items with specific child descriptors, in
>> >> the Model Explorer, while using EMFStore for persistence.
>> >>
>> >> Is there a proper way to extend the EMFStoreUIProvider in order to
>> >> override the fillContextMenu() method? The point would be to check
>> for
>> >> instances of said synthetic items, and act accordingly to fetch their
>> >> list of child descriptors.
>> >>
>> >> From what I could find out, the provider name has to match the
>> >> EMFStoreProvider's in order to get share/commit/etc. functionality
>> in a
>> >> 3.x application. I'm concerned about contributing my own providers
>> with
>> >> a name that clashes with the EMFStore ones.
>> >>
>> >> Thanks very much once again for your much appreciated support.
>> >>
>> >> -Olivier
>> >>
>> >> P.S.: if it were proper for you to add an "else if (element instanceof
>> >> IChildCreationExtender)" in the
>> >> DefaultUIProvider#fillContextMenuForProject() method, I could submit a
>> >> bugzilla for it. Anyone wishing to use synthetic items could then
>> >> simply implement that interface.
>> >
>
>
Re: [ECP] How to properly extend EMFStoreUIProvider [message #1392475 is a reply to message #1392384] Wed, 02 July 2014 11:44 Go to previous messageGo to next message
Annamalai Mising name is currently offline Annamalai Mising nameFriend
Messages: 126
Registered: July 2009
Senior Member
Hello Jonas

Then i have a question, i have overriden fillContextMenu when i was
extending ModelExplorerView and i have given my own actions to it.

But my synthetic nodes that i introduced in my itemprovider like for
example in ECP Example, user > tasks[Synthetic Element] > task

Now when i right click on tasks, i cannot add Task. I still need to
right click on User to create a Task.

I would want to know how to i contribute a Right Click on a Synthetic
element using the Item Providers. Coz you are generating the ContextMenu
for new item creation using the NewChildDescriptors in the Item providers.

Correct me if i am wrong.

Regards
Malai

On 7/2/2014 2:17 PM, Jonas Helming wrote:
> Hi,
>
> sorry, I misunderstood your question in the first place. An simple
> alternative would be to add the menu entries you need using the default
> Eclipse menu extension point. Have you tried that?
>
> Best regards
>
> Jonas
>
> Am 01.07.2014 17:09, schrieb Olivier Labrosse:
>> Thank you Malai and Jonas for your replies.
>>
>> Thing is, the problem is not in the tree structure. You'll notice I
>> suggested a possible fix to my issue that involved changing the context
>> menu; herein lies the problem.
>>
>> The context menu is already being filled with "create child" menu items
>> (see ModelExplorerView#fillContextMenu()), and I intend to make use of
>> this for synthetic items as well as EObjects, if only for consistence
>> sake. As you know, synthetic items aren't EObjects, and although the
>> EMF book suggests making them into full-fledged ItemProviders, they can
>> be simple POJOs if the Viewer's ContentProvider is your own custom
>> implementation that supports them.
>>
>> What I'm suggesting is that any UIProvider, or at least the
>> DefaultUIProvider, should support synthetic item child descriptors.
>> Maybe, instead of what I previously suggested, it's the
>> ChildrenDescriptorCollector that should accept any Object, and deal with
>> both EObjects and IChildCreationExtenders. All I know is that, without
>> this, I would have to create my own view, which is overkill for such a
>> simple requirement.
>>
>> So I guess my question is threefold: Am I missing something? If not,
>> should we update DefaultUIProvider and/or ChildrenDescriptorCollector in
>> order to support child descriptors coming from synthetic items? And if
>> not that either, then is it safe to simply contribute an extension of
>> EMFStoreUIProvider or will it break patterns due to identical names?
>>
>> Thanks again!
>>
>> Annamalai Chockalingam wrote on Tue, 01 July 2014 06:09
>>> Hi Oliver
>>>
>>> I have tried to do that for my Model Explorer. I followed this link
>>> Have a look http://www.eclipse.org/forums/index.php/t/230983/
>>>
>>> But i also need to customise the ContextMenu based on the selected
>>> Synthetic node and didnt find any facility to achieve the same.
>>>
>>> Regards
>>> Malai
>>>
>>> On 7/1/2014 2:38 PM, Jonas Helming wrote:
>>>> Hi Oliver,
>>>>
>>>> the UI Provider uses the content provider, which are generated by EMF
>>>> (edit bundle). So, I would adapt the item provider in order to change
>>>> the structure of the tree.
>>>>
>>>> Best regards
>>>>
>>>> Jonas
>>>>
>>>> Am 30.06.2014 19:08, schrieb Olivier Labrosse:
>>>>> Hi,
>>>>>
>>>>> I wish to support synthetic items with specific child descriptors, in
>>>>> the Model Explorer, while using EMFStore for persistence.
>>>>>
>>>>> Is there a proper way to extend the EMFStoreUIProvider in order to
>>>>> override the fillContextMenu() method? The point would be to check
>>> for
>>>>> instances of said synthetic items, and act accordingly to fetch their
>>>>> list of child descriptors.
>>>>>
>>>>> From what I could find out, the provider name has to match the
>>>>> EMFStoreProvider's in order to get share/commit/etc. functionality
>>> in a
>>>>> 3.x application. I'm concerned about contributing my own providers
>>> with
>>>>> a name that clashes with the EMFStore ones.
>>>>>
>>>>> Thanks very much once again for your much appreciated support.
>>>>>
>>>>> -Olivier
>>>>>
>>>>> P.S.: if it were proper for you to add an "else if (element instanceof
>>>>> IChildCreationExtender)" in the
>>>>> DefaultUIProvider#fillContextMenuForProject() method, I could submit a
>>>>> bugzilla for it. Anyone wishing to use synthetic items could then
>>>>> simply implement that interface.
>>>>
>>
>>
>
Re: [ECP] How to properly extend EMFStoreUIProvider [message #1392583 is a reply to message #1392384] Wed, 02 July 2014 14:43 Go to previous messageGo to next message
Olivier Labrosse is currently offline Olivier LabrosseFriend
Messages: 49
Registered: November 2011
Member
I thought about it, but there are two things I don't like about it. First, it adds another 3.x extension contribution I'll have to deal with once we switch to E4 completely. Second, I'm not 100% sure I can place this extension exactly where the items appear for EObjects, and I would want that because it makes for a consistent UI. I might give it a try with a "popup:org.eclipse.emf.ecp.ui.ModelExplorerView?before=global_additions" locationURI.

Honestly, though, I really think the DefaultUIProvider should deal with the pretty standard concept of synthetic tree items, especially since the EMF book covers it. Rather than trying out the menu contribution solution, I would instead create a bugzilla and provide a suggested patch, which is now obvious to me it should rely on the editing domain to get child descriptors for whatever element is currently selected (without changing the EObject case here).

Jonas Helming wrote on Wed, 02 July 2014 04:47
Hi,

sorry, I misunderstood your question in the first place. An simple
alternative would be to add the menu entries you need using the default
Eclipse menu extension point. Have you tried that?

Best regards

Jonas

Am 01.07.2014 17:09, schrieb Olivier Labrosse:
> Thank you Malai and Jonas for your replies.
>
> Thing is, the problem is not in the tree structure. You'll notice I
> suggested a possible fix to my issue that involved changing the context
> menu; herein lies the problem.
>
> The context menu is already being filled with "create child" menu items
> (see ModelExplorerView#fillContextMenu()), and I intend to make use of
> this for synthetic items as well as EObjects, if only for consistence
> sake. As you know, synthetic items aren't EObjects, and although the
> EMF book suggests making them into full-fledged ItemProviders, they can
> be simple POJOs if the Viewer's ContentProvider is your own custom
> implementation that supports them.
>
> What I'm suggesting is that any UIProvider, or at least the
> DefaultUIProvider, should support synthetic item child descriptors.
> Maybe, instead of what I previously suggested, it's the
> ChildrenDescriptorCollector that should accept any Object, and deal with
> both EObjects and IChildCreationExtenders. All I know is that, without
> this, I would have to create my own view, which is overkill for such a
> simple requirement.
>
> So I guess my question is threefold: Am I missing something? If not,
> should we update DefaultUIProvider and/or ChildrenDescriptorCollector in
> order to support child descriptors coming from synthetic items? And if
> not that either, then is it safe to simply contribute an extension of
> EMFStoreUIProvider or will it break patterns due to identical names?
>
> Thanks again!
>
> Annamalai Chockalingam wrote on Tue, 01 July 2014 06:09
>> Hi Oliver
>>
>> I have tried to do that for my Model Explorer. I followed this link
>> Have a look http://www.eclipse.org/forums/index.php/t/230983/
>>
>> But i also need to customise the ContextMenu based on the selected
>> Synthetic node and didnt find any facility to achieve the same.
>>
>> Regards
>> Malai
>>
>> On 7/1/2014 2:38 PM, Jonas Helming wrote:
>> > Hi Oliver,
>> >
>> > the UI Provider uses the content provider, which are generated by EMF
>> > (edit bundle). So, I would adapt the item provider in order to change
>> > the structure of the tree.
>> >
>> > Best regards
>> >
>> > Jonas
>> >
>> > Am 30.06.2014 19:08, schrieb Olivier Labrosse:
>> >> Hi,
>> >>
>> >> I wish to support synthetic items with specific child descriptors, in
>> >> the Model Explorer, while using EMFStore for persistence.
>> >>
>> >> Is there a proper way to extend the EMFStoreUIProvider in order to
>> >> override the fillContextMenu() method? The point would be to check
>> for
>> >> instances of said synthetic items, and act accordingly to fetch their
>> >> list of child descriptors.
>> >>
>> >> From what I could find out, the provider name has to match the
>> >> EMFStoreProvider's in order to get share/commit/etc. functionality
>> in a
>> >> 3.x application. I'm concerned about contributing my own providers
>> with
>> >> a name that clashes with the EMFStore ones.
>> >>
>> >> Thanks very much once again for your much appreciated support.
>> >>
>> >> -Olivier
>> >>
>> >> P.S.: if it were proper for you to add an "else if (element instanceof
>> >> IChildCreationExtender)" in the
>> >> DefaultUIProvider#fillContextMenuForProject() method, I could submit a
>> >> bugzilla for it. Anyone wishing to use synthetic items could then
>> >> simply implement that interface.
>> >
>
>

Re: [ECP] How to properly extend EMFStoreUIProvider [message #1392587 is a reply to message #1392475] Wed, 02 July 2014 14:49 Go to previous messageGo to next message
Olivier Labrosse is currently offline Olivier LabrosseFriend
Messages: 49
Registered: November 2011
Member
Malai,

If you followed the EMF book, your synthetic element should be an ItemProviderAdapter, which means you can override the collectNewChildDescriptors() method where you can add the relevant descriptors for your case.

Consider customizing the UserItemProvider to remove those descriptors, so the option only shows up on the synthetic element, to prevent any possible confusion as to what the difference would be between creating them at one place vs. the other.

Regards,

Olivier
Annamalai Chockalingam wrote on Wed, 02 July 2014 07:44
Hello Jonas

Then i have a question, i have overriden fillContextMenu when i was
extending ModelExplorerView and i have given my own actions to it.

But my synthetic nodes that i introduced in my itemprovider like for
example in ECP Example, user > tasks[Synthetic Element] > task

Now when i right click on tasks, i cannot add Task. I still need to
right click on User to create a Task.

I would want to know how to i contribute a Right Click on a Synthetic
element using the Item Providers. Coz you are generating the ContextMenu
for new item creation using the NewChildDescriptors in the Item providers.

Correct me if i am wrong.

Regards
Malai

On 7/2/2014 2:17 PM, Jonas Helming wrote:
> Hi,
>
> sorry, I misunderstood your question in the first place. An simple
> alternative would be to add the menu entries you need using the default
> Eclipse menu extension point. Have you tried that?
>
> Best regards
>
> Jonas
>
> Am 01.07.2014 17:09, schrieb Olivier Labrosse:
>> Thank you Malai and Jonas for your replies.
>>
>> Thing is, the problem is not in the tree structure. You'll notice I
>> suggested a possible fix to my issue that involved changing the context
>> menu; herein lies the problem.
>>
>> The context menu is already being filled with "create child" menu items
>> (see ModelExplorerView#fillContextMenu()), and I intend to make use of
>> this for synthetic items as well as EObjects, if only for consistence
>> sake. As you know, synthetic items aren't EObjects, and although the
>> EMF book suggests making them into full-fledged ItemProviders, they can
>> be simple POJOs if the Viewer's ContentProvider is your own custom
>> implementation that supports them.
>>
>> What I'm suggesting is that any UIProvider, or at least the
>> DefaultUIProvider, should support synthetic item child descriptors.
>> Maybe, instead of what I previously suggested, it's the
>> ChildrenDescriptorCollector that should accept any Object, and deal with
>> both EObjects and IChildCreationExtenders. All I know is that, without
>> this, I would have to create my own view, which is overkill for such a
>> simple requirement.
>>
>> So I guess my question is threefold: Am I missing something? If not,
>> should we update DefaultUIProvider and/or ChildrenDescriptorCollector in
>> order to support child descriptors coming from synthetic items? And if
>> not that either, then is it safe to simply contribute an extension of
>> EMFStoreUIProvider or will it break patterns due to identical names?
>>
>> Thanks again!
>>
>> Annamalai Chockalingam wrote on Tue, 01 July 2014 06:09
>>> Hi Oliver
>>>
>>> I have tried to do that for my Model Explorer. I followed this link
>>> Have a look http://www.eclipse.org/forums/index.php/t/230983/
>>>
>>> But i also need to customise the ContextMenu based on the selected
>>> Synthetic node and didnt find any facility to achieve the same.
>>>
>>> Regards
>>> Malai
>>>
>>> On 7/1/2014 2:38 PM, Jonas Helming wrote:
>>>> Hi Oliver,
>>>>
>>>> the UI Provider uses the content provider, which are generated by EMF
>>>> (edit bundle). So, I would adapt the item provider in order to change
>>>> the structure of the tree.
>>>>
>>>> Best regards
>>>>
>>>> Jonas
>>>>
>>>> Am 30.06.2014 19:08, schrieb Olivier Labrosse:
>>>>> Hi,
>>>>>
>>>>> I wish to support synthetic items with specific child descriptors, in
>>>>> the Model Explorer, while using EMFStore for persistence.
>>>>>
>>>>> Is there a proper way to extend the EMFStoreUIProvider in order to
>>>>> override the fillContextMenu() method? The point would be to check
>>> for
>>>>> instances of said synthetic items, and act accordingly to fetch their
>>>>> list of child descriptors.
>>>>>
>>>>> From what I could find out, the provider name has to match the
>>>>> EMFStoreProvider's in order to get share/commit/etc. functionality
>>> in a
>>>>> 3.x application. I'm concerned about contributing my own providers
>>> with
>>>>> a name that clashes with the EMFStore ones.
>>>>>
>>>>> Thanks very much once again for your much appreciated support.
>>>>>
>>>>> -Olivier
>>>>>
>>>>> P.S.: if it were proper for you to add an "else if (element instanceof
>>>>> IChildCreationExtender)" in the
>>>>> DefaultUIProvider#fillContextMenuForProject() method, I could submit a
>>>>> bugzilla for it. Anyone wishing to use synthetic items could then
>>>>> simply implement that interface.
>>>>
>>
>>
>

Re: [ECP] How to properly extend EMFStoreUIProvider [message #1392695 is a reply to message #1392587] Wed, 02 July 2014 18:12 Go to previous messageGo to next message
Olivier Labrosse is currently offline Olivier LabrosseFriend
Messages: 49
Registered: November 2011
Member
I created a bugzilla in hope of seeing this functionality supported in ECP, out of the box.
Re: [ECP] How to properly extend EMFStoreUIProvider [message #1393053 is a reply to message #1392587] Thu, 03 July 2014 07:10 Go to previous messageGo to next message
Annamalai Mising name is currently offline Annamalai Mising nameFriend
Messages: 126
Registered: July 2009
Senior Member
Hello Olivier

I have already done that. UserItemProvider now doesnt hav support for
NewChildDescriptor for Child and only my TasksItemProvider [Synthetic
Element for Tasks] returns Task as part of NewChildDescriptor method.
But i suppose ECP isnt considering the same.

@Jonas : Correct me if i am wrong. Not sure if this is a bug in ECP.

Regards
Malai

On 7/2/2014 8:19 PM, Olivier Labrosse wrote:
> Malai,
>
> If you followed the EMF book, your synthetic element should be an
> ItemProviderAdapter, which means you can override the
> collectNewChildDescriptors() method where you can add the relevant
> descriptors for your case.
>
> Consider customizing the UserItemProvider to remove those descriptors,
> so the option only shows up on the synthetic element, to prevent any
> possible confusion as to what the difference would be between creating
> them at one place vs. the other.
>
> Regards,
>
> Olivier
> Annamalai Chockalingam wrote on Wed, 02 July 2014 07:44
>> Hello Jonas
>>
>> Then i have a question, i have overriden fillContextMenu when i was
>> extending ModelExplorerView and i have given my own actions to it.
>>
>> But my synthetic nodes that i introduced in my itemprovider like for
>> example in ECP Example, user > tasks[Synthetic Element] > task
>>
>> Now when i right click on tasks, i cannot add Task. I still need to
>> right click on User to create a Task.
>>
>> I would want to know how to i contribute a Right Click on a Synthetic
>> element using the Item Providers. Coz you are generating the
>> ContextMenu for new item creation using the NewChildDescriptors in the
>> Item providers.
>>
>> Correct me if i am wrong.
>>
>> Regards
>> Malai
>>
>> On 7/2/2014 2:17 PM, Jonas Helming wrote:
>> > Hi,
>> >
>> > sorry, I misunderstood your question in the first place. An simple
>> > alternative would be to add the menu entries you need using the default
>> > Eclipse menu extension point. Have you tried that?
>> >
>> > Best regards
>> >
>> > Jonas
>> >
>> > Am 01.07.2014 17:09, schrieb Olivier Labrosse:
>> >> Thank you Malai and Jonas for your replies.
>> >>
>> >> Thing is, the problem is not in the tree structure. You'll notice I
>> >> suggested a possible fix to my issue that involved changing the
>> context
>> >> menu; herein lies the problem.
>> >>
>> >> The context menu is already being filled with "create child" menu
>> items
>> >> (see ModelExplorerView#fillContextMenu()), and I intend to make use of
>> >> this for synthetic items as well as EObjects, if only for consistence
>> >> sake. As you know, synthetic items aren't EObjects, and although the
>> >> EMF book suggests making them into full-fledged ItemProviders, they
>> can
>> >> be simple POJOs if the Viewer's ContentProvider is your own custom
>> >> implementation that supports them.
>> >>
>> >> What I'm suggesting is that any UIProvider, or at least the
>> >> DefaultUIProvider, should support synthetic item child descriptors.
>> >> Maybe, instead of what I previously suggested, it's the
>> >> ChildrenDescriptorCollector that should accept any Object, and deal
>> with
>> >> both EObjects and IChildCreationExtenders. All I know is that,
>> without
>> >> this, I would have to create my own view, which is overkill for such a
>> >> simple requirement.
>> >>
>> >> So I guess my question is threefold: Am I missing something? If not,
>> >> should we update DefaultUIProvider and/or
>> ChildrenDescriptorCollector in
>> >> order to support child descriptors coming from synthetic items?
>> And if
>> >> not that either, then is it safe to simply contribute an extension of
>> >> EMFStoreUIProvider or will it break patterns due to identical names?
>> >>
>> >> Thanks again!
>> >>
>> >> Annamalai Chockalingam wrote on Tue, 01 July 2014 06:09
>> >>> Hi Oliver
>> >>>
>> >>> I have tried to do that for my Model Explorer. I followed this link
>> >>> Have a look http://www.eclipse.org/forums/index.php/t/230983/
>> >>>
>> >>> But i also need to customise the ContextMenu based on the selected
>> >>> Synthetic node and didnt find any facility to achieve the same.
>> >>>
>> >>> Regards
>> >>> Malai
>> >>>
>> >>> On 7/1/2014 2:38 PM, Jonas Helming wrote:
>> >>>> Hi Oliver,
>> >>>>
>> >>>> the UI Provider uses the content provider, which are generated by
>> EMF
>> >>>> (edit bundle). So, I would adapt the item provider in order to
>> change
>> >>>> the structure of the tree.
>> >>>>
>> >>>> Best regards
>> >>>>
>> >>>> Jonas
>> >>>>
>> >>>> Am 30.06.2014 19:08, schrieb Olivier Labrosse:
>> >>>>> Hi,
>> >>>>>
>> >>>>> I wish to support synthetic items with specific child
>> descriptors, in
>> >>>>> the Model Explorer, while using EMFStore for persistence.
>> >>>>>
>> >>>>> Is there a proper way to extend the EMFStoreUIProvider in order to
>> >>>>> override the fillContextMenu() method? The point would be to check
>> >>> for
>> >>>>> instances of said synthetic items, and act accordingly to fetch
>> their
>> >>>>> list of child descriptors.
>> >>>>>
>> >>>>> From what I could find out, the provider name has to match the
>> >>>>> EMFStoreProvider's in order to get share/commit/etc. functionality
>> >>> in a
>> >>>>> 3.x application. I'm concerned about contributing my own providers
>> >>> with
>> >>>>> a name that clashes with the EMFStore ones.
>> >>>>>
>> >>>>> Thanks very much once again for your much appreciated support.
>> >>>>>
>> >>>>> -Olivier
>> >>>>>
>> >>>>> P.S.: if it were proper for you to add an "else if (element
>> instanceof
>> >>>>> IChildCreationExtender)" in the
>> >>>>> DefaultUIProvider#fillContextMenuForProject() method, I could
>> submit a
>> >>>>> bugzilla for it. Anyone wishing to use synthetic items could then
>> >>>>> simply implement that interface.
>> >>>>
>> >>
>> >>
>> >
>
>
Re: [ECP] How to properly extend EMFStoreUIProvider [message #1393306 is a reply to message #1393053] Thu, 03 July 2014 15:35 Go to previous messageGo to next message
Olivier Labrosse is currently offline Olivier LabrosseFriend
Messages: 49
Registered: November 2011
Member
Malai,

Try placing a breakpoint in DefaultUIProvider#fillContextMenu() to get a better understanding of what's happening. You could also take a look at my suggested patch in the bugzilla I linked previously.

Regards,

Olivier
Re: [ECP] How to properly extend EMFStoreUIProvider [message #1393422 is a reply to message #1393306] Thu, 03 July 2014 19:39 Go to previous messageGo to next message
Annamalai Mising name is currently offline Annamalai Mising nameFriend
Messages: 126
Registered: July 2009
Senior Member
Hello Olivier

Thanks for your point below. I did as recommended and put a breakpoint
inside fillContextMenu() and realised that it goes into
fillContextMenuforProject() which inturn checks for EObject. But in our
case the Sythentic Object that is selected is ItemProviderAdapter.
Therefore ContextMenu is not filled.

Looks like a Bug in ECP.

Regards
Malai


On 7/3/2014 9:05 PM, Olivier Labrosse wrote:
> Malai,
>
> Try placing a breakpoint in DefaultUIProvider#fillContextMenu() to get a
> better understanding of what's happening. You could also take a look at
> my suggested patch in the bugzilla I linked previously.
>
> Regards,
>
> Olivier
Re: [ECP] How to properly extend EMFStoreUIProvider [message #1393425 is a reply to message #1393422] Thu, 03 July 2014 19:42 Go to previous message
Annamalai Mising name is currently offline Annamalai Mising nameFriend
Messages: 126
Registered: July 2009
Senior Member
Hello Olivier

I totally agree with your patch. This is the required code that is
missing for filling the context menu for Synthetic Elements in the Model
Explorer.

Regards
Malai

On 7/4/2014 1:09 AM, Annamalai wrote:
> Hello Olivier
>
> Thanks for your point below. I did as recommended and put a breakpoint
> inside fillContextMenu() and realised that it goes into
> fillContextMenuforProject() which inturn checks for EObject. But in our
> case the Sythentic Object that is selected is ItemProviderAdapter.
> Therefore ContextMenu is not filled.
>
> Looks like a Bug in ECP.
>
> Regards
> Malai
>
>
> On 7/3/2014 9:05 PM, Olivier Labrosse wrote:
>> Malai,
>>
>> Try placing a breakpoint in DefaultUIProvider#fillContextMenu() to get a
>> better understanding of what's happening. You could also take a look at
>> my suggested patch in the bugzilla I linked previously.
>>
>> Regards,
>>
>> Olivier
>
Previous Topic:TEXO and Ecore tools 2.0 Eclipse LUNA
Next Topic:[Teneo] Teneo ignores mappedBy in OneToMany and created ForeignKey
Goto Forum:
  


Current Time: Mon Apr 12 13:55:56 GMT 2021

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

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

Back to the top