Using two models in a single project [message #719366] |
Fri, 26 August 2011 20:19 |
Elvis Messages: 15 Registered: May 2011 |
Junior Member |
|
|
Hi Guys,
Would anyone tell me how can I instantiate two models within a single project. example:
Model 1 (Conceptual Diagram):
@namespace(uri="diagramConceptual", prefix="diagramConceptual")
package diagramConceptual;
@gmf.diagram(foo="bar")
class Schema {
val Entity[*] entity_schema;
val Attribute[*] attribute_schema;
val Relationship[*] relationship_schema;
val AttributeLink[*] attributeLink_schema;
val RelationshipLink[*] relationshipLink_schema;
}
@gmf.node(label="name", label.icon="false", figure="rectangle", size="100,50")
class Entity {
attr String name;
}
@gmf.node(label="name", label.icon="false", figure="ellipse", size="100,50")
class Attribute {
attr String name;
}
@gmf.node(label="name", label.icon="false", size="100,50")
class Relationship {
attr String name;
}
@gmf.link(source="source", target="target")
class AttributeLink {
ref Entity[1] source;
ref Attribute[1] target;
}
@gmf.link(source="source", target="target")
class RelationshipLink {
ref Entity[1] source;
ref Relationship[1] target;
}
Model 2 (Class Diagram):
@namespace(uri="diagramClass", prefix="diagramClass")
package diagramClass;
@gmf.diagram(foo="bar")
class Diagram {
val Table[*] table_diagram;
val RelationshipLink[*] relationshipLink_diagram;
}
@gmf.node(label="name", label.icon="false", figure="rectangle")
class Table {
attr String name;
@gmf.compartment(layout="list", collapsible="false")
val Attribute[*] attributes;
}
@gmf.node(label="name,type", figure="rectangle", label.icon="false", label.pattern="{0}:{1}")
class Attribute {
attr String name;
attr String type;
}
@gmf.link(source="source", target="target")
class RelationshipLink {
ref Table[1] source;
ref Table[1] target;
}
How to create a project "DatabaseProject" and after run it and working with two instances "Conceptual Diagram" and "Class Diagram" at the same time?
Thanks very much in advance for your answers!
Elvis
|
|
|
Re: Using two models in a single project [message #719540 is a reply to message #719366] |
Sat, 27 August 2011 17:10 |
|
I'm not quite sure I understood your question. Do you want to generate a GMF editor for each model, but place the code for both models in the same plugins, so you'll only have DatabaseProject, DatabaseProject.edit, DatabaseProject.editor and DatabaseProject.diagram?
In that case, it should be enough to simply place both .emf files in the DatabaseProject project and then generate the GMF editors using Eugenia. I have just tried that and it seems to work.
However, I don't think this would be the cleanest approach. Normally, I would use separate plugins for separate metamodels, so I'd have the ConceptualMetamodel.* plugins and the DiagramMetamodel.* plugins.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03319 seconds