Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mdt-papyrus.dev] Contributing to Compare and Team menus from the model explorer?

Thanks for the inputs Christian, I will investigate that and come back to you.

 

Cheers,

 

Arnaud

 

De : mdt-papyrus.dev-bounces@xxxxxxxxxxx [mailto:mdt-papyrus.dev-bounces@xxxxxxxxxxx] De la part de Christian W. Damus
Envoyé : mercredi 11 juin 2014 14:02
À : Papyrus Project list
Objet : Re: [mdt-papyrus.dev] Contributing to Compare and Team menus from the model explorer?

 

Hi, Arnaud,

 

By adaptation of EObject to EResource, it appears from the code that you mean IResource, not EMF's Resource type.

 

Of course, an adapter to IResource won't work for three classes of model resources:  library models deployed in plug-ins, resources in the local filesystem (not in the workspace), and resources in CDO repositories.

 

Do the menu contributions that you expect to see target adaptable-to IResource or only instance-of IResource? (the latter would probably constitute a bug)

 

I see that the adapter has this check before attempting to get an EObject from the adapted object:

 

if(adaptableObject instanceof EObject)

 

The tree elements in the Model Explorer are no longer EObjects, since some time between M6 and M7.  You probably need something more like this:

 

                        if(adapterType == IResource.class) {
                                   EObject treeObject = EMFHelper.getEObject(adaptableObject);
                                   if(treeObject != null) {

                                               URI uri  = treeObject.eResource().getURI();

                                               // ...

You'll also need to check first that the EObject has an eResource(); if it's a proxy (such as an element from an unloaded controlled unit) then it won't have an eResource() and an NPE will result.

 

HTH,

 

Christian

 

On Jun 2, 2014, at 4:33 AM, CUCCURU Arnaud <arnaud.cuccuru@xxxxxx> wrote:



Dear colleagues,

 

As part of a work on an integration of EMF Compare with Papyrus, I am currently facing some difficulties to have the menus Compare and Team available (and correctly populated) from the model explorer. These menus are already correctly integrated in the Project Explorer. We would just like to have to same behaviors from the model explorer (e.g., when trying to perform a compare action from the model explorer, we would like to perform a compare at the resource level).

 

For that purpose, at the moment, we have made some experimental changes on plug-in oep.view.modelexplorer, so that it registers a new adapter for adapting EObjects to EResources. Something happens, since the team menu appears when right clicking on a model element from the model explorer (though it is incomplete), but the compare menu does NOT. Here are some screenshots from the project explorer (we would like to have something equivalent in the model explorer) and from the model explorer:

 

<image002.jpg>

 

 

<image004.jpg>

 

The experimental modification of the model explorer is available on branch : origin/committers/rschnekenbu/compare

 

Would anyone have an idea of what we could try?

 

Thanks in advance,

 

Arnaud

 

 

_______________________________________________
mdt-papyrus.dev mailing list
mdt-papyrus.dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/mdt-papyrus.dev

 


Back to the top