Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » EMF.Edit - Problem with ITableItemLabelProvider
EMF.Edit - Problem with ITableItemLabelProvider [message #492712] Wed, 21 October 2009 13:45 Go to next message
Florian  is currently offline Florian Friend
Messages: 16
Registered: July 2009
Junior Member
Hi,

i am working on a gmf-based editor and i want to display data of a model object in a table. Therefore i implemented the interfaces IStructuredItemContentProvider & ITableItemLabelProvider in my edit provider.

The code in the setInput method of the property section looks like this:

AdapterFactory af = getAdapterFactory(inputElement);
if (af != null)
{
afContentProvider.setAdapterFactory(af);
afLabelProvider.setAdapterFactory(af);

inputTableViewer.setContentProvider(afContentProvider);
inputTableViewer.setLabelProvider(afLabelProvider);
inputTableViewer.setInput(getEObject());
inputTableViewer.refresh(true);
}

The problem is now, that the methods getColumnImage & getColumnText are never called; instead the default toString is exectued; although my provider does implement the corresponding methods. I dont know why this in not working because for the Content Provider it is working. This means that getElements from IStructuredItemContentProvider is called.
Does anybody have a clue why this in not working for my ITableItemLabelProvider?

Any kind of feedback would be highly appreciated.

Greetings,
Florian

Re: EMF.Edit - Problem with ITableItemLabelProvider [message #492726 is a reply to message #492712] Wed, 21 October 2009 14:18 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Florian,

If you used the GenModel property "Table Providers" it should generate
something that works. Did you update the factory to indicate it's a
supported type?

public LibraryItemProviderAdapterFactory()
{
supportedTypes.add(IEditingDomainItemProvider.class);
supportedTypes.add(IStructuredItemContentProvider.class);
supportedTypes.add(ITreeItemContentProvider.class);
supportedTypes.add(IItemLabelProvider.class);
supportedTypes.add(IItemPropertySource.class);
}


Florian wrote:
> Hi,
>
> i am working on a gmf-based editor and i want to display data of a
> model object in a table. Therefore i implemented the interfaces
> IStructuredItemContentProvider & ITableItemLabelProvider in my edit
> provider.
>
> The code in the setInput method of the property section looks like this:
>
> AdapterFactory af = getAdapterFactory(inputElement);
> if (af != null)
> {
> afContentProvider.setAdapterFactory(af);
> afLabelProvider.setAdapterFactory(af);
>
> inputTableViewer.setContentProvider(afContentProvider);
> inputTableViewer.setLabelProvider(afLabelProvider);
> inputTableViewer.setInput(getEObject());
> inputTableViewer.refresh(true);
> }
>
> The problem is now, that the methods getColumnImage & getColumnText
> are never called; instead the default toString is exectued; although
> my provider does implement the corresponding methods. I dont know why
> this in not working because for the Content Provider it is working.
> This means that getElements from IStructuredItemContentProvider is
> called.
> Does anybody have a clue why this in not working for my
> ITableItemLabelProvider?
>
> Any kind of feedback would be highly appreciated.
>
> Greetings,
> Florian
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF.Edit - Problem with ITableItemLabelProvider [message #492739 is a reply to message #492726] Wed, 21 October 2009 14:55 Go to previous messageGo to next message
Florian  is currently offline Florian Friend
Messages: 16
Registered: July 2009
Junior Member
Hi Ed,

first of all thanx for the quick reply!

Yes, in the genmodel the "Table Providers" option is set to true.
My ItemProviderAdapterFactory looks like this (should be fine?):

public ModelItemProviderAdapterFactory()
{
supportedTypes.add(IEditingDomainItemProvider.class);
supportedTypes.add(IStructuredItemContentProvider.class);
supportedTypes.add(ITreeItemContentProvider.class);
supportedTypes.add(IItemLabelProvider.class);
supportedTypes.add(IItemPropertySource.class);
supportedTypes.add(ITableItemLabelProvider.class);
supportedTypes.add(ITableItemColorProvider.class);
supportedTypes.add(ITableItemFontProvider.class);
supportedTypes.add(IItemColorProvider.class);
supportedTypes.add(IItemFontProvider.class);
}

Actually the correct edit provider is resolved, because i added the following line and set a breakpoint:

ITableItemLabelProvider labelProvider = (ITableItemLabelProvider) af.adapt(inputElement, ITableItemLabelProvider.class);

The labelProvider is adapted correctly and is an instance of my item provider class....



Re: EMF.Edit - Problem with ITableItemLabelProvider [message #492742 is a reply to message #492739] Wed, 21 October 2009 15:10 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Florian,

So you still have a problem? Set a breakpoint in the toString method to
see how it gets there.


Florian wrote:
> Hi Ed,
>
> first of all thanx for the quick reply!
>
> Yes, in the genmodel the "Table Providers" option is set to true.
> My ItemProviderAdapterFactory looks like this (should be fine?):
>
> public ModelItemProviderAdapterFactory()
> {
> supportedTypes.add(IEditingDomainItemProvider.class);
> supportedTypes.add(IStructuredItemContentProvider.class);
> supportedTypes.add(ITreeItemContentProvider.class);
> supportedTypes.add(IItemLabelProvider.class);
> supportedTypes.add(IItemPropertySource.class);
> supportedTypes.add(ITableItemLabelProvider.class);
> supportedTypes.add(ITableItemColorProvider.class);
> supportedTypes.add(ITableItemFontProvider.class);
> supportedTypes.add(IItemColorProvider.class);
> supportedTypes.add(IItemFontProvider.class);
> }
>
> Actually the correct edit provider is resolved, because i added the
> following line and set a breakpoint:
>
> ITableItemLabelProvider labelProvider = (ITableItemLabelProvider)
> af.adapt(inputElement, ITableItemLabelProvider.class);
>
> The labelProvider is adapted correctly and is an instance of my item
> provider class....
>
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF.Edit - Problem with ITableItemLabelProvider [message #492784 is a reply to message #492742] Wed, 21 October 2009 17:15 Go to previous messageGo to next message
Florian  is currently offline Florian Friend
Messages: 16
Registered: July 2009
Junior Member
Thanx, with your hint i finally resolved the problem!
Re: EMF.Edit - Problem with ITableItemLabelProvider [message #621506 is a reply to message #492726] Wed, 21 October 2009 14:55 Go to previous messageGo to next message
Florian  is currently offline Florian Friend
Messages: 16
Registered: July 2009
Junior Member
Hi Ed,

first of all thanx for the quick reply!

Yes, in the genmodel the "Table Providers" option is set to true.
My ItemProviderAdapterFactory looks like this (should be fine?):

public ModelItemProviderAdapterFactory()
{
supportedTypes.add(IEditingDomainItemProvider.class);
supportedTypes.add(IStructuredItemContentProvider.class);
supportedTypes.add(ITreeItemContentProvider.class);
supportedTypes.add(IItemLabelProvider.class);
supportedTypes.add(IItemPropertySource.class);
supportedTypes.add(ITableItemLabelProvider.class);
supportedTypes.add(ITableItemColorProvider.class);
supportedTypes.add(ITableItemFontProvider.class);
supportedTypes.add(IItemColorProvider.class);
supportedTypes.add(IItemFontProvider.class);
}

Actually the correct edit provider is resolved, because i added the following line and set a breakpoint:

ITableItemLabelProvider labelProvider = (ITableItemLabelProvider) af.adapt(inputElement, ITableItemLabelProvider.class);

The labelProvider is adapted correctly and is an instance of my item provider class....
Re: EMF.Edit - Problem with ITableItemLabelProvider [message #621507 is a reply to message #492739] Wed, 21 October 2009 15:10 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Florian,

So you still have a problem? Set a breakpoint in the toString method to
see how it gets there.


Florian wrote:
> Hi Ed,
>
> first of all thanx for the quick reply!
>
> Yes, in the genmodel the "Table Providers" option is set to true.
> My ItemProviderAdapterFactory looks like this (should be fine?):
>
> public ModelItemProviderAdapterFactory()
> {
> supportedTypes.add(IEditingDomainItemProvider.class);
> supportedTypes.add(IStructuredItemContentProvider.class);
> supportedTypes.add(ITreeItemContentProvider.class);
> supportedTypes.add(IItemLabelProvider.class);
> supportedTypes.add(IItemPropertySource.class);
> supportedTypes.add(ITableItemLabelProvider.class);
> supportedTypes.add(ITableItemColorProvider.class);
> supportedTypes.add(ITableItemFontProvider.class);
> supportedTypes.add(IItemColorProvider.class);
> supportedTypes.add(IItemFontProvider.class);
> }
>
> Actually the correct edit provider is resolved, because i added the
> following line and set a breakpoint:
>
> ITableItemLabelProvider labelProvider = (ITableItemLabelProvider)
> af.adapt(inputElement, ITableItemLabelProvider.class);
>
> The labelProvider is adapted correctly and is an instance of my item
> provider class....
>
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF.Edit - Problem with ITableItemLabelProvider [message #621509 is a reply to message #492742] Wed, 21 October 2009 17:15 Go to previous message
Florian  is currently offline Florian Friend
Messages: 16
Registered: July 2009
Junior Member
Thanx, with your hint i finally resolved the problem!
Previous Topic:[EcoreTools] Refresh problem
Next Topic:EEF + XSD.ecore
Goto Forum:
  


Current Time: Tue Apr 23 16:23:35 GMT 2024

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

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

Back to the top