浏览代码

Add Ecore toolbar.

Bentley James Oakes 7 年之前
父节点
当前提交
f4bf1241dd

+ 402 - 0
plugins/exportM2Ecore.js

@@ -0,0 +1,402 @@
+{
+    'interfaces'
+:
+    [{'method': 'POST', 'url=': '/exportM2Ecore'}],
+        'csworker'
+:
+
+    function (resp, method, uri, reqData, wcontext) {
+
+        var actions = [__wHttpReq('GET', '/current.model?wid=' + wcontext.__aswid)];
+
+        _do.chain(actions)(
+            function (asdata) {
+
+                //The generated file will be in the "exported_to_ecore" folder
+                var writeActions = [_fspp.mkdirs('./exported_to_ecore/')];
+
+                _do.chain(writeActions)(
+                    function () {
+
+                        //This variable will contain the lines of the generated files, i.e. the xmi code.
+                        var file_contents = '';
+
+                        //This variable represent the abstract syntax. It contains all the information.
+                        var as = _utils.jsonp(asdata['data']);
+
+                        //This variable will contain the root and all the other elements contained by the root.
+                        var root = {};
+                        var listRoots = [];
+                        var graph = [];
+                        var taken = [];
+                        var listCycle = [];
+
+
+                        /**
+                         This function removes an element of an array.
+                         **/
+                        function remove(array, elem) {
+                            var index = array.indexOf(elem);
+                            if (index !== -1) {
+                                array.splice(index, 1);
+                            }
+                        }
+
+
+                        /**
+                         This function searches if a root exists. A root is a class from which all the other
+                         classes are accessible.
+                         The process :
+                         - find all the classes;
+                         - eliminate all the classes that are the end of a link, that means they are accessible;
+                         - if there are classes that form a cycle, add them all to listNodes;
+                         - if listNodes contains only an element, that is the root. Else, there is no root.
+                         **/
+                        function hasRoot() {
+                            var listNodes = [];
+                            for (var key in as.nodes)
+                                listNodes.push(key);
+                            //removing links node
+                            for (var edge = 0; edge < as.edges.length; edge = edge + 2)
+                                remove(listNodes, as.edges[edge].dest);
+                            //removing accessible classes
+                            for (var edge = 0; edge < as.edges.length; edge = edge + 2) {
+                                if (as.edges[edge].src != as.edges[edge + 1].dest)
+                                    remove(listNodes, as.edges[edge + 1].dest);
+                            }
+                            //if there are graph cycles, add the nodes in listNodes
+                            constructGraph();
+                            for (var edge = 0; edge < as.edges.length; edge = edge + 2) {
+                                var id = as.edges[edge].src;
+                                var cycle = detectCycle(id, id);
+                                if (cycle && !inside(listNodes, id)) {
+                                    listNodes.push(id);
+                                    listCycle.push(id);
+                                }
+                            }
+                            return listNodes;
+                        }
+
+
+                        /**
+                         This function returns the root. If none was found, it will create one.
+                         **/
+                        function setRoot() {
+                            listRoots = hasRoot();
+                            if (listRoots.length == 1)
+                                root = createNode(listRoots[0]);
+                            else
+                                root = createRootClass(listRoots);
+                        }
+
+
+                        /**
+                         This function creates a root and assigns all the possible roots as references.
+                         **/
+                        function createRootClass(list) {
+                            var node = {};
+                            node.name = reqData['root'];
+                            var contain = [];
+                            for (var i = 0; i < list.length; i++)
+                                contain.push(createNode(list[i]));
+                            node.contain = contain;
+                            return node;
+                        }
+
+
+                        /**
+                         This function change all the linkType property of each reference of
+                         the node to containment. The node is the root or a possible one.
+                         **/
+                        function createNode(identifier) {
+                            var node = {};
+                            var elem = as.nodes[identifier];
+                            var linkType = findType(identifier);
+                            if (inside(listRoots, identifier))
+                                node.linkType = linkType + 'Link';
+                            else
+                                node.linkType = linkType;
+                            node.id = identifier;
+                            var keys = Object.keys(elem);
+                            remove(keys, "$type");
+                            var attr = [];
+                            for (var i = 0; i < keys.length; i++)
+                                attr.push(findAttribute(keys[i], identifier));
+                            node.attributes = attr;
+                            node.contain = findContained(identifier);
+                            return node;
+                        }
+
+
+                        /**
+                         This function creates the appropriate indentation.
+                         **/
+                        function space(deep) {
+                            var space = '';
+                            for (var i = 0; i < deep; i++)
+                                space += ' ';
+                            return space;
+                        }
+
+
+                        /**
+                         This function finds the link's type of the attribute given the link's identifier.
+                         Input : identifier
+                         Output : type
+                         **/
+                        function findType(linkIdentifier) {
+                            var midType = as.nodes[linkIdentifier]["$type"].split("/");
+                            var attrType = midType[midType.length - 1];
+                            return attrType;
+                        }
+
+
+                        /**
+                         This function finds all the attributes of an element.
+                         **/
+                        function findAttribute(key, keyDest) {
+                            var attr = {};
+                            attr.name = key;
+                            attr.value = as.nodes[keyDest][key].value;
+                            var attrType = as.nodes[keyDest][key].type;
+                            if (attr.value.length > 0) {
+                                if (attrType.startsWith("list"))
+                                    attr.list = true;
+                                else
+                                    attr.list = false;
+                            }
+                            return attr;
+                        }
+
+
+                        /**
+                         This function finds all the elements contained in another one, in a recursive way.
+                         **/
+                        function findContained(nodeKey) {
+                            var listContained = [];
+                            if (inside(listCycle, nodeKey) && inside(taken, nodeKey))
+                                return [];
+                            for (var k = 0; k < as.edges.length; k++) {
+                                if (nodeKey == as.edges[k].src) {
+                                    if (inside(listCycle, nodeKey))
+                                        taken.push(nodeKey);
+                                    var lien = as.edges[k].dest;
+                                    var keyDest = as.edges[k + 1].dest;
+                                    var linkType = findType(lien);
+                                    var elem = {};
+                                    elem.linkType = linkType;
+                                    elem.attributes = [];
+                                    var keys = Object.keys(as.nodes[keyDest]);
+                                    remove(keys, "$type");
+                                    for (var i = 0; i < keys.length; i++) {
+                                        var attr = findAttribute(keys[i], keyDest);
+                                        if (attr.value.length > 0)
+                                            elem.attributes.push(attr);
+                                    }
+                                    var contain = [];
+                                    if (!isInRoot(keyDest))
+                                        contain = findContained(keyDest);
+                                    elem.contain = contain;
+                                    listContained.push(elem);
+                                }
+                            }
+                            return listContained;
+                        }
+
+
+                        /**
+                         This function returns true if the node, specified by its identifier,
+                         is directly in root.contain, not in one of the subnode.
+                         **/
+                        function isInRoot(key) {
+                            for (var i = 0; i < listCycle.length; i++) {
+                                if (listCycle[i] == key)
+                                    return true;
+                            }
+                            return false;
+                        }
+
+
+                        /**
+                         This function will write the header of the file including the
+                         name of the root and the URI of the metamodel.
+                         **/
+                        function writeHeader() {
+                            var head = '<?xml version="1.0" encoding="ISO-8859-1"?> \n';
+                            head += '<' + root.name;
+                            head += ' xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="' + reqData['uri'] + '"';
+                            if (root.attributes != null)
+                                head += writeAttributes(root, 0);
+                            else
+                                head += '> \n';
+                            return head;
+                        }
+
+
+                        /**
+                         This function writes the attributes of an element.
+                         **/
+                        function writeAttributes(node, deep) {
+                            var attribut = '';
+                            var listAttr = '';
+                            for (var i = 0; i < node.attributes.length; i++) {
+                                var attr = node.attributes[i];
+                                if (attr.list)
+                                    listAttr += writeListAttribute(attr.value, attr.name, deep + 2);
+                                else
+                                    attribut += ' ' + attr.name + '="' + attr.value + '"';
+                            }
+                            attribut += '> \n' + listAttr;
+                            return attribut;
+                        }
+
+
+                        /**
+                         This function writes a list attribute.
+                         **/
+                        function writeListAttribute(list, name, deep) {
+                            var liste = '';
+                            for (var i = 0; i < list.length; i++)
+                                liste += space(deep) + '<' + name + '>' + list[i] + '</' + name + '> \n';
+                            return liste;
+                        }
+
+
+                        /**
+                         This function writes all the contained nodes of the specified node
+                         **/
+                        function writeContained(listContained, deep) {
+                            var contained = '';
+                            for (var i = 0; i < listContained.length; i++) {
+                                contained += space(deep + 2) + '<' + listContained[i].linkType;
+                                var attributes = '';
+                                if (listContained[i].attributes != null) {
+                                }
+                                contained += writeAttributes(listContained[i], deep + 2);
+                                if (listContained[i].contain.length > 0)
+                                    contained += writeContained(listContained[i].contain, deep + 2);
+                                contained += space(deep + 2) + '</' + listContained[i].linkType + '> \n';
+                            }
+                            return contained;
+                        }
+
+
+                        /**
+                         This function will write everything (classes, attributes, references, enumerations)
+                         in a string.
+                         **/
+                        function writeFile() {
+                            file_contents += writeHeader();
+                            file_contents += writeContained(root.contain, 0);
+                            file_contents += '</' + root.name + '>';
+                        }
+
+
+                        /**
+                         This function returns true if the element is in the array.
+                         **/
+                        function inside(array, elem) {
+                            for (var i = 0; i < array.length; i++) {
+                                if (array[i] == elem)
+                                    return true;
+                            }
+                            return false;
+                        }
+
+
+                        /**
+                         This function populates graph. It takes all the classes
+                         and register them in graph. graph is a list.
+                         **/
+                        function constructGraph() {
+                            var list = [];
+                            for (var i = 0; i < as.edges.length; i += 2) {
+                                var src = as.edges[i].src;
+                                if (!inside(list, src)) {
+                                    list.push(src);
+                                    var srcNode = {};
+                                    srcNode.id = src;
+                                    var linked = findLinked(src);
+                                    srcNode.linked = linked;
+                                    graph.push(srcNode);
+                                }
+                            }
+                        }
+
+
+                        /**
+                         This function detects graph cycle.
+                         Input :
+                         - id : the identifier of the actual node;
+                         - initial : the identifier of the first node of the cycle.
+                         Output :
+                         - true : there is a graph cycle;
+                         - false : no graph cycle.
+                         **/
+                        function detectCycle(id, initial) {
+                            for (var i = 0; i < graph.length; i++) {
+                                if (graph[i].id == id) {
+                                    if (inside(graph[i].linked, initial))
+                                        return true;
+                                    else {
+                                        for (var j = 0; j < graph[i].linked.length; j++)
+                                            return detectCycle(graph[i].linked[j], initial);
+                                    }
+                                    return false;
+                                }
+                            }
+                        }
+
+
+                        /**
+                         This function finds all the related class of a class.
+                         **/
+                        function findLinked(src) {
+                            var listLinked = [];
+                            for (var i = 0; i < as.edges.length; i += 2) {
+                                if (as.edges[i].src == src && as.edges[i + 1].dest != src) {
+                                    listLinked.push(as.edges[i + 1].dest);
+                                }
+                            }
+                            return listLinked;
+                        }
+
+
+                        /***************************************************************************************************************************************************************
+                         The following is like the main class of this file. It will call the appropriate functions
+                         in order to create the export file.
+                         ****************************************************************************************************************************************************************/
+                        setRoot();
+                        writeFile();
+
+
+                        _fs.writeFileSync('./exported_to_ecore/' + reqData['name'] + 'Model.xmi', file_contents);
+                        __postMessage({
+                            'statusCode': 200,
+                            'respIndex': resp
+                        });
+
+                    },
+                    function (writeErr) {
+                        __postInternalErrorMsg(resp, writeErr);
+                    }
+                );
+            },
+            function (err) {
+                __postInternalErrorMsg(resp, err);
+            }
+        )
+    }
+
+,
+    'asworker'
+:
+
+    function (resp, method, uri, reqData, wcontext) {
+        __postMessage(
+            {
+                'statusCode': 200,
+                'respIndex': resp
+            });
+    }
+}

