|
Re: Opening CompareUI Dialog based on tutorial [message #1471801 is a reply to message #1469654] |
Thu, 13 November 2014 10:47 |
|
Hi Márton,
It seems like you are trying to use the compare configuration in a standalone environment, which cannot be done. You need to put your code in a plugin project and use it through a new Eclipse runtime.
Please see tutorials on how to create eclipse plugins for more information (this one's a little old but should get you started)
Laurent Goubet
Obeo
|
|
|
|
Re: Opening CompareUI Dialog based on tutorial [message #1737050 is a reply to message #1471801] |
Tue, 05 July 2016 10:15 |
Matteo M. Messages: 40 Registered: May 2012 |
Member |
|
|
Hello,
I'm resuming this post because I had the exact same problem as the OP. My environment is as follows:
Version: Mars.2 Release (4.5.2)
Build id: 20160218-0600
Model comparison (EMF Compare) - 3.1.1.201509120604
According to your suggestion, I packaged all the code into a plugin. Now I'm running the code from a new Eclipse runtime instance, but it fails to execute with the following error message:
!ENTRY org.eclipse.ui 4 0 2016-07-05 11:48:57.084
!MESSAGE Unhandled event loop exception
!STACK 0
org.eclipse.e4.core.di.InjectionException: java.lang.ClassCastException: org.eclipse.compare.CompareConfiguration cannot be cast to org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration
at ...
Caused by: java.lang.ClassCastException: org.eclipse.compare.CompareConfiguration cannot be cast to org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration
at ...
... 38 more
This is the portion of code I'm using (note that, at line 3, the tutorial does not cast argument 1 to EMFCompareConfiguration):
// Instantiating an EMF Compare specific implementation of CompareEditorInput
ICompareEditingDomain editingDomain = EMFCompareEditingDomain.create(scope.getLeft(), scope.getRight(), null);
AdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
CompareEditorInput input = new ComparisonEditorInput((EMFCompareConfiguration) new CompareConfiguration(), comparison, editingDomain, adapterFactory);
CompareUI.openCompareDialog(input); // or CompareUI.openCompareEditor(input);
Maybe it's worth to remark that I get multiple warnings for this line:
CompareEditorInput input = new ComparisonEditorInput((EMFCompareConfiguration) new CompareConfiguration(), comparison, editingDomain, adapterFactory);
Here are the warnings:
- Discouraged access: The type 'ComparisonEditorInput' is not API (restriction on required library '<eclipse-dir>\plugins\org.eclipse.emf.compare.ide.ui_4.1.1.201509120604.jar')
- Discouraged access: The constructor 'ComparisonEditorInput(EMFCompareConfiguration, Comparison, ICompareEditingDomain, AdapterFactory)' is not API (restriction on required library '<eclipse-dir>\plugins\org.eclipse.emf.compare.ide.ui_4.1.1.201509120604.jar')
- Discouraged access: The type 'EMFCompareConfiguration' is not API (restriction on required library '<eclipse-dir>\plugins\org.eclipse.emf.compare.ide.ui_4.1.1.201509120604.jar')
It seems to me that the tutorial is not in-line with latest releases of EMF compare. How do I launch the CompareUI Dialog programmatically in EMF Compare 3.1.1?
Thanks in advance. Best,
--
Matteo
[Updated on: Tue, 05 July 2016 10:30] Report message to a moderator
|
|
|
|
Re: Opening CompareUI Dialog based on tutorial [message #1737184 is a reply to message #1737183] |
Wed, 06 July 2016 09:21 |
|
Ho, the failure is in your code... yeah "(EMFCompareConfiguration) new CompareConfiguration()" cannot work. An EMFCompareConfiguration is a CompareConfiguration, but a CompareConfiguration is not an EMFCompareConfiguration.
Please use new EMFCompareConfiguration(new CompareConfiguration()) for a default config.
The documentation is indeed not up-to-date. We'll have to change this (bug 497371 opened for this).
Laurent Goubet
Obeo
|
|
|
|
Powered by
FUDForum. Page generated in 3.61365 seconds