Loading same plugin twice with different version in Eclipse

孤街浪徒 提交于 2019-12-11 23:58:44

问题


I have two different versions of an EMF plugin which loads a certain .xmi. The latter version has been changed so that the xmi from the previous version is incompatible. What I want to do is to load the xmi's with the first plugin and then programatically build a model using the newer plugin thus migrating older models. They are identical apart from some changes within an EMF model.

How do I load these plugins? Is it possible? Are there better strategies?


回答1:


I suggest changing the id of the old version (and possibly the EMF package URI), so you can have the two code and models simultaneously.

As you need to handle both old and new classes in the same plug-in (the migrator), there is no way you can have both working.

However, you shall look at the dynamic EMF technology where you could open the old model without its generated packages (on the other hand, you have to use the reflective API). Using this method you can write a converter, that opens the old model using EMF reflective API, and manually translate it into your new model version.




回答2:


Sorry, but that is not possible as these plug-ins are singletons. And you cannot switch the plug-ins during the migrations as the Java base classes gets in your way.

One possible solution is using the EDapt technology. This technology allows you to automatically migrate you model as you load it. I have used COPE - the predecessor of EDapt - in two different projects with great success.



来源:https://stackoverflow.com/questions/9383880/loading-same-plugin-twice-with-different-version-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!