Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [henshin-dev] Migration plug-in

Ok, here is a rough version:


        ResourceSet resourceSet = new ResourceSetImpl();
       
        // Load ALL *.henshin and *.henshin_diagram files now:
        resourceSet.getResource(henshinURI, true);
        resourceSet.getResource(henshinDiagramURI, true);
        // ...
       
        // Now migrate the models. Keep track of the newly created elements!
        Map<EObject,EObject> old2new = new HashMap<EObject,EObject>();       
        // do the conversion...
       
        // After the models are replaced, updates the diagrams:
        for (Resource resource : resourceSet.getResources()) {
            for (EObject root : resource.getContents()) {
                if (root instanceof Diagram) {
                    updateViews((Diagram) root, old2new);
                }
            }
        }

        // Save all resources:
        for (Resource resource : resourceSet.getResources()) {
            resource.save(null);
        }
       

    /*
     * Recursively update view elements.
     */
    private static void updateViews(View view, Map<EObject,EObject> old2new) {
        if (view.getElement()!=null) {
            EObject newElem = old2new.get(view.getElement());
            if (newElem!=null) {
                view.setElement(newElem);
            }
        }
        for (Object child : view.getChildren()) {
            updateViews((View) child, old2new);
        }
    }


The notation package (for View and Diagram classes) is located in org.eclipse.gmf.runtime.notation;

Let me know if you need more info / help or testing...

cheers,
christian

On 01/13/2012 01:25 PM, Stefan Jurack wrote:
I still have serious doubts that the migration of the diagram file works
properly in general ... at least without putting extraordinary effort in
that!! We'd better concentrate on other issues such as bringing Henshin
into an overall consistent state.

Am 13.01.2012 12:47, schrieb Riegerf@xxxxxxxxxxxxxxxxxxxxxxx:
Hi Christian,

Quoting Christian Krause <henshin.ck@xxxxxxxxx>:
can you please give us an estimate when you think a first version of
the migration tool is ready for testing?
a first version was already done and converted the henshin test rules
just fine. (The version in the SVN might be an intermediate version
and might thus not work, though.) I'm currently working on
implementing the latest model change, which seems to be done right
now, so the new and updated version should be ready later today (and
working) in case I don't find any obvious errors.
The next step is converting the graphical editor files. Do you have
any specification on their structure or file format? (Both old and
(probably?) new versions).
Please also take a look at the henshin 2011 model I'm using for my
transformation and check its correctness.

Felix

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



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


Back to the top