viatra / EMF-IncQuery

This repository is only kept for historic reasons. All development happens on eclipse.org
http://eclipse.org/viatra
13 stars 4 forks source link

Packages referenced through eiqgen are not available in the new eiq wizard #245

Closed istvanrath closed 12 years ago

istvanrath commented 12 years ago

I have tested this with the school example: it refers to the http://school.ecore through the eiqgen (genmodel), and the New Query Definition Wizard's second screen (Add EPackage) does not offer this epackage in the list.

szabta89 commented 12 years ago

Well, the EPackages are collected from the EPackage Registry and on my machine the wizard could fine the mentioned package. However, the example repository's head version contains an eiqgen file inside the school.incquery project whose content is commented out.

istvanrath commented 12 years ago

"the EPackages are collected form the EPackage Registry" --> this is the problem. The genmodel refenreces inside the eiqgen file should also be taken into account. Note: since the eiqgen file is empty (or non-existent? @ujhelyiz ) when a new project has just been created, I will change the order of steps in the cheat sheet to have the eiqgen creation before the creation of a new query definition.

Make sure that

ujhelyiz commented 12 years ago

Instead of manually opening the .eiqgen files, you could use the IMetamodelProvider injectable service is used to provide the available EPackages to the editor (both from the EPackage registry and the eiqgen files - if they exist). However, this metamodelprovider assumes that an IncQuery project is present.

Currently, it returns an IScope instance (used by Xtext scoping), but that is possible to traverse to get all EPackages.

szabta89 commented 12 years ago

@ujhelyiz Can you provide me some information about obtaining those EPackages? The IMetamodelProvider service requires an EObject instance. Which EObject is needed here? How to access it?

ujhelyiz commented 12 years ago

The service is extremely similar to the IEiqGenmodelProvider interface - you need to give it an EObject from the Resource of the eiq - it does not matter which one. It is only used to determine the context/project where the result will be present.

szabta89 commented 12 years ago

Maybe I'm wrong but I don't understand it. The eiq does not exist at that time, the wizard is used to create it.

The service is extremely similar to the IEiqGenmodelProvider interface - you need to give it an EObject from the Resource of the eiq - it does not matter which one. It is only used to determine the context/project where the result will be present.


Reply to this email directly or view it on GitHub: https://github.com/ujhelyiz/EMF-IncQuery/issues/245#issuecomment-7137470

ujhelyiz commented 12 years ago

Ok, I see the issue. Either you can move the creation a bit forward in time (e.g. when opening the second page, and then removing the file if cancel is pressed), or the metamodelprovider service should be extended with an alternative IProject parameter.

szabta89 commented 12 years ago

@ujhelyiz I checked the MetamodelProviderService impementation and it is very confusing for me that the context EObject is not even used in the getAllMetamodelObjects method. I wanted to add the required getAllMetamodelObjects(IProject) method, but could not find the way to do it.

ujhelyiz commented 12 years ago

I am sorry - I did not say everything related to this issue. There are two different implementations for IMetamodelProviderService - the one you checked only uses the EPackage.Registry to calculate all packages, but there is another one, that first looks a projects eiqgen file, and then reverts to the other MetamodelServiceImplementation (if needed).

The other implementation do uses this parameter, as it is needed to find an .eiqgen implementation first, then loading all indirectly referenced EPackages.

If it is not clear, how to implement that functionality in these two implementations, I will find some try to do it - but probably next week.

szabta89 commented 12 years ago

@ujhelyiz If you have time, please add an getAllMetamodelObjects(IProject) method because I think it would be the better solution, rather than creating and deleting the file (if cancel is pressed).

ujhelyiz commented 12 years ago

As adding IProject to the IMetamodelProviderService would introduce a new dependency on org.eclipse.core.resources plug-in on the emf language project, I added the new method to the IEiqGenmodelProvider service. It is available now.

szabta89 commented 12 years ago

I have added the appropriate method calls to include the EPackages from the eiqgen files too, but for the school example the IEiqGenmodelProvider does not find the school package.

ujhelyiz commented 12 years ago

There were indeed some issues with the package provider service, but it always contained the http://school.ecore reference if it was included in the .eiqgen file. The issues seem to be fixed.

Additionally, this method, similarly to other methods return all EPackages available, including the ones from the Package registry.

szabta89 commented 12 years ago

Well, maybe my workspace is misconfigured, but it never (this time neither) appears for me. Am I right that you are also trying this with the school projects omitted from the run cofiguration?

ujhelyiz commented 12 years ago

Yes, and a .eiqgen file configured to have a line like that:

genmodel "platform:/resource/school/model/school.genmodel"
szabta89 commented 12 years ago

It is exactly the same for me and the school package never appears.

On Tue, Jul 24, 2012 at 1:15 PM, Zoltán Ujhelyi < reply@reply.github.com

wrote:

Yes, and a .eiqgen file configured to have a line like that:

genmodel "platform:/resource/school/model/school.genmodel"

Reply to this email directly or view it on GitHub: https://github.com/ujhelyiz/EMF-IncQuery/issues/245#issuecomment-7204263

ujhelyiz commented 12 years ago

Sorry, but I don't have any idea what might have gone wrong. It should be either working, or failing loudly (i.e. with an exception).

istvanrath commented 12 years ago

It works for me, so I'm closing this issue.