Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Best way to reduce functions of a generated editor
Best way to reduce functions of a generated editor [message #905382] Thu, 30 August 2012 09:26 Go to next message
John M. is currently offline John M.Friend
Messages: 198
Registered: July 2010
Senior Member
Hello,

I have a little ecore model and generated a emf editor, but I don't like the generated view.
I want to create an editor similar to the generated with a little different view structure.

What is the best way to start?
Re: Best way to reduce functions of a generated editor [message #905401 is a reply to message #905382] Thu, 30 August 2012 10:15 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 26232
Registered: July 2009
Senior Member
You might start by setting Multiple Editor Pages to false in the
GenPackage, i.e., the object below the GenModel in the Generator editor
for the *.genmodel file. You might like the cool forms you get from
EEF. Otherwise, it's hard to given advice without knowing what you want
that's a little different...


On 30/08/2012 11:26 AM, Missing name Mising name wrote:
> Hello,
>
> I have a little ecore model and generated a emf editor, but I don't
> like the generated view.
> I want to create an editor similar to the generated with a little
> different view structure.
>
> What is the best way to start?
Re: Best way to reduce functions of a generated editor [message #905404 is a reply to message #905401] Thu, 30 August 2012 10:27 Go to previous messageGo to next message
John M. is currently offline John M.Friend
Messages: 198
Registered: July 2010
Senior Member
Thanks for your comment.
At the moment I have a complicated structure of different classes and some classes are only containers.

Here a little example. That is my file loaded in the generated editor:
(Note: Container have all the same structure)
File
 - Container with Name
  - Datacontainer
   - Some Data 1
   - Some Data 2
  - Reference on Container with Name
  - Datacontainer
   - Some Data 1
   - Some Data 2


I want to show it like following:
- Some content from Some Data 1
 - Some Data 1
 - Some Data 2
- Reference content
- Some content from Some Data 1
 - Some Data 1
 - Some Data 2


I hope it is understandable. In general I want to exclude the containers from being shown and show only a "summary" of specific data from the content of the container.

My first idea was to specialize the XXXItemProviderAdapterFactory, but it is a lot of work. Perhaps there is a better and more faster way.
Re: Best way to reduce functions of a generated editor [message #905416 is a reply to message #905404] Thu, 30 August 2012 10:47 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 26232
Registered: July 2009
Senior Member
Specializing the item providers is the way. But if it's only a view and
you don't intend to use that view to edit the overall structure, it's
also possible to use org.eclipse.emf.edit.tree.TreeNode to build the
structure with data references to the actual structure; a TreeNode's
item provider delegates to the item provider for the data reference, so
you'll be able to edit their properties in the properties view and see
their normal labels and icons (which you could specialize in their item
providers or in derived specialized item providers).


On 30/08/2012 12:27 PM, Missing name Mising name wrote:
> Thanks for your comment.
> At the moment I have a complicated structure of different classes and
> some classes are only containers.
>
> Here a little example. That is my file loaded in the generated editor:
> (Note: Container have all the same structure)
> File
> - Container with Name
> - Datacontainer
> - Some Data 1
> - Some Data 2
> - Reference on Container with Name
> - Datacontainer
> - Some Data 1
> - Some Data 2
>
> I want to show it like following:
> - Some content from Some Data 1
> - Some Data 1
> - Some Data 2
> - Reference content
> - Some content from Some Data 1
> - Some Data 1
> - Some Data 2
>
> I hope it is understandable. In general I want to exclude the
> containers from being shown and show only a "summary" of specific data
> from the content of the container.
>
> My first idea was to specialize the XXXItemProviderAdapterFactory, but
> it is a lot of work. Perhaps there is a better and more faster way.
Re: Best way to reduce functions of a generated editor [message #905422 is a reply to message #905416] Thu, 30 August 2012 11:04 Go to previous messageGo to next message
John M. is currently offline John M.Friend
Messages: 198
Registered: July 2010
Senior Member
I want the possibility to edit the content.
So I edit the generated providers and get the result?
I was thinking about an own rcp plugin, because I want an own perspective and something like that.
Re: Best way to reduce functions of a generated editor [message #905426 is a reply to message #905422] Thu, 30 August 2012 11:10 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 26232
Registered: July 2009
Senior Member
Comments below.

On 30/08/2012 1:04 PM, Missing name Mising name wrote:
> I want the possibility to edit the content.
The structure object the objects or the properties of the objects?
> So I edit the generated providers and get the result?
Often people want to keep the original item providers and create
specialized ones for specialized purposes (alternative views). E.g.,
org.eclipse.xsd.provider.XSDSemanticItemProviderAdapterFactory does that.
> I was thinking about an own rcp plugin, because I want an own
> perspective and something like that.
EMF generates and RCP-based editor if you want that.
Re: Best way to reduce functions of a generated editor [message #905451 is a reply to message #905426] Thu, 30 August 2012 12:05 Go to previous messageGo to next message
John M. is currently offline John M.Friend
Messages: 198
Registered: July 2010
Senior Member
> The structure object the objects or the properties of the objects?
The only structure I want to edit is the order of the elements. Some of the other content shall be editable with the property view.

> Often people want to keep the original item providers and create
> specialized ones for specialized purposes (alternative views). E.g.,
> org.eclipse.xsd.provider.XSDSemanticItemProviderAdapterFactory does that.
Yeah that was my idea. The best way would be an own plugin for that wouldn't be?


> EMF generates and RCP-based editor if you want that.
Ah okay I found that option. I will try it.
Re: Best way to reduce functions of a generated editor [message #905457 is a reply to message #905451] Thu, 30 August 2012 12:19 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 26232
Registered: July 2009
Senior Member
Comments below.


On 30/08/2012 2:05 PM, Missing name Mising name wrote:
>> The structure object the objects or the properties of the objects?
> The only structure I want to edit is the order of the elements.
That will be a bit tricky if what you display is flat but the order
depends on order in the structure you don't show.
> Some of the other content shall be editable with the property view.
That should work either way.
>
>> Often people want to keep the original item providers and create
>> specialized ones for specialized purposes (alternative views). E.g.,
>> org.eclipse.xsd.provider.XSDSemanticItemProviderAdapterFactory does
>> that.
> Yeah that was my idea. The best way would be an own plugin for that
> wouldn't be?
You can hardly edit someone else's plugin...
>
>
>> EMF generates and RCP-based editor if you want that.
> Ah okay I found that option. I will try it.
Re: Best way to reduce functions of a generated editor [message #905465 is a reply to message #905457] Thu, 30 August 2012 12:36 Go to previous messageGo to next message
John M. is currently offline John M.Friend
Messages: 198
Registered: July 2010
Senior Member
>>> The structure object the objects or the properties of the objects?
>> The only structure I want to edit is the order of the elements.
> That will be a bit tricky if what you display is flat but the order
> depends on order in the structure you don't show.
I think it will be, but what is the best way to start?
I was trying to change the input of the editor, so the root container is given instead of the resource.
After that replacing the ItemProvider for the tree view.

>>> Often people want to keep the original item providers and create
>>> specialized ones for specialized purposes (alternative views). E.g.,
>>> org.eclipse.xsd.provider.XSDSemanticItemProviderAdapterFactory does
>>> that.
>> Yeah that was my idea. The best way would be an own plugin for that
>> wouldn't be?
> You can hardly edit someone else's plugin...
I meant a new plug-in project
Re: Best way to reduce functions of a generated editor [message #905509 is a reply to message #905465] Thu, 30 August 2012 14:20 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 26232
Registered: July 2009
Senior Member
Comments below.

On 30/08/2012 2:36 PM, Missing name Mising name wrote:
>>>> The structure object the objects or the properties of the objects?
>>> The only structure I want to edit is the order of the elements.
>> That will be a bit tricky if what you display is flat but the order
>> depends on order in the structure you don't show.
> I think it will be, but what is the best way to start?
Probably you need to experiment a bit and ask more specific questions.
> I was trying to change the input of the editor, so the root container
> is given instead of the resource.
It's easy to change the input to a view by creating an ItemProvider (not
ItemProviderAdapter but ItemProvider) with the collection of roots you
actually want to see in the view
> After that replacing the ItemProvider for the tree view.
>
>>>> Often people want to keep the original item providers and create
>>>> specialized ones for specialized purposes (alternative views).
>>>> E.g.,
>>>> org.eclipse.xsd.provider.XSDSemanticItemProviderAdapterFactory does
>>>> that.
>>> Yeah that was my idea. The best way would be an own plugin for that
>>> wouldn't be?
>> You can hardly edit someone else's plugin...
> I meant a new plug-in project
Whatever works best for you is okay.
Re: Best way to reduce functions of a generated editor [message #905571 is a reply to message #905509] Thu, 30 August 2012 16:53 Go to previous messageGo to next message
John M. is currently offline John M.Friend
Messages: 198
Registered: July 2010
Senior Member
>>>>> The structure object the objects or the properties of the objects?
>>>> The only structure I want to edit is the order of the elements.
>>> That will be a bit tricky if what you display is flat but the order
>>> depends on order in the structure you don't show.
>> I think it will be, but what is the best way to start?
> Probably you need to experiment a bit and ask more specific questions.
Okay I have now an editor, which extends the generated rcp editor and some specialized ItemProvider.
My idea was to create an extension point for my own ItemProvider, if someone want to extend the system with a new model. He has to create an ItemProvider, too.
In my extended editor all registered ItemProviders are loaded and registered in the ComposedAdapterFactory.

I hope my idea is correct. Thanks for any hints.
Re: Best way to reduce functions of a generated editor [message #905591 is a reply to message #905571] Thu, 30 August 2012 17:39 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 26232
Registered: July 2009
Senior Member
Comments below.


On 30/08/2012 6:53 PM, Missing name Mising name wrote:
>>>>>> The structure object the objects or the properties of the objects?
>>>>> The only structure I want to edit is the order of the elements.
>>>> That will be a bit tricky if what you display is flat but the order
>>>> depends on order in the structure you don't show.
>>> I think it will be, but what is the best way to start?
>> Probably you need to experiment a bit and ask more specific questions.
> Okay I have now an editor, which extends the generated rcp editor and
> some specialized ItemProvider.
> My idea was to create an extension point for my own ItemProvider, if
> someone want to extend the system with a new model. He has to create
> an ItemProvider, too.
Generated item providers are already registered and available in the
composed adapter factory used in the editor...
> In my extended editor all registered ItemProviders are loaded and
> registered in the ComposedAdapterFactory.
Yes, you get that by default.
>
> I hope my idea is correct. Thanks for any hints.
Re: Best way to reduce functions of a generated editor [message #905688 is a reply to message #905591] Thu, 30 August 2012 22:23 Go to previous message
John M. is currently offline John M.Friend
Messages: 198
Registered: July 2010
Senior Member
It is correct, that the generated providers are registered, but I have to use in some cases my own.
That was the idea behind the extension point for my "special" providers.
Previous Topic:[EMF Compare] Moving items bug or by design?
Next Topic:Validation Problems
Goto Forum:
  


Current Time: Thu Nov 27 13:43:23 GMT 2014

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

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