Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [ECP] Multiple views for the same EObject
[ECP] Multiple views for the same EObject [message #1396093] Mon, 07 July 2014 21:38 Go to next message
Olivier Labrosse is currently offline Olivier LabrosseFriend
Messages: 49
Registered: November 2011
Member
Hi,

I'm starting to get the hang of using ECP and EMF Forms, and customizing everything. One problem I just came across: not being able to open two different views on the same EObject, depending on context.

My understanding is that you would normally decouple views from explorers and editors through the use of ViewProviderHelper, which handles finding the view provider in the respective extension point. For that reason, I would consider it bad practice to fetch a VView object directly and creating a ViewModelContext with it.

I guess my question is, what is the proper way of providing more than one view for the same EObject and having them all accessible based on context? (as opposed to an arbitrary priority index)

Your support is always much appreciated.

Regards,
Olivier
Re: [ECP] Multiple views for the same EObject [message #1396367 is a reply to message #1396093] Tue, 08 July 2014 07:48 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi Olivier,

you can either just call the ECPSWTViewRenderer explicitly with a view
model: render(composite, domainObject, viewmodel)
or provide your own View Model provider (it is exchangable)

Best Regards

Jonas

Am 07.07.2014 23:38, schrieb Olivier Labrosse:
> Hi,
>
> I'm starting to get the hang of using ECP and EMF Forms, and customizing
> everything. One problem I just came across: not being able to open two
> different views on the same EObject, depending on context.
>
> My understanding is that you would normally decouple views from
> explorers and editors through the use of ViewProviderHelper, which
> handles finding the view provider in the respective extension point.
> For that reason, I would consider it bad practice to fetch a VView
> object directly and creating a ViewModelContext with it.
>
> I guess my question is, what is the proper way of providing more than
> one view for the same EObject and having them all accessible based on
> context? (as opposed to an arbitrary priority index)
>
> Your support is always much appreciated.
>
> Regards,
> Olivier
Re: [ECP] Multiple views for the same EObject [message #1396651 is a reply to message #1396367] Tue, 08 July 2014 15:54 Go to previous messageGo to next message
Olivier Labrosse is currently offline Olivier LabrosseFriend
Messages: 49
Registered: November 2011
Member
Thank you Jonas.

Am I right to think even if I provided my own IViewProvider implementation, there's no way for it to know which view to open, due to the API not supporting context predicates?

If I need to hardcode a call to my IViewProvider implementation through a non-IViewProvider method, I believe I'm better off using a simple helper to fetch a VView based on context, and call on ECPSWTViewRenderer as you suggested.

For the record, one thing I don't like about this (not to say I don't like ECP, I really love it) is that I can't model a simple TreeMasterDetail view where the Detail side is not the "normal" view for the selected EObject. I have to hardcode the former in order to hardcode the call that will render the latter. That is unless I'm missing something?

Thanks again for your help!

Olivier

Jonas Helming wrote on Tue, 08 July 2014 03:48
Hi Olivier,

you can either just call the ECPSWTViewRenderer explicitly with a view
model: render(composite, domainObject, viewmodel)
or provide your own View Model provider (it is exchangable)

Best Regards

Jonas

Am 07.07.2014 23:38, schrieb Olivier Labrosse:
> Hi,
>
> I'm starting to get the hang of using ECP and EMF Forms, and customizing
> everything. One problem I just came across: not being able to open two
> different views on the same EObject, depending on context.
>
> My understanding is that you would normally decouple views from
> explorers and editors through the use of ViewProviderHelper, which
> handles finding the view provider in the respective extension point.
> For that reason, I would consider it bad practice to fetch a VView
> object directly and creating a ViewModelContext with it.
>
> I guess my question is, what is the proper way of providing more than
> one view for the same EObject and having them all accessible based on
> context? (as opposed to an arbitrary priority index)
>
> Your support is always much appreciated.
>
> Regards,
> Olivier

Re: [ECP] Multiple views for the same EObject [message #1398278 is a reply to message #1396651] Thu, 10 July 2014 22:18 Go to previous messageGo to next message
Olivier Labrosse is currently offline Olivier LabrosseFriend
Messages: 49
Registered: November 2011
Member
I would like to make the following proposition:

Because this is a must-have feature for us at Benchmark Canada, and we are very much willing to contribute to this project, how about we make the necessary modifications to the MEEditor and relevant components to allow propagating "domain context information" not only to the IViewProviders but also to AbstractMEEditorPages?

Here's a quick rundown of modifications with explanations:

- ECPHandlerHelper gets an overloaded openModelElement(Object, ECPProject, Object) method to accept the domain context object (below referred to as DCO) containing domain-specific information.

- ECPModelElementOpener gets an equivalent overload to the same method, allowing the default EditorModelElementOpener to pass the DCO to the EditorContext.

- ECPEditorContext gets a getter for the DCO, and the default EditorContext gets an overloaded constructor to accept said DCO.

- ViewProviderHelper gets an overloaded getView(EObject, Object) method to accept the DCO and pass it along to the IViewProvider.

- IViewProvider gets overloaded canRender(EObject, Object) and generate(EObject, Object) methods to accept the DCO. Specialized providers would handle the same EObject with a higher priority, but canRender() would return false if the DCO doesn't apply to the provider's purpose.

- MEEditorPage gets updated to pass the DCO to ViewProviderHelper.getView(EObject, Object), at which point the DCO has served its purpose. AbstractMEEditorPage extensions would be able to get the DCO from the ECPEditorContext they are given.

- Of course the idea behind all the overloads is to preserve the existing API and behavior.


Regards,
Olivier
Re: [ECP] Multiple views for the same EObject [message #1398706 is a reply to message #1396651] Fri, 11 July 2014 13:06 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi,

Am 08.07.2014 17:54, schrieb Olivier Labrosse:
> Thank you Jonas.
>
> Am I right to think even if I provided my own IViewProvider
> implementation, there's no way for it to know which view to open, due to
> the API not supporting context predicates?
>
> If I need to hardcode a call to my IViewProvider implementation through
> a non-IViewProvider method, I believe I'm better off using a simple
> helper to fetch a VView based on context, and call on ECPSWTViewRenderer
> as you suggested.
Yes, that is correct..

>
> For the record, one thing I don't like about this (not to say I don't
> like ECP, I really love it) is that I can't model a simple
> TreeMasterDetail view where the Detail side is not the "normal" view for
> the selected EObject. I have to hardcode the former in order to
> hardcode the call that will render the latter. That is unless I'm
> missing something?
So what you would need is to use other view models in the details view
of the tree then if an element is displayed alone in another form?

Best Regards
Jonas

>
> Thanks again for your help!
>
> Olivier
>
> Jonas Helming wrote on Tue, 08 July 2014 03:48
>> Hi Olivier,
>>
>> you can either just call the ECPSWTViewRenderer explicitly with a view
>> model: render(composite, domainObject, viewmodel)
>> or provide your own View Model provider (it is exchangable)
>>
>> Best Regards
>>
>> Jonas
>>
>> Am 07.07.2014 23:38, schrieb Olivier Labrosse:
>> > Hi,
>> > > I'm starting to get the hang of using ECP and EMF Forms, and
>> customizing
>> > everything. One problem I just came across: not being able to open two
>> > different views on the same EObject, depending on context.
>> > > My understanding is that you would normally decouple views from
>> > explorers and editors through the use of ViewProviderHelper, which
>> > handles finding the view provider in the respective extension point.
>> > For that reason, I would consider it bad practice to fetch a VView
>> > object directly and creating a ViewModelContext with it.
>> > > I guess my question is, what is the proper way of providing more than
>> > one view for the same EObject and having them all accessible based on
>> > context? (as opposed to an arbitrary priority index)
>> > > Your support is always much appreciated.
>> > > Regards,
>> > Olivier
>
>
Re: [ECP] Multiple views for the same EObject [message #1398764 is a reply to message #1398706] Fri, 11 July 2014 14:51 Go to previous messageGo to next message
Olivier Labrosse is currently offline Olivier LabrosseFriend
Messages: 49
Registered: November 2011
Member
Exactly.

If I double-click the element in the Model Explorer, I get the full-blown view with two columns, while selecting that same element in another's TreeMasterDetail view would display a one-column view with specific information and hyperlinks.

Jonas Helming wrote on Fri, 11 July 2014 09:06
Hi,

Am 08.07.2014 17:54, schrieb Olivier Labrosse:
> Thank you Jonas.
>
> Am I right to think even if I provided my own IViewProvider
> implementation, there's no way for it to know which view to open, due to
> the API not supporting context predicates?
>
> If I need to hardcode a call to my IViewProvider implementation through
> a non-IViewProvider method, I believe I'm better off using a simple
> helper to fetch a VView based on context, and call on ECPSWTViewRenderer
> as you suggested.
Yes, that is correct..

>
> For the record, one thing I don't like about this (not to say I don't
> like ECP, I really love it) is that I can't model a simple
> TreeMasterDetail view where the Detail side is not the "normal" view for
> the selected EObject. I have to hardcode the former in order to
> hardcode the call that will render the latter. That is unless I'm
> missing something?
So what you would need is to use other view models in the details view
of the tree then if an element is displayed alone in another form?

Best Regards
Jonas

>
> Thanks again for your help!
>
> Olivier
>
> Jonas Helming wrote on Tue, 08 July 2014 03:48
>> Hi Olivier,
>>
>> you can either just call the ECPSWTViewRenderer explicitly with a view
>> model: render(composite, domainObject, viewmodel)
>> or provide your own View Model provider (it is exchangable)
>>
>> Best Regards
>>
>> Jonas
>>
>> Am 07.07.2014 23:38, schrieb Olivier Labrosse:
>> > Hi,
>> > > I'm starting to get the hang of using ECP and EMF Forms, and
>> customizing
>> > everything. One problem I just came across: not being able to open two
>> > different views on the same EObject, depending on context.
>> > > My understanding is that you would normally decouple views from
>> > explorers and editors through the use of ViewProviderHelper, which
>> > handles finding the view provider in the respective extension point.
>> > For that reason, I would consider it bad practice to fetch a VView
>> > object directly and creating a ViewModelContext with it.
>> > > I guess my question is, what is the proper way of providing more than
>> > one view for the same EObject and having them all accessible based on
>> > context? (as opposed to an arbitrary priority index)
>> > > Your support is always much appreciated.
>> > > Regards,
>> > Olivier
>
>

Re: [ECP] Multiple views for the same EObject [message #1401152 is a reply to message #1398764] Tue, 15 July 2014 07:47 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
I c, Can you open a BR for this, plz?

Am 11.07.2014 16:51, schrieb Olivier Labrosse:
> Exactly.
>
> If I double-click the element in the Model Explorer, I get the
> full-blown view with two columns, while selecting that same element in
> another's TreeMasterDetail view would display a one-column view with
> specific information and hyperlinks.
>
> Jonas Helming wrote on Fri, 11 July 2014 09:06
>> Hi,
>>
>> Am 08.07.2014 17:54, schrieb Olivier Labrosse:
>> > Thank you Jonas.
>> > > Am I right to think even if I provided my own IViewProvider
>> > implementation, there's no way for it to know which view to open,
>> due to
>> > the API not supporting context predicates?
>> > > If I need to hardcode a call to my IViewProvider implementation
>> through
>> > a non-IViewProvider method, I believe I'm better off using a simple
>> > helper to fetch a VView based on context, and call on
>> ECPSWTViewRenderer
>> > as you suggested.
>> Yes, that is correct..
>>
>> > > For the record, one thing I don't like about this (not to say I don't
>> > like ECP, I really love it) is that I can't model a simple
>> > TreeMasterDetail view where the Detail side is not the "normal" view
>> for
>> > the selected EObject. I have to hardcode the former in order to
>> > hardcode the call that will render the latter. That is unless I'm
>> > missing something?
>> So what you would need is to use other view models in the details view
>> of the tree then if an element is displayed alone in another form?
>>
>> Best Regards
>> Jonas
>>
>> > > Thanks again for your help!
>> > > Olivier
>> > > Jonas Helming wrote on Tue, 08 July 2014 03:48
>> >> Hi Olivier,
>> >>
>> >> you can either just call the ECPSWTViewRenderer explicitly with a view
>> >> model: render(composite, domainObject, viewmodel)
>> >> or provide your own View Model provider (it is exchangable)
>> >>
>> >> Best Regards
>> >>
>> >> Jonas
>> >>
>> >> Am 07.07.2014 23:38, schrieb Olivier Labrosse:
>> >> > Hi,
>> >> > > I'm starting to get the hang of using ECP and EMF Forms, and
>> >> customizing
>> >> > everything. One problem I just came across: not being able to
>> open two
>> >> > different views on the same EObject, depending on context.
>> >> > > My understanding is that you would normally decouple views from
>> >> > explorers and editors through the use of ViewProviderHelper, which
>> >> > handles finding the view provider in the respective extension point.
>> >> > For that reason, I would consider it bad practice to fetch a VView
>> >> > object directly and creating a ViewModelContext with it.
>> >> > > I guess my question is, what is the proper way of providing
>> more than
>> >> > one view for the same EObject and having them all accessible
>> based on
>> >> > context? (as opposed to an arbitrary priority index)
>> >> > > Your support is always much appreciated.
>> >> > > Regards,
>> >> > Olivier
>> > >
>
>
Re: [ECP] Multiple views for the same EObject [message #1402256 is a reply to message #1401152] Wed, 16 July 2014 19:17 Go to previous message
Olivier Labrosse is currently offline Olivier LabrosseFriend
Messages: 49
Registered: November 2011
Member
Done: https://bugs.eclipse.org/bugs/show_bug.cgi?id=439749

Thank you for looking into this, Jonas. Let us know if our proposition is fair or if it needs some revisions.

Regards,
Olivier

Jonas Helming wrote on Tue, 15 July 2014 03:47
I c, Can you open a BR for this, plz?

Am 11.07.2014 16:51, schrieb Olivier Labrosse:
> Exactly.
>
> If I double-click the element in the Model Explorer, I get the
> full-blown view with two columns, while selecting that same element in
> another's TreeMasterDetail view would display a one-column view with
> specific information and hyperlinks.
>
> Jonas Helming wrote on Fri, 11 July 2014 09:06
>> Hi,
>>
>> Am 08.07.2014 17:54, schrieb Olivier Labrosse:
>> > Thank you Jonas.
>> > > Am I right to think even if I provided my own IViewProvider
>> > implementation, there's no way for it to know which view to open,
>> due to
>> > the API not supporting context predicates?
>> > > If I need to hardcode a call to my IViewProvider implementation
>> through
>> > a non-IViewProvider method, I believe I'm better off using a simple
>> > helper to fetch a VView based on context, and call on
>> ECPSWTViewRenderer
>> > as you suggested.
>> Yes, that is correct..
>>
>> > > For the record, one thing I don't like about this (not to say I don't
>> > like ECP, I really love it) is that I can't model a simple
>> > TreeMasterDetail view where the Detail side is not the "normal" view
>> for
>> > the selected EObject. I have to hardcode the former in order to
>> > hardcode the call that will render the latter. That is unless I'm
>> > missing something?
>> So what you would need is to use other view models in the details view
>> of the tree then if an element is displayed alone in another form?
>>
>> Best Regards
>> Jonas
>>
>> > > Thanks again for your help!
>> > > Olivier
>> > > Jonas Helming wrote on Tue, 08 July 2014 03:48
>> >> Hi Olivier,
>> >>
>> >> you can either just call the ECPSWTViewRenderer explicitly with a view
>> >> model: render(composite, domainObject, viewmodel)
>> >> or provide your own View Model provider (it is exchangable)
>> >>
>> >> Best Regards
>> >>
>> >> Jonas
>> >>
>> >> Am 07.07.2014 23:38, schrieb Olivier Labrosse:
>> >> > Hi,
>> >> > > I'm starting to get the hang of using ECP and EMF Forms, and
>> >> customizing
>> >> > everything. One problem I just came across: not being able to
>> open two
>> >> > different views on the same EObject, depending on context.
>> >> > > My understanding is that you would normally decouple views from
>> >> > explorers and editors through the use of ViewProviderHelper, which
>> >> > handles finding the view provider in the respective extension point.
>> >> > For that reason, I would consider it bad practice to fetch a VView
>> >> > object directly and creating a ViewModelContext with it.
>> >> > > I guess my question is, what is the proper way of providing
>> more than
>> >> > one view for the same EObject and having them all accessible
>> based on
>> >> > context? (as opposed to an arbitrary priority index)
>> >> > > Your support is always much appreciated.
>> >> > > Regards,
>> >> > Olivier
>> > >
>
>

Previous Topic:EMFStore Conflict Detection
Next Topic:Reusable EMF instances (library)
Goto Forum:
  


Current Time: Thu Mar 28 21:25:04 GMT 2024

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

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

Back to the top