+ 619 - 0
plugins/exportMM2Ecore.js

@@ -0,0 +1,619 @@
+{
+    'interfaces'
+:
+    [{'method': 'POST', 'url=': '/exportMM2Ecore'}],
+        'csworker'
+:
+
+    function (resp, method, uri, reqData, wcontext) {
+
+        var actions = [__wHttpReq('GET', '/current.model?wid=' + wcontext.__aswid)];
+
+        _do.chain(actions)(
+            function (asdata) {
+
+                //The generated file will be in the "exported_to_ecore" folder
+                var writeActions = [_fspp.mkdirs('./exported_to_ecore/')];
+
+                _do.chain(writeActions)(
+                    function () {
+
+                        //This variable will contain the lines of the generated files, i.e. the xml code.
+                        var file_contents = '';
+
+                        //This variable will contain the identifier of the root.
+                        var rootNode = null;
+
+                        //This variable represent the abstract syntax. It contains all the information.
+                        var as = _utils.jsonp(asdata['data']);
+
+                        //This variable will contain a list of possible roots
+                        var listRoots = [];
+
+                        //This variable will contain all the classes to be created
+                        var listClasses = [];
+
+                        //This variable will contain all the enumerations to be created
+                        var listEnums = [];
+
+
+                        /**
+                         We create the package that will contain all the classes. The name of the package
+                         is the name of the metamodel, aside of the MM, if apply.
+                         The URI of the metamodel is asked to the user.
+                         **/
+                        var packageName = reqData['name'];
+                        var nsURI = reqData['uri'];
+                        if (reqData['name'].endsWith("MM"))
+                            packageName = packageName.substr(0, packageName.length - 2);
+
+
+                        /**
+                         This object maps how the type is written. For example, in AToMPM it's "string",
+                         while in Ecore it's "EString"
+                         **/
+                        var dataType = {
+                            'string': 'EString',
+                            'int': 'EInt',
+                            'float': 'EFloat',
+                            'boolean': 'EBoolean',
+                            'code': 'EString'
+                        }
+
+
+                        /**
+                         This function removes an element of an array.
+                         **/
+                        function remove(array, elem) {
+                            var index = array.indexOf(elem);
+                            if (index !== -1) {
+                                array.splice(index, 1);
+                            }
+                        }
+
+
+                        /**
+                         This function returns true if the element is in the array.
+                         **/
+                        function inside(array, elem) {
+                            for (var i = 0; i < array.length; i++) {
+                                if (array[i] == elem)
+                                    return true;
+                            }
+                            return false;
+                        }
+
+
+                        /**
+                         This function will search if the class, specified by its identifier (nodeIdentifier), is a
+                         subclass of another one, i.e. if it inherits from another class.
+                         It will return the name of the superclass, if it exists.
+                         If the class has multiple inheritance, it will return the last one that was found since ecore
+                         doesn't allow multiple inheritance.
+                         **/
+                        function findSuperClass(nodeIdentifier) {
+                            var superclassName = null;
+                            var superclassKey = null;
+                            for (var edge in as.edges) {
+                                if (as.edges[edge].src == nodeIdentifier) {
+                                    var linkKey = as.edges[edge].dest;
+                                    if (isInheritanceLink(linkKey))
+                                        superclassKey = linkDestination(linkKey);
+                                }
+                            }
+                            if (superclassKey != null)
+                                superclassName = as.nodes[superclassKey].name.value;
+                            return superclassName;
+                        }
+
+
+                        /**
+                         This function will return the identifier of the destination of a link,
+                         specified by its identifier.
+                         **/
+                        function linkDestination(linkIdentifier) {
+                            var cleDest = null;
+                            for (var dest in as.edges) {
+                                if (as.edges[dest].src == linkIdentifier)
+                                    cleDest = as.edges[dest].dest;
+                            }
+                            return cleDest;
+                        }
+
+
+                        /**
+                         This function will return true if the class is an inheritance link.
+                         It will return false otherwise.
+                         **/
+                        function isInheritanceLink(nodeIdentifier) {
+                            return as.nodes[nodeIdentifier]["$type"].endsWith("Inheritance");
+                        }
+
+
+                        /**
+                         This function will return true if the class is an association link.
+                         It will return false otherwise.
+                         **/
+                        function isAssociationLink(nodeIdentifier) {
+                            return as.nodes[nodeIdentifier]["$type"].endsWith("Association");
+                        }
+
+
+                        /**
+                         This function will return true if the class is an actual class.
+                         It will return false otherwise.
+                         **/
+                        function isClass(nodeIdentifier) {
+                            return as.nodes[nodeIdentifier]["$type"].endsWith("Class");
+                        }
+
+
+                        /**
+                         This function searches if a root exists. A root is a class from which all the other
+                         classes are accessible.
+                         The process :
+                         - find all the classes;
+                         - eliminate all the classes that are the end of a link, that means they are accessible;
+                         - if listNodes contains only an element, that is the root. Else, there is no root.
+                         **/
+                        function hasRoot() {
+                            var listNodes = [];
+                            for (var key in as.nodes) {
+                                if (isClass(key))
+                                    listNodes.push(key);
+                            }
+                            for (var i = 0; i < as.edges.length; i += 2) {
+                                if (as.edges[i].src != as.edges[i + 1].dest)
+                                    remove(listNodes, as.edges[i + 1].dest);
+                            }
+                            return listNodes;
+                        }
+
+
+                        /**
+                         This function returns the root. If none was found, it will create one.
+                         **/
+                        function setRoot() {
+                            listRoots = hasRoot();
+                            if (listRoots.length == 1) {
+                                rootNode = listRoots[0];
+                                reformRootClass(rootNode);
+                            }
+                            else
+                                createRootClass();
+                        }
+
+
+                        /**
+                         This function creates a root and assigns all the possible roots as references.
+                         **/
+                        function createRootClass() {
+                            var root = {};
+                            root.name = packageName + 'Root';
+                            var refers = [];
+                            for (var i = 0; i < listRoots.length; i++) {
+                                reformRootClass(listRoots[i]);
+                                var refType = as.nodes[listRoots[i]].name.value;
+                                var refName = refType + 'Link';
+                                var ref = createEReference(refName, "containment", refType, [1, -1]);
+                                refers.push(ref);
+                            }
+                            root.references = refers;
+                            root.attributes = [];
+                            listClasses.push(root);
+                        }
+
+
+                        /**
+                         This function change all the linkType property of each reference of
+                         the node to containment. The node is the root or a possible one.
+                         **/
+                        function reformRootClass(rootNode) {
+                            var rootClass = createEClass(rootNode);
+                            for (var i = 0; i < rootClass.references.length; i++)
+                                rootClass.references[i].linkType = "containment";
+                            listClasses.push(rootClass);
+                        }
+
+
+                        /**
+                         This function creates an EClassifier.
+                         Input: the identifier of the node
+                         Output: an object with all the needed properties
+                         **/
+                        function createEClass(nodeIdentifier) {
+                            var eClass = {};
+                            var node = as.nodes[nodeIdentifier];
+                            eClass.name = node.name.value;
+                            eClass.abstract = node.abstract.value;
+                            eClass.superclass = findSuperClass(nodeIdentifier);
+                            eClass.references = findReferences(nodeIdentifier);
+                            eClass.attributes = findAttributes(eClass, nodeIdentifier);
+                            return eClass;
+                        }
+
+
+                        /**
+                         This function creates an EReference.
+                         Input: the name, linktype, type and bounds of the reference
+                         Output: an object with all the needed properties
+                         **/
+                        function createEReference(name, linktype, type, bounds) {
+                            var eReference = {};
+                            eReference.name = name;
+                            eReference.linkType = linktype; //containment or visual
+                            if (bounds != null) {
+                                if (bounds[0] != 0)
+                                    eReference.lowerBound = bounds[0];
+                                if (bounds[1] == 'inf')
+                                    eReference.upperBound = -1;
+                                else if (bounds[1] != 1) //else we have the value 1 by default in ecore
+                                    eReference.upperBound = bounds[1];
+                            }
+                            eReference.type = type; //eType, type of the destination class
+                            return eReference;
+                        }
+
+
+                        /**
+                         This function create an EAttribute.
+                         Input: the name, datatype, default value of the attribute and the booleans eenum, map and list
+                         Output: an object with all the needed properties
+                         **/
+                        function createEAttribute(name, datatype, defaultValue, eenum, list, map) {
+                            var eAttribute = {};
+                            eAttribute.name = name;
+                            eAttribute.complexType = (eenum || list || map);
+                            eAttribute.list = list;
+                            eAttribute.eenum = eenum;
+                            eAttribute.map = map;
+                            if (!eAttribute.complexType) {
+                                eAttribute.dataType = dataType[datatype];
+                                if (defaultValue != '')
+                                    eAttribute.defaultValue = defaultValue;
+                            }
+                            else
+                                setDataType(eAttribute, datatype, eenum, list, map, defaultValue);
+                            return eAttribute;
+                        }
+
+
+                        /**
+                         This function is to assign the datatype and related variables to an attribute, but
+                         just for complex types, i.e. list or ENUM.
+                         **/
+                        function setDataType(eAttribute, datatype, eenum, list, map, defaultValue) {
+                            if (list)
+                                setListType(eAttribute, datatype);
+                            else if (eenum)
+                                setEnumType(eAttribute, datatype, defaultValue);
+                            else if (map)
+                                setMapType(eAttribute, datatype, defaultValue);
+                        }
+
+
+                        /**
+                         This function sets the default value and matches the datatype of a list attribute.
+                         The matching types are contained in the object dataType.
+                         **/
+                        function setListType(eAttribute, datatype) {
+                            var listType = datatype.split('<')[1].split('>')[0];
+                            listType = dataType[listType];
+                            eAttribute.dataType = listType;
+                        }
+
+
+                        /**
+                         This function sets the datatype (and the default value?) of an enumeration attribute.
+                         **/
+                        function setEnumType(eAttribute, datatype, defaultValue) {
+                            var name = eAttribute.name;
+                            var nameEnum = name.charAt(0).toUpperCase() + name.slice(1);
+                            eAttribute.dataType = nameEnum;
+                            eAttribute.defaultValue = defaultValue;
+                            createEnumClass(nameEnum, datatype);
+                        }
+
+
+                        /**
+                         This function creates an Enum class related to an enumeration attribute.
+                         **/
+                        function createEnumClass(nameEnum, datatype) {
+                            var eEnum = {};
+                            eEnum.name = nameEnum;
+                            var options = datatype.split('(')[1].split(')')[0];
+                            options = options.split(', ');
+                            eEnum.options = options;
+                            listEnums.push(eEnum);
+                        }
+
+
+                        /**
+                         This function sets the datatype (and the default value?) of a map attribute.
+                         **/
+                        function setMapType(eAttribute, datatype, defaultValue) {
+                            //var keys = datatype.split('[')[1].split(']')[0];
+                            //keys = keys.split(',');
+                            var values = datatype.split(']')[1].split('[')[1].split(']')[0];
+                            values = values.split(',');
+
+                            //for(var i = 0; i < keys.length; i++)
+                            //	createMapClass(keys[i], values[i]);
+                        }
+
+
+                        /**
+                         This function finds all the attributes of a class.
+                         Input: the class identifier
+                         Output: a list of all the attributes of the class
+                         **/
+                        function findAttributes(classe, nodeIdentifier) {
+                            var attributesList = [];
+                            var node = as.nodes[nodeIdentifier].attributes['value'];
+                            for (var attr in node) {
+                                var name = node[attr].name;
+                                var defaultValue = node[attr]['default'];
+                                var datatype = node[attr].type;
+                                var eenum = false;
+                                var list = false;
+                                var map = false;
+                                if (datatype.startsWith("list"))
+                                    list = true;
+                                else if (datatype.startsWith("ENUM"))
+                                    eenum = true;
+                                else if (datatype.startsWith("map"))
+                                    map = true;
+                                var attribute = createEAttribute(name, datatype, defaultValue, eenum, list, map);
+                                attributesList.push(attribute);
+                            }
+                            return attributesList;
+                        }
+
+
+                        /**
+                         This function finds the cardinalities of a reference.
+                         Input: the class identifier (nodeIdentifier) and the reference name
+                         Output: a list of bounds (min and max)
+                         **/
+                        function findCardinalities(nodeIdentifier, referenceName) {
+                            var bounds = [];
+                            var cardinal = as.nodes[nodeIdentifier].cardinalities['value'];
+                            for (var car in cardinal) {
+                                if (cardinal[car].type == referenceName) {
+                                    bounds.push(cardinal[car].min);
+                                    bounds.push(cardinal[car].max);
+                                }
+                            }
+                            return bounds;
+                        }
+
+
+                        /**
+                         This function finds all the references of a class.
+                         Input: the class identifier
+                         Output: a list of all the references of the class
+                         **/
+                        function findReferences(nodeIdentifier) {
+                            var referencesList = [];
+                            for (var edge in as.edges) {
+                                if (as.edges[edge].src == nodeIdentifier) {
+                                    var linkKey = as.edges[edge].dest;
+                                    if (isAssociationLink(linkKey)) {
+                                        var name = as.nodes[linkKey].name.value;
+                                        var linktype = as.nodes[linkKey].linktype['value'];
+                                        if (nodeIdentifier == rootNode || inside(listRoots, nodeIdentifier))
+                                            linktype = "containment";
+                                        var bounds = findCardinalities(nodeIdentifier, name);
+                                        var dest = linkDestination(linkKey);
+                                        var type = as.nodes[dest].name.value;
+                                        var reference = createEReference(name, linktype, type, bounds);
+                                        referencesList.push(reference);
+                                    }
+                                }
+                            }
+                            return referencesList;
+                        }
+
+
+                        /**
+                         This function returns what's to be written in the file in the beginning, including the
+                         package's name and the URI.
+                         **/
+                        function writeHeader() {
+                            var header = '<?xml version="1.0" encoding="UTF-8"?> \n';
+                            header += '<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" \n';
+                            header += '    xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="' + packageName;
+                            header += '" nsURI="' + nsURI + '" nsPrefix="' + packageName + '"> \n';
+                            return header;
+                        }
+
+
+                        /**
+                         This function returns what's to be written in the file in the case of an EClass.
+                         **/
+                        function writeEClassifier(classe) {
+                            var classLine = '  <eClassifiers xsi:type="ecore:EClass" name="' + classe.name;
+                            if (classe.abstract)
+                                classLine += '" abstract="true';
+                            if (classe.superclass != null)
+                                classLine += '" eSuperTypes="#//' + classe.superclass;
+                            if (classe.attributes.length > 0 || classe.references.length > 0) {
+                                classLine += '"> \n';
+                                for (var i = 0; i < classe.attributes.length; i++)
+                                    classLine += writeEAttribute(classe.attributes[i]);
+                                for (var i = 0; i < classe.references.length; i++)
+                                    classLine += writeEReference(classe.references[i]);
+                                classLine += '  </eClassifiers> \n';
+                            }
+                            else
+                                classLine += '"/> \n';
+                            return classLine;
+                        }
+
+
+                        /**
+                         This function returns what's to be written in the file in the case of an EAttribute.
+                         **/
+                        function writeEAttribute(attr) {
+                            var attrLine = '    <eStructuralFeatures xsi:type="ecore:EAttribute" name="' + attr.name;
+                            if (attr.map)
+                                attrLine += writeMapAttribute(attr);
+                            else {
+                                if (attr.list)
+                                    attrLine += '" upperBound="-1';
+                                if (attr.list || !(attr.complexType))
+                                    attrLine += '" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//' + attr.dataType;
+                                if (attr.eenum)
+                                    attrLine += '" eType="#//' + attr.dataType;
+                                if (attr.defaultValue != null)
+                                    attrLine += '" defaultValueLiteral="' + attr.defaultValue;
+                                attrLine += '"/> \n';
+                            }
+                            return attrLine;
+                        }
+
+
+                        /**
+                         This function returns what's to be written in a Map attribute.
+                         **/
+                        function writeMapAttribute(attr) {
+                            var mapAttr = '';
+                            mapAttr += '" upperBound="-1" transient="true"> \n';
+                            mapAttr += writeEGenericType("EMap");
+                            mapAttr += '    </eStructuralFeatures> \n';
+                            return mapAttr;
+                        }
+
+
+                        /**
+                         This function returns what's to be written in a GenericType.
+                         **/
+                        function writeEGenericType(datatype) {
+                            var gentype = '        <eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//';
+                            gentype += datatype + '"> \n';
+                            gentype += writeETypeArguments(["EEList", "EString"]);
+                            gentype += writeETypeArguments(["EEList", "EDataType"]);
+                            gentype += '        </eGenericType> \n';
+                            return gentype;
+                        }
+
+
+                        /**
+                         This function returns what's to be written in a ETypeArguments.
+                         **/
+                        function writeETypeArguments(types) {
+                            var typeArg = '            <eTypeArguments eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//';
+                            typeArg += types[0] + '"> \n';
+                            typeArg += writeSingleETypeArguments(types[1]);
+                            typeArg += '            </eTypeArguments> \n';
+                            return typeArg;
+                        }
+
+
+                        /**
+                         This function returns what's to be written in a ETypeArguments.
+                         **/
+                        function writeSingleETypeArguments(type) {
+                            var singleTypeArg = '                <eTypeArguments eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//';
+                            singleTypeArg += type + '"/> \n';
+                            return singleTypeArg;
+                        }
+
+
+                        /**
+                         This function returns what's to be written in the file in the case of an EReference.
+                         **/
+                        function writeEReference(ref) {
+                            var refLine = '    <eStructuralFeatures xsi:type="ecore:EReference" name="' + ref.name;
+                            if (ref.lowerBound != null)
+                                refLine += '" lowerBound="' + ref.lowerBound;
+                            if (ref.upperBound != null)
+                                refLine += '" upperBound="' + ref.upperBound;
+                            refLine += '" eType="#//' + ref.type;
+                            if (ref.linkType == "containment")
+                                refLine += '" containment="true';
+                            refLine += '"/> \n';
+                            return refLine;
+                        }
+
+
+                        /**
+                         This function returns what's to be written in the file in the case of an EEnum.
+                         **/
+                        function writeEEnum(enume) {
+                            var enumLine = '  <eClassifiers xsi:type="ecore:EEnum" name="' + enume.name + '"> \n';
+                            for (var i = 0; i < enume.options.length; i++)
+                                enumLine += '    <eLiterals name="' + enume.options[i] + '"/> \n';
+                            enumLine += '  </eClassifiers> \n';
+                            return enumLine;
+                        }
+
+
+                        /**
+                         This function creates the classes then put them in the variable listClasses.
+                         **/
+                        function populateListClasses() {
+                            for (var node in as.nodes) {
+                                if (!(inside(listRoots, node)) && isClass(node)) {
+                                    var eclass = createEClass(node);
+                                    listClasses.push(eclass);
+                                }
+                            }
+                        }
+
+
+                        /**
+                         This function will write everything (classes, attributes, references, enumerations)
+                         in a string.
+                         **/
+                        function writeFile() {
+                            file_contents += writeHeader();
+                            for (var i = 0; i < listClasses.length; i++)
+                                file_contents += writeEClassifier(listClasses[i]);
+                            for (var i = 0; i < listEnums.length; i++)
+                                file_contents += writeEEnum(listEnums[i]);
+                            file_contents += '</ecore:EPackage>';
+                        }
+
+
+                        /****************************************************************************************************************************************************************
+                         The following is like the main class of this file. It will call the appropriate functions
+                         in order to create the export file.
+                         ****************************************************************************************************************************************************************/
+                        //creation of root and, if apply, possible roots
+                        setRoot();
+                        //creation of classes, including their attributes and references
+                        populateListClasses();
+                        //write the file
+                        writeFile();
+
+
+                        _fs.writeFileSync('./exported_to_ecore/' + packageName + 'Metamodel.ecore', file_contents);
+                        __postMessage({
+                            'statusCode': 200,
+                            'respIndex': resp
+                        });
+                    },
+                    function (writeErr) {
+                        __postInternalErrorMsg(resp, writeErr);
+                    }
+                );
+            },
+            function (err) {
+                __postInternalErrorMsg(resp, err);
+            }
+        )
+    }
+
+,
+    'asworker'
+:
+
+    function (resp, method, uri, reqData, wcontext) {
+        __postMessage(
+            {
+                'statusCode': 200,
+                'respIndex': resp
+            });
+    }
+}

