MetaCase Homepage
Forum Home Forum Home > > MetaEdit+
  New Posts New Posts RSS Feed - How to move models between projects?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to move models between projects?

 Post Reply Post Reply
Author
Message
alev View Drop Down
Contributor
Contributor
Avatar

Joined: 08.Oct.2010
Location: Arnhem, NL
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote alev Quote  Post ReplyReply Direct Link To This Post Topic: How to move models between projects?
    Posted: 12.Apr.2011 at 13:49
Hi,

I am using a ME repository to keep all models that are relevant for a single system development. Within the repository I defined a few project to keep my models organized. The trouble is that sometimes I create models in a wrong project (which is quite easy because models/graphs are not created in the project currently open/active, but in the so called 'default' project).

I could not find any option to correct such mistakes, except for import/export routine (which is IMO an overkill). So my question is is there a simple way to move models between projects?

Thank you.
Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 643
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevek Quote  Post ReplyReply Direct Link To This Post Posted: 12.Apr.2011 at 14:40
To move a graph to another project, choose the desired project as default in Graph Browser, select the graph and choose Duplicate / Replace Graph from its pop-up menu. That will create a new copy of the graph in the project you want, and you can delete the old graph.

The options in the Replace dialog will let you choose how to handle reuse and reference. Assuming the graph contains only new objects which are not reused elsewhere, you can just choose Deep Copy. If there are already other graphs that point to this graph, you'll want to make sure they point to the new graph copy, so you should add your top-level graph into the "In" list, which lists the context in which to replace references to the original graph with references to the new copy.

If you want all graphs of a certain type to be stored in a certain project, you can display a warning if the user creates one in the wrong project, e.g. by making its name display prefixed with "???". Open the graph type in a Graph Tool, and choose Tools | Set Identifier Generator. E.g. for Watch Application in the Digital Watch example I could write:

if project <> 'Digital Watch' then '???' endif
:Application name;

Note the use of the property name in the last line, rather than just "id" - trying to ask an element's "id" in that same element's identifier generator will lead to an infinite recursion. Obvious when you think about it, but we've all done it!
Back to Top
alev View Drop Down
Contributor
Contributor
Avatar

Joined: 08.Oct.2010
Location: Arnhem, NL
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote alev Quote  Post ReplyReply Direct Link To This Post Posted: 13.Apr.2011 at 12:39
Thank you Steven.

It kind of works: the procedure duplicates a lot more then my expectation is. However I can work with it :).

Cheers!
Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 643
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevek Quote  Post ReplyReply Direct Link To This Post Posted: 13.Apr.2011 at 12:57
...and you can probably now see why this isn't something that MetaEdit+ can completely automate: for some objects you want to duplicate them, for others you want to refer to the existing object. If the overwhelming majority need duplicating, it may be best to use deep copy, and then use Replace for individual objects to make them refer to the existing objects. Otherwise, it may be best to use Copy to level 1 (just the graph), and then use Replace for individual objects to duplicate them.

In any case, users quickly learn it's easiest to simply check that they have chosen the correct default project. If they make a mistake, they can correct it in any of several ways: Undo, Abandon, Duplicate/Replace, or import/export. But checking the default project is much faster and easier!


Edited by stevek - 13.Apr.2011 at 12:58
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.05
Copyright ©2001-2022 Web Wiz Ltd.

This page was generated in 0.070 seconds.