Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » [EMF Compare] How to use EMF Compare in Java
| | |
Re: [EMF Compare] How to use EMF Compare in Java [message #122652 is a reply to message #122647] |
Mon, 19 May 2008 06:52 |
|
This is a multi-part message in MIME format.
--------------020505000708090309090603
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Lars,
An example showing how to use EMF Compare standalone
(org.eclipse.emf.compare.examples.standalone) is available on CVS. This
project contains code for loading, matching and differencing models.
Here is the corresponding snippet (where "model1" and "model2" can be
either URIs, Strings, IFiles or Files) :
EObject model1 = ModelUtils.load(model1, resourceSet);
EObject model2 = ModelUtils.load(model2, resourceSet);
MatchModel match = MatchService.doMatch(model1, model2,
Collections.<String, Object> emptyMap());
DiffModel diff = DiffService.doDiff(match, false);
Cheers,
Laurent Goubet
Obeo
Lars Schneider a
|
|
|
Re: [EMF Compare] How to use EMF Compare in Java [message #122752 is a reply to message #122652] |
Wed, 21 May 2008 13:07 |
Lars Schneider Messages: 50 Registered: July 2009 |
Member |
|
|
Thanks Laurent,
that worked. Can you tell me where the Compare-Viewer/Editor is loaded
in the Plugin? I have to open it explicitly after a Wizard is shown.
Lars
laurent Goubet wrote:
> Lars,
>
> An example showing how to use EMF Compare standalone
> (org.eclipse.emf.compare.examples.standalone) is available on CVS. This
> project contains code for loading, matching and differencing models.
>
> Here is the corresponding snippet (where "model1" and "model2" can be
> either URIs, Strings, IFiles or Files) :
>
> EObject model1 = ModelUtils.load(model1, resourceSet);
> EObject model2 = ModelUtils.load(model2, resourceSet);
>
> MatchModel match = MatchService.doMatch(model1, model2,
> Collections.<String, Object> emptyMap());
> DiffModel diff = DiffService.doDiff(match, false);
>
> Cheers,
>
> Laurent Goubet
> Obeo
>
> Lars Schneider a écrit :
>> I already read through this wiki but couldn't find anything helping me
>> with my problem. I need a code snippet or a tutorial that describes
>> how to programatically load two models and compare them.
>>
>> Stéphane LACRAMPE schrieb:
>>> Hi,
>>>
>>> I think that you should find an answer in the EMF Compare FAQ.
>>> http://wiki.eclipse.org/EMF_Compare_FAQ
>>>
>>> Stephane
>>> Obeo
>>>
>>> Lars Schneider a écrit :
>>>> Hi,
>>>>
>>>> I am writing a Model Refactoring for EMF Plugin and I think it would
>>>> be great to use EMF Compare as a preview like Eclipse Code
>>>> Refactoring does. The problem I am having is how to compare the
>>>> original resource with the refactored resource. I need to know how
>>>> to open a two-way compare of the two different instances of EObject.
>>>>
>>>> In this newsgroup I already found this snippet but it does not work
>>>> (anymore):
>>>>
>>>> EObject eObject1 = ModelUtils.load(model1URI);
>>>> EObject eObject2 = ModelUtils.load(model2URI);
>>>> final MatchModel match = new MatchService().doMatch(
>>>> eObject1, eObject2, new NullProgressMonitor());
>>>> final DiffModel diff = new DiffMaker().doDiff(match);
>>>>
>>>> - ModelUtils.load(...) also needs a ResourceSet
>>>> - MatchService has no visible constructor
>>>> - DiffMaker can not be resolved to a type
>>>>
>>>> Are there tutorials or other code examples available?
>
|
|
|
Re: [EMF Compare] How to use EMF Compare in Java [message #122763 is a reply to message #122752] |
Wed, 21 May 2008 14:15 |
|
This is a multi-part message in MIME format.
--------------060606080103040501040007
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Lars,
We never explicitly open our editor, org.eclipse.compare handles this
part through the extension points we extend.
You can take a look at the (very) small
org.eclipse.emf.compare.ui.editor.ModelCompareEditorLauncher which we
use to open emfdiff files (serialization of a comparison result).
I've never tried this from code, but I think something like :
ModelInputSnapshot snapshot =
DiffFactory.eINSTANCE.createModelInputSnapshot();
snapshot.setDiff(diff)
snapshot.setMatch(match)
CompareUI.openCompareEditor(new ModelCompareEditorInput(snapshot));
should do the trick.
Laurent Goubet
Obeo
Lars Schneider a
|
|
|
Re: [EMF Compare] How to use EMF Compare in Java [message #122779 is a reply to message #122763] |
Wed, 21 May 2008 15:56 |
Lars Schneider Messages: 50 Registered: July 2009 |
Member |
|
|
Laurent,
I really cannot express how happy I am. That was EXACTLY what I was
looking for. Thank you very, very much.
Lars
laurent Goubet wrote:
> Lars,
>
> We never explicitly open our editor, org.eclipse.compare handles this
> part through the extension points we extend.
>
> You can take a look at the (very) small
> org.eclipse.emf.compare.ui.editor.ModelCompareEditorLauncher which we
> use to open emfdiff files (serialization of a comparison result).
>
> I've never tried this from code, but I think something like :
>
> ModelInputSnapshot snapshot =
> DiffFactory.eINSTANCE.createModelInputSnapshot();
> snapshot.setDiff(diff)
> snapshot.setMatch(match)
> CompareUI.openCompareEditor(new ModelCompareEditorInput(snapshot));
>
> should do the trick.
>
> Laurent Goubet
> Obeo
>
> Lars Schneider a écrit :
>> Thanks Laurent,
>>
>> that worked. Can you tell me where the Compare-Viewer/Editor is loaded
>> in the Plugin? I have to open it explicitly after a Wizard is shown.
>>
>> Lars
>>
>> laurent Goubet wrote:
>>> Lars,
>>>
>>> An example showing how to use EMF Compare standalone
>>> (org.eclipse.emf.compare.examples.standalone) is available on CVS.
>>> This project contains code for loading, matching and differencing
>>> models.
>>>
>>> Here is the corresponding snippet (where "model1" and "model2" can be
>>> either URIs, Strings, IFiles or Files) :
>>>
>>> EObject model1 = ModelUtils.load(model1, resourceSet);
>>> EObject model2 = ModelUtils.load(model2, resourceSet);
>>>
>>> MatchModel match = MatchService.doMatch(model1, model2,
>>> Collections.<String, Object> emptyMap());
>>> DiffModel diff = DiffService.doDiff(match, false);
>>>
>>> Cheers,
>>>
>>> Laurent Goubet
>>> Obeo
>>>
>>> Lars Schneider a écrit :
>>>> I already read through this wiki but couldn't find anything helping
>>>> me with my problem. I need a code snippet or a tutorial that
>>>> describes how to programatically load two models and compare them.
>>>>
>>>> Stéphane LACRAMPE schrieb:
>>>>> Hi,
>>>>>
>>>>> I think that you should find an answer in the EMF Compare FAQ.
>>>>> http://wiki.eclipse.org/EMF_Compare_FAQ
>>>>>
>>>>> Stephane
>>>>> Obeo
>>>>>
>>>>> Lars Schneider a écrit :
>>>>>> Hi,
>>>>>>
>>>>>> I am writing a Model Refactoring for EMF Plugin and I think it
>>>>>> would be great to use EMF Compare as a preview like Eclipse Code
>>>>>> Refactoring does. The problem I am having is how to compare the
>>>>>> original resource with the refactored resource. I need to know how
>>>>>> to open a two-way compare of the two different instances of EObject.
>>>>>>
>>>>>> In this newsgroup I already found this snippet but it does not
>>>>>> work (anymore):
>>>>>>
>>>>>> EObject eObject1 = ModelUtils.load(model1URI);
>>>>>> EObject eObject2 = ModelUtils.load(model2URI);
>>>>>> final MatchModel match = new MatchService().doMatch(
>>>>>> eObject1, eObject2, new NullProgressMonitor());
>>>>>> final DiffModel diff = new DiffMaker().doDiff(match);
>>>>>>
>>>>>> - ModelUtils.load(...) also needs a ResourceSet
>>>>>> - MatchService has no visible constructor
>>>>>> - DiffMaker can not be resolved to a type
>>>>>>
>>>>>> Are there tutorials or other code examples available?
>>>
>
|
|
|
Re: [EMF Compare] How to use EMF Compare in Java [message #618061 is a reply to message #122630] |
Sun, 18 May 2008 05:41 |
Stephane LACRAMPE Messages: 217 Registered: July 2009 |
Senior Member |
|
|
Hi,
I think that you should find an answer in the EMF Compare FAQ.
http://wiki.eclipse.org/EMF_Compare_FAQ
Stephane
Obeo
Lars Schneider a écrit :
> Hi,
>
> I am writing a Model Refactoring for EMF Plugin and I think it would be
> great to use EMF Compare as a preview like Eclipse Code Refactoring
> does. The problem I am having is how to compare the original resource
> with the refactored resource. I need to know how to open a two-way
> compare of the two different instances of EObject.
>
> In this newsgroup I already found this snippet but it does not work
> (anymore):
>
> EObject eObject1 = ModelUtils.load(model1URI);
> EObject eObject2 = ModelUtils.load(model2URI);
> final MatchModel match = new MatchService().doMatch(
> eObject1, eObject2, new NullProgressMonitor());
> final DiffModel diff = new DiffMaker().doDiff(match);
>
> - ModelUtils.load(...) also needs a ResourceSet
> - MatchService has no visible constructor
> - DiffMaker can not be resolved to a type
>
> Are there tutorials or other code examples available?
Stephane LACRAMPE
Obeo Canada
|
|
| |
Re: [EMF Compare] How to use EMF Compare in Java [message #618064 is a reply to message #122647] |
Mon, 19 May 2008 06:52 |
|
This is a multi-part message in MIME format.
--------------020505000708090309090603
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Lars,
An example showing how to use EMF Compare standalone
(org.eclipse.emf.compare.examples.standalone) is available on CVS. This
project contains code for loading, matching and differencing models.
Here is the corresponding snippet (where "model1" and "model2" can be
either URIs, Strings, IFiles or Files) :
EObject model1 = ModelUtils.load(model1, resourceSet);
EObject model2 = ModelUtils.load(model2, resourceSet);
MatchModel match = MatchService.doMatch(model1, model2,
Collections.<String, Object> emptyMap());
DiffModel diff = DiffService.doDiff(match, false);
Cheers,
Laurent Goubet
Obeo
Lars Schneider a
|
|
|
Re: [EMF Compare] How to use EMF Compare in Java [message #618086 is a reply to message #122652] |
Wed, 21 May 2008 13:07 |
Lars Schneider Messages: 50 Registered: July 2009 |
Member |
|
|
Thanks Laurent,
that worked. Can you tell me where the Compare-Viewer/Editor is loaded
in the Plugin? I have to open it explicitly after a Wizard is shown.
Lars
laurent Goubet wrote:
> Lars,
>
> An example showing how to use EMF Compare standalone
> (org.eclipse.emf.compare.examples.standalone) is available on CVS. This
> project contains code for loading, matching and differencing models.
>
> Here is the corresponding snippet (where "model1" and "model2" can be
> either URIs, Strings, IFiles or Files) :
>
> EObject model1 = ModelUtils.load(model1, resourceSet);
> EObject model2 = ModelUtils.load(model2, resourceSet);
>
> MatchModel match = MatchService.doMatch(model1, model2,
> Collections.<String, Object> emptyMap());
> DiffModel diff = DiffService.doDiff(match, false);
>
> Cheers,
>
> Laurent Goubet
> Obeo
>
> Lars Schneider a écrit :
>> I already read through this wiki but couldn't find anything helping me
>> with my problem. I need a code snippet or a tutorial that describes
>> how to programatically load two models and compare them.
>>
>> Stéphane LACRAMPE schrieb:
>>> Hi,
>>>
>>> I think that you should find an answer in the EMF Compare FAQ.
>>> http://wiki.eclipse.org/EMF_Compare_FAQ
>>>
>>> Stephane
>>> Obeo
>>>
>>> Lars Schneider a écrit :
>>>> Hi,
>>>>
>>>> I am writing a Model Refactoring for EMF Plugin and I think it would
>>>> be great to use EMF Compare as a preview like Eclipse Code
>>>> Refactoring does. The problem I am having is how to compare the
>>>> original resource with the refactored resource. I need to know how
>>>> to open a two-way compare of the two different instances of EObject.
>>>>
>>>> In this newsgroup I already found this snippet but it does not work
>>>> (anymore):
>>>>
>>>> EObject eObject1 = ModelUtils.load(model1URI);
>>>> EObject eObject2 = ModelUtils.load(model2URI);
>>>> final MatchModel match = new MatchService().doMatch(
>>>> eObject1, eObject2, new NullProgressMonitor());
>>>> final DiffModel diff = new DiffMaker().doDiff(match);
>>>>
>>>> - ModelUtils.load(...) also needs a ResourceSet
>>>> - MatchService has no visible constructor
>>>> - DiffMaker can not be resolved to a type
>>>>
>>>> Are there tutorials or other code examples available?
>
|
|
|
Re: [EMF Compare] How to use EMF Compare in Java [message #618089 is a reply to message #122752] |
Wed, 21 May 2008 14:15 |
|
This is a multi-part message in MIME format.
--------------060606080103040501040007
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Lars,
We never explicitly open our editor, org.eclipse.compare handles this
part through the extension points we extend.
You can take a look at the (very) small
org.eclipse.emf.compare.ui.editor.ModelCompareEditorLauncher which we
use to open emfdiff files (serialization of a comparison result).
I've never tried this from code, but I think something like :
ModelInputSnapshot snapshot =
DiffFactory.eINSTANCE.createModelInputSnapshot();
snapshot.setDiff(diff)
snapshot.setMatch(match)
CompareUI.openCompareEditor(new ModelCompareEditorInput(snapshot));
should do the trick.
Laurent Goubet
Obeo
Lars Schneider a
|
|
|
Re: [EMF Compare] How to use EMF Compare in Java [message #618099 is a reply to message #122763] |
Wed, 21 May 2008 15:56 |
Lars Schneider Messages: 50 Registered: July 2009 |
Member |
|
|
Laurent,
I really cannot express how happy I am. That was EXACTLY what I was
looking for. Thank you very, very much.
Lars
laurent Goubet wrote:
> Lars,
>
> We never explicitly open our editor, org.eclipse.compare handles this
> part through the extension points we extend.
>
> You can take a look at the (very) small
> org.eclipse.emf.compare.ui.editor.ModelCompareEditorLauncher which we
> use to open emfdiff files (serialization of a comparison result).
>
> I've never tried this from code, but I think something like :
>
> ModelInputSnapshot snapshot =
> DiffFactory.eINSTANCE.createModelInputSnapshot();
> snapshot.setDiff(diff)
> snapshot.setMatch(match)
> CompareUI.openCompareEditor(new ModelCompareEditorInput(snapshot));
>
> should do the trick.
>
> Laurent Goubet
> Obeo
>
> Lars Schneider a écrit :
>> Thanks Laurent,
>>
>> that worked. Can you tell me where the Compare-Viewer/Editor is loaded
>> in the Plugin? I have to open it explicitly after a Wizard is shown.
>>
>> Lars
>>
>> laurent Goubet wrote:
>>> Lars,
>>>
>>> An example showing how to use EMF Compare standalone
>>> (org.eclipse.emf.compare.examples.standalone) is available on CVS.
>>> This project contains code for loading, matching and differencing
>>> models.
>>>
>>> Here is the corresponding snippet (where "model1" and "model2" can be
>>> either URIs, Strings, IFiles or Files) :
>>>
>>> EObject model1 = ModelUtils.load(model1, resourceSet);
>>> EObject model2 = ModelUtils.load(model2, resourceSet);
>>>
>>> MatchModel match = MatchService.doMatch(model1, model2,
>>> Collections.<String, Object> emptyMap());
>>> DiffModel diff = DiffService.doDiff(match, false);
>>>
>>> Cheers,
>>>
>>> Laurent Goubet
>>> Obeo
>>>
>>> Lars Schneider a écrit :
>>>> I already read through this wiki but couldn't find anything helping
>>>> me with my problem. I need a code snippet or a tutorial that
>>>> describes how to programatically load two models and compare them.
>>>>
>>>> Stéphane LACRAMPE schrieb:
>>>>> Hi,
>>>>>
>>>>> I think that you should find an answer in the EMF Compare FAQ.
>>>>> http://wiki.eclipse.org/EMF_Compare_FAQ
>>>>>
>>>>> Stephane
>>>>> Obeo
>>>>>
>>>>> Lars Schneider a écrit :
>>>>>> Hi,
>>>>>>
>>>>>> I am writing a Model Refactoring for EMF Plugin and I think it
>>>>>> would be great to use EMF Compare as a preview like Eclipse Code
>>>>>> Refactoring does. The problem I am having is how to compare the
>>>>>> original resource with the refactored resource. I need to know how
>>>>>> to open a two-way compare of the two different instances of EObject.
>>>>>>
>>>>>> In this newsgroup I already found this snippet but it does not
>>>>>> work (anymore):
>>>>>>
>>>>>> EObject eObject1 = ModelUtils.load(model1URI);
>>>>>> EObject eObject2 = ModelUtils.load(model2URI);
>>>>>> final MatchModel match = new MatchService().doMatch(
>>>>>> eObject1, eObject2, new NullProgressMonitor());
>>>>>> final DiffModel diff = new DiffMaker().doDiff(match);
>>>>>>
>>>>>> - ModelUtils.load(...) also needs a ResourceSet
>>>>>> - MatchService has no visible constructor
>>>>>> - DiffMaker can not be resolved to a type
>>>>>>
>>>>>> Are there tutorials or other code examples available?
>>>
>
|
|
|
Goto Forum:
Current Time: Thu Apr 25 06:37:07 GMT 2024
Powered by FUDForum. Page generated in 0.04161 seconds
|