+ 19 - 0
users/(default)/Models/Ecore/EditModelModel.xmi

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="ISO-8859-1"?> 
+<undefined xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="http://EditModel"> 
+  <ParametersLink parameterList=""> 
+  </ParametersLink> 
+  <InitialNodeLink current="false"> 
+    <Link extension="model" name="Open Model"> 
+      <Link Message="Modify the model manually" name="Edit Model"> 
+        <Link extension="model" name="Save Model"> 
+          <Link> 
+          </Link> 
+        </Link> 
+      </Link> 
+      <Dependency extension="model" name="Save Model"> 
+        <Link> 
+        </Link> 
+      </Dependency> 
+    </Link> 
+  </InitialNodeLink> 
+</undefined>

文件差异内容过多而无法显示
+ 4336 - 0
users/(default)/Models/Ecore/TestMetamodel.model


+ 44 - 0
users/(default)/Models/Ecore/TestMetamodelMetamodel.ecore

@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?> 
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+    xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="TestMetamodel" nsURI="http://TestMetamodel" nsPrefix="TestMetamodel"> 
+  <eClassifiers xsi:type="ecore:EClass" name="Alone"/> 
+  <eClassifiers xsi:type="ecore:EClass" name="AloneAttr"> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="int" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="string" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" defaultValueLiteral="Hola"/> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="float" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloat"/> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="boolean" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean" defaultValueLiteral="true"/> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="code" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="file_html" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//undefined"/> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="map_int_string" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//undefined"/> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="list_int" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//undefined" defaultValueLiteral="1,2"/> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="enum" eType="#//Enum"/> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="enum2" eType="#//Enum2"/> 
+  </eClassifiers> 
+  <eClassifiers xsi:type="ecore:EClass" name="Source"> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="OneToOne" lowerBound="1" eType="#//TargetAbstract" containment="true"/> 
+  </eClassifiers> 
+  <eClassifiers xsi:type="ecore:EClass" name="Sub1" eSuperTypes="#//TargetAbstract"> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="ManyToOne" eType="#//TargetMany" containment="true"/> 
+  </eClassifiers> 
+  <eClassifiers xsi:type="ecore:EClass" name="Sub2" eSuperTypes="#//TargetAbstract"> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="Containment" eType="#//Composite" containment="true"/> 
+  </eClassifiers> 
+  <eClassifiers xsi:type="ecore:EClass" name="TestMetamodelRoot"> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="AloneLink" lowerBound="1" upperBound="-1" eType="#//Alone" containment="true"/> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="AloneAttrLink" lowerBound="1" upperBound="-1" eType="#//AloneAttr" containment="true"/> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="SourceLink" lowerBound="1" upperBound="-1" eType="#//Source" containment="true"/> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="Sub1Link" lowerBound="1" upperBound="-1" eType="#//Sub1" containment="true"/> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="Sub2Link" lowerBound="1" upperBound="-1" eType="#//Sub2" containment="true"/> 
+  </eClassifiers> 
+  <eClassifiers xsi:type="ecore:EClass" name="TargetAbstract" abstract="true"> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> 
+  </eClassifiers> 
+  <eClassifiers xsi:type="ecore:EClass" name="TargetMany"/> 
+  <eClassifiers xsi:type="ecore:EClass" name="Composite"/> 
+  <eClassifiers xsi:type="ecore:EEnum" name="Enum"> 
+    <eLiterals name="One,Two,Three"/> 
+  </eClassifiers> 
+  <eClassifiers xsi:type="ecore:EEnum" name="Enum2"> 
+    <eLiterals name="Four,Five,Six,Seven"/> 
+  </eClassifiers> 
+</ecore:EPackage>

