Hi,

I think I found a solution for if a class is added (simply parsing the 
newly resource, since only proxies are generated) and
deletion (there's a delete method), but changing a resource with 
unloading I'm not sure if this works correctly.

Here's my code:
public static void changedResource(IResource resource) {
         URI uri = URI.createPlatformResourceURI(resource.getFullPath()
                 .toString(), true);
         JavaResource javaresource = (JavaResource) rs.getResource(uri, 
true);
         javaresource.unload();
}

After unloading a resource, there seems to be an "empty" resource (maybe 
the unloaded resource) and an normal
resource corresponding to the new changed resource added to the 
ResourceSet. I can't imagine that this is too correct. Or am I mistaken?

Another question is: I only find the Class-Descriptors in the 
ResourceSet is this because of the fact that only proxies are generated? 
When will those be resolved, if someone wants to access a method i.e.?

Best regards,
Markus

On 10/20/2012 06:55 PM, Jendrik Johannes wrote:
> Hi Markus,
>
> As an additional note - the code to do this is:
>
> resource.unload()
>
> This will invalidate all objects in one resource (i.e. convert them to
> proxies) and the resource will be marked as 'not loaded'. The next
> time an object from the resource is accessed, it will be loaded again.
>
> Note that your Resources need to live in a single ResourceSet to make
> this work properly.
>
> Cheers,
> Jendrik
>
> On 19 October 2012 20:36, Mirko Seifert <[email protected]> wrote:
>> Hi Markus,
>>
>> I not 100% sure, but I think it should be sufficient to unload the
>> resource that corresponds to the changed class and load it again. The
>> other resource should then be automatically "rewired" to the new resource.
>>
>> Please give it a try and let us know if it does not work.
>>
>> Best regards,
>>
>> Mirko
>>
>>
>> Am 19.10.2012 19:15, schrieb Markus:
>>> Hi,
>>>
>>> For my question let's assume that I have a whole Java-Project parsed
>>> into the metamodel.
>>>
>>> But after every change of a certain class, method etc. I want to update
>>> the model without parsing the whole
>>> project every time.
>>> As far as I can understand now one must parse i.e. the changed class and
>>> delete the corresponding part
>>> in the big model and plug in the newly parsed class or whatever.
>>>
>>> Do I understand this correct or is there any other possibilty? (newly
>>> resolve the class?) Is there any code example for this?
>>>
>>> Best regards,
>>> Markus
>>> _______________________________________________
>>> emftext-users mailing list
>>> [email protected]
>>> http://mail-st.inf.tu-dresden.de/cgi-bin/mailman/listinfo/emftext-users
>>>
>> --
>> Dr.-Ing. Mirko Seifert
>> Geschäftsführer
>> DevBoost GmbH
>> Rungestr. 22-24
>> 10179 Berlin
>>
>> Tel.: +49 1577 444 1168
>> E-Mail: [email protected]
>>
>> Handelsregister Amtsgericht Berlin (Charlottenburg) HRB 140026
>> _______________________________________________
>> emftext-users mailing list
>> [email protected]
>> http://mail-st.inf.tu-dresden.de/cgi-bin/mailman/listinfo/emftext-users
>
>

_______________________________________________
emftext-users mailing list
[email protected]
http://mail-st.inf.tu-dresden.de/cgi-bin/mailman/listinfo/emftext-users

Reply via email to