Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Compare] GregorianCalendar values displayed incorrectly
[Compare] GregorianCalendar values displayed incorrectly [message #1856003] Tue, 15 November 2022 09:55 Go to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi,

I'm trying to compare versions of a ReqIF model which apparently contains attributes of type GregorianCalendar. In the upper editor area these values are displayed correctly but in the lower area (TableContentMergeViewer) it appears that just toString() is called. And that results in different/poor text representations. Please see the attached screenshot.

What can I do to fix this?

Thanks a lot,
Eike


Re: [Compare] GregorianCalendar values displayed incorrectly [message #1856004 is a reply to message #1856003] Tue, 15 November 2022 10:01 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Perhaps some more background from debugging:

The constructor of org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.table.TableContentMergeViewer creates a ComposedAdapterFactory, which is then used in the label provider's getColumnText() method, more exactly its super method AdapterFactoryLabelProvider.getColumnText(Object, int). But that method can only deal with EObjects, so that it falls back to GregorianCalendar.toString().


Re: [Compare] GregorianCalendar values displayed incorrectly [message #1856030 is a reply to message #1856004] Wed, 16 November 2022 08:38 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hello Eike,

I believe the best shot EMF Compare has at displaying a proper label is the AdapterFactory as we are using it... The StructureMergeViewer should also be using that, is the same ItemProvider used in both viewer (the SMV at the top and Table viewer in the bottom viewers)? If so, why would the top show the correct representation but no bottom one?

Laurent Goubet
Obeo
Re: [Compare] GregorianCalendar values displayed incorrectly [message #1856221 is a reply to message #1856030] Mon, 28 November 2022 13:59 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
I think the problem is that the MergeViewerItem has java.util.GregorianCalendar instances in both fLeft and fRight fields. In super.getColumnText() it attempts adapterFactory.adapt(object, ITableItemLabelProviderClass), but the object is a GregorianCalendar and not an EObject. So it'll always return object.toString(), which is bad in the case of GregorianCalendar. I suspect this problem doesn't come up so often because other common non-EObject types have a nicer toString() method.

I've tried to isolate this problem in a small example model, but I struggle to open an EMF Compare editor on two of those instance resources ;-(
Why does a model comparison open for .ecore files but not for my .test files?

Then I tried to put two (different) objects of my test model into one resource, select them, and execute "Compare with each other <EObject> in editor". Now the EMF Compare editor opens, but says "No differences detected", even though the two objects really differ ;-(

Any chance you try it out yourself?
I've uploaded the test model to https://www.dropbox.com/s/41srd1hm59tqj03/emfcompare.test.zip?dl=0


Re: [Compare] GregorianCalendar values displayed incorrectly [message #1856222 is a reply to message #1856221] Mon, 28 November 2022 14:04 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
And I've uploaded a zip with an example project and example instance files: https://www.dropbox.com/s/7oxqlau8fuxabcr/example-project.zip?dl=0

Previous Topic:[CDO] CDOStaleReferencePolicy & EMap
Next Topic:[CDO] Release 4.21 Is Now Available
Goto Forum:
  


Current Time: Sat Apr 20 03:28:04 GMT 2024

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

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

Back to the top