+ 87 - 0
users/(default)/Models/Ecore/WorkflowsMetamodel.ecore

@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?> 
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+    xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="Workflows" nsURI="http://WorkflowsMM" nsPrefix="Workflows"> 
+  <eClassifiers xsi:type="ecore:EClass" name="InitialNode" eSuperTypes="#//ControlNode"/> 
+  <eClassifiers xsi:type="ecore:EClass" name="FinalNode" eSuperTypes="#//ControlNode"/> 
+  <eClassifiers xsi:type="ecore:EClass" name="JoinNode" eSuperTypes="#//ControlNode"> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt" defaultValueLiteral="1"/> 
+  </eClassifiers> 
+  <eClassifiers xsi:type="ecore:EClass" name="ForkNode" eSuperTypes="#//ControlNode"> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt" defaultValueLiteral="1"/> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="Flow" eType="#//Task" containment="true"/> 
+  </eClassifiers> 
+  <eClassifiers xsi:type="ecore:EClass" name="EditModel" eSuperTypes="#//ManualTask"/> 
+  <eClassifiers xsi:type="ecore:EClass" name="OpenModel" eSuperTypes="#//AutoTask"> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="Location@2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="extension" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> 
+  </eClassifiers> 
+  <eClassifiers xsi:type="ecore:EClass" name="SaveModel" eSuperTypes="#//AutoTask"> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="Location@2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="extension" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> 
+  </eClassifiers> 
+  <eClassifiers xsi:type="ecore:EClass" name="VerifyAS" eSuperTypes="#//AutoTask"/> 
+  <eClassifiers xsi:type="ecore:EClass" name="OpenTransformation" eSuperTypes="#//AutoTask"> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="Location@2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="extension" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> 
+  </eClassifiers> 
+  <eClassifiers xsi:type="ecore:EClass" name="ExecTransformation" eSuperTypes="#//AutoTask"> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="Mode" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" defaultValueLiteral="play"/> 
+  </eClassifiers> 
+  <eClassifiers xsi:type="ecore:EClass" name="Parameters"> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="parameterList" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> 
+  </eClassifiers> 
+  <eClassifiers xsi:type="ecore:EClass" name="LoadToolbar" eSuperTypes="#//AutoTask"> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="Location@2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="extension" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> 
+  </eClassifiers> 
+  <eClassifiers xsi:type="ecore:EClass" name="GenerateAS" eSuperTypes="#//AutoTask"> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="Location@2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> 
+  </eClassifiers> 
+  <eClassifiers xsi:type="ecore:EClass" name="GenerateCS" eSuperTypes="#//AutoTask"> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="Location@2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> 
+  </eClassifiers> 
+  <eClassifiers xsi:type="ecore:EClass" name="GeneratePMM" eSuperTypes="#//AutoTask"> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="Location@2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="extension" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> 
+  </eClassifiers> 
+  <eClassifiers xsi:type="ecore:EClass" name="IterationNode" eSuperTypes="#//DecisionNode"> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="iterations" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt" defaultValueLiteral="1"/> 
+  </eClassifiers> 
+  <eClassifiers xsi:type="ecore:EClass" name="WorkflowsRoot"> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="InitialNodeLink" lowerBound="1" upperBound="-1" eType="#//InitialNode" containment="true"/> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="FinalNodeLink" lowerBound="1" upperBound="-1" eType="#//FinalNode" containment="true"/> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="JoinNodeLink" lowerBound="1" upperBound="-1" eType="#//JoinNode" containment="true"/> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="ForkNodeLink" lowerBound="1" upperBound="-1" eType="#//ForkNode" containment="true"/> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="EditModelLink" lowerBound="1" upperBound="-1" eType="#//EditModel" containment="true"/> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="OpenModelLink" lowerBound="1" upperBound="-1" eType="#//OpenModel" containment="true"/> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="SaveModelLink" lowerBound="1" upperBound="-1" eType="#//SaveModel" containment="true"/> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="VerifyASLink" lowerBound="1" upperBound="-1" eType="#//VerifyAS" containment="true"/> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="OpenTransformationLink" lowerBound="1" upperBound="-1" eType="#//OpenTransformation" containment="true"/> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="ExecTransformationLink" lowerBound="1" upperBound="-1" eType="#//ExecTransformation" containment="true"/> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="ParametersLink" lowerBound="1" upperBound="-1" eType="#//Parameters" containment="true"/> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="LoadToolbarLink" lowerBound="1" upperBound="-1" eType="#//LoadToolbar" containment="true"/> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="GenerateASLink" lowerBound="1" upperBound="-1" eType="#//GenerateAS" containment="true"/> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="GenerateCSLink" lowerBound="1" upperBound="-1" eType="#//GenerateCS" containment="true"/> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="GeneratePMMLink" lowerBound="1" upperBound="-1" eType="#//GeneratePMM" containment="true"/> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="IterationNodeLink" lowerBound="1" upperBound="-1" eType="#//IterationNode" containment="true"/> 
+  </eClassifiers> 
+  <eClassifiers xsi:type="ecore:EClass" name="Element" abstract="true"> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="current" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="Link" eType="#//Element"/> 
+  </eClassifiers> 
+  <eClassifiers xsi:type="ecore:EClass" name="Task" abstract="true" eSuperTypes="#//Element"> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="Dependency" eType="#//Task"/> 
+  </eClassifiers> 
+  <eClassifiers xsi:type="ecore:EClass" name="ControlNode" abstract="true" eSuperTypes="#//Element"/> 
+  <eClassifiers xsi:type="ecore:EClass" name="AutoTask" abstract="true" eSuperTypes="#//Task"/> 
+  <eClassifiers xsi:type="ecore:EClass" name="ManualTask" eSuperTypes="#//Task"> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="Message" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" defaultValueLiteral="0"/> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="Duration" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt" defaultValueLiteral="1000"/> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="Executing" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> 
+  </eClassifiers> 
+  <eClassifiers xsi:type="ecore:EClass" name="DecisionNode" eSuperTypes="#//ControlNode"> 
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="condition" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> 
+    <eStructuralFeatures xsi:type="ecore:EReference" name="Alternative" eType="#//Task"/> 
+  </eClassifiers> 
+</ecore:EPackage>

+ 237 - 0
users/(default)/Models/Ecore/pacmanModel.xmi

@@ -0,0 +1,237 @@
+<?xml version="1.0" encoding="ISO-8859-1"?> 
+<undefined xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="http://pacman.org"> 
+  <ScoreboardLink score="0"> 
+  </ScoreboardLink> 
+  <GridNodeLink> 
+    <position>273</position> 
+    <position>174</position> 
+    <left> 
+      <position>373</position> 
+      <position>174</position> 
+    </left> 
+    <top> 
+      <position>273</position> 
+      <position>274</position> 
+    </top> 
+    <GoG type="pinky"> 
+      <position>299</position> 
+      <position>200</position> 
+    </GoG> 
+  </GridNodeLink> 
+  <GridNodeLink> 
+    <position>373</position> 
+    <position>174</position> 
+    <right> 
+      <position>273</position> 
+      <position>174</position> 
+    </right> 
+    <left> 
+      <position>473</position> 
+      <position>174</position> 
+    </left> 
+    <top> 
+      <position>373</position> 
+      <position>274</position> 
+    </top> 
+  </GridNodeLink> 
+  <GridNodeLink> 
+    <position>473</position> 
+    <position>174</position> 
+    <right> 
+      <position>373</position> 
+      <position>174</position> 
+    </right> 
+    <left> 
+      <position>573</position> 
+      <position>174</position> 
+    </left> 
+    <top> 
+      <position>473</position> 
+      <position>274</position> 
+    </top> 
+  </GridNodeLink> 
+  <GridNodeLink> 
+    <position>573</position> 
+    <position>174</position> 
+    <right> 
+      <position>473</position> 
+      <position>174</position> 
+    </right> 
+    <left> 
+      <position>673</position> 
+      <position>174</position> 
+    </left> 
+    <top> 
+      <position>573</position> 
+      <position>274</position> 
+    </top> 
+  </GridNodeLink> 
+  <GridNodeLink> 
+    <position>773</position> 
+    <position>174</position> 
+    <left> 
+      <position>873</position> 
+      <position>174</position> 
+    </left> 
+    <right> 
+      <position>673</position> 
+      <position>174</position> 
+    </right> 
+    <top> 
+      <position>773</position> 
+      <position>274</position> 
+    </top> 
+  </GridNodeLink> 
+  <GridNodeLink> 
+    <position>873</position> 
+    <position>174</position> 
+    <right> 
+      <position>773</position> 
+      <position>174</position> 
+    </right> 
+    <top> 
+      <position>873</position> 
+      <position>274</position> 
+    </top> 
+    <FoG points="1"> 
+      <position>943</position> 
+      <position>217</position> 
+    </FoG> 
+  </GridNodeLink> 
+  <GridNodeLink> 
+    <position>673</position> 
+    <position>174</position> 
+    <left> 
+      <position>773</position> 
+      <position>174</position> 
+    </left> 
+    <right> 
+      <position>573</position> 
+      <position>174</position> 
+    </right> 
+    <top> 
+      <position>673</position> 
+      <position>274</position> 
+    </top> 
+    <FoG points="1"> 
+      <position>743</position> 
+      <position>217</position> 
+    </FoG> 
+  </GridNodeLink> 
+  <GridNodeLink> 
+    <position>773</position> 
+    <position>274</position> 
+    <left> 
+      <position>873</position> 
+      <position>274</position> 
+    </left> 
+    <right> 
+      <position>673</position> 
+      <position>274</position> 
+    </right> 
+    <bottom> 
+      <position>773</position> 
+      <position>174</position> 
+    </bottom> 
+  </GridNodeLink> 
+  <GridNodeLink> 
+    <position>673</position> 
+    <position>274</position> 
+    <right> 
+      <position>573</position> 
+      <position>274</position> 
+    </right> 
+    <left> 
+      <position>773</position> 
+      <position>274</position> 
+    </left> 
+    <bottom> 
+      <position>673</position> 
+      <position>174</position> 
+    </bottom> 
+    <FoG points="1"> 
+      <position>743</position> 
+      <position>317</position> 
+    </FoG> 
+  </GridNodeLink> 
+  <GridNodeLink> 
+    <position>373</position> 
+    <position>274</position> 
+    <left> 
+      <position>473</position> 
+      <position>274</position> 
+    </left> 
+    <right> 
+      <position>273</position> 
+      <position>274</position> 
+    </right> 
+    <bottom> 
+      <position>373</position> 
+      <position>174</position> 
+    </bottom> 
+  </GridNodeLink> 
+  <GridNodeLink> 
+    <position>573</position> 
+    <position>274</position> 
+    <left> 
+      <position>673</position> 
+      <position>274</position> 
+    </left> 
+    <right> 
+      <position>473</position> 
+      <position>274</position> 
+    </right> 
+    <bottom> 
+      <position>573</position> 
+      <position>174</position> 
+    </bottom> 
+  </GridNodeLink> 
+  <GridNodeLink> 
+    <position>873</position> 
+    <position>274</position> 
+    <right> 
+      <position>773</position> 
+      <position>274</position> 
+    </right> 
+    <bottom> 
+      <position>873</position> 
+      <position>174</position> 
+    </bottom> 
+    <GoG type="pinky"> 
+      <position>899</position> 
+      <position>300</position> 
+    </GoG> 
+  </GridNodeLink> 
+  <GridNodeLink> 
+    <position>473</position> 
+    <position>274</position> 
+    <right> 
+      <position>373</position> 
+      <position>274</position> 
+    </right> 
+    <left> 
+      <position>573</position> 
+      <position>274</position> 
+    </left> 
+    <bottom> 
+      <position>473</position> 
+      <position>174</position> 
+    </bottom> 
+    <PoG> 
+      <position>499</position> 
+      <position>300</position> 
+    </PoG> 
+  </GridNodeLink> 
+  <GridNodeLink> 
+    <position>273</position> 
+    <position>274</position> 
+    <left> 
+      <position>373</position> 
+      <position>274</position> 
+    </left> 
+    <bottom> 
+      <position>273</position> 
+      <position>174</position> 
+    </bottom> 
+  </GridNodeLink> 
+</undefined>

+ 19 - 0
users/(default)/Models/Ecore/sample2Model.xmi

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="ISO-8859-1"?> 
+<undefined xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="http://sample2"> 
+  <InputEventsLink eventList=""> 
+  </InputEventsLink> 
+  <InputEventsLink eventList="aaaaaaaaaaaaaaaaaaaabbbbbbbbbbbababababab"> 
+  </InputEventsLink> 
+  <StateLink name="S_PowerOn" current="true"> 
+    <Transition name="S_PowerOff"> 
+    </Transition> 
+    <Transition name="S_PowerOn"> 
+    </Transition> 
+  </StateLink> 
+  <StateLink name="S_PowerOff" current="false"> 
+    <Transition name="S_PowerOn"> 
+    </Transition> 
+    <Transition name="S_PowerOff"> 
+    </Transition> 
+  </StateLink> 
+</undefined>

文件差异内容过多而无法显示
+ 412 - 0
users/(default)/Toolbars/Ecore/Export2Ecore.buttons.model


二进制
users/(default)/Toolbars/Ecore/ExportM2Ecore.icon.png


二进制
users/(default)/Toolbars/Ecore/ExportMM2Ecore.icon.png