Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How does one create pre-defined fixed elements/figures?
How does one create pre-defined fixed elements/figures? [message #65143] Wed, 18 October 2006 13:02 Go to next message
Michael Moser is currently offline Michael MoserFriend
Messages: 914
Registered: July 2009
Senior Member
For my application I would like to have the graphical editor come up
with two predefined containers (I fancy two large labeled rectangles)
inside which the user then starts creating sub-elements and connecting
them, etc.

This corresponds to two top-level elements that *always* have to be
present in the XML files that I am dealing with. I don't want to have to
create these outermost elements, they simply should be there right from
the begin (i.e. even if creating an new "empty" file or model).

Can one create such fixed and predefined figures? How?

Michael
Re: How does one create pre-defined fixed elements/figures? [message #65230 is a reply to message #65143] Wed, 18 October 2006 13:39 Go to previous messageGo to next message
Michael Golubev is currently offline Michael GolubevFriend
Messages: 383
Registered: July 2009
Senior Member
Hi,

You may remove tool references for this "fixed" mappings in the Map model,
effectively removing creation tools for them.
Then write custom code that creates this 2 fixed elements in the generated
<Model>DiagramEditorUtil#createInitialModel(), something like

/**
* Create a new instance of domain element associated with canvas.
* @generated NOT
*/
private static org.eclipse.uml2.uml.Package createInitialModel() {
org.eclipse.uml2.uml.Package root = UMLFactory.eINSTANCE.createModel();
root.setName("Model");
createDefaultPrimitiveTypeImports(root);
return root;
}

Regards,
Michael

"Michael Moser" <mmo@zurich.ibm.com> wrote in message
news:eh58lc$760$1@utils.eclipse.org...
> For my application I would like to have the graphical editor come up with
> two predefined containers (I fancy two large labeled rectangles) inside
> which the user then starts creating sub-elements and connecting them, etc.
>
> This corresponds to two top-level elements that *always* have to be
> present in the XML files that I am dealing with. I don't want to have to
> create these outermost elements, they simply should be there right from
> the begin (i.e. even if creating an new "empty" file or model).
>
> Can one create such fixed and predefined figures? How?
>
> Michael
>
Re: How does one create pre-defined fixed elements/figures? [message #65251 is a reply to message #65230] Wed, 18 October 2006 13:59 Go to previous message
Michael Moser is currently offline Michael MoserFriend
Messages: 914
Registered: July 2009
Senior Member
Wow - *that* was easy! And it worked on the first try... unbelievable!

Thanks!
Michael :-)


"Michael Golubev" <michael.golubev@borland.com> wrote in message
news:eh5arh$3l4$1@utils.eclipse.org...
> Hi,
>
> You may remove tool references for this "fixed" mappings in the Map
> model, effectively removing creation tools for them.
> Then write custom code that creates this 2 fixed elements in the
> generated <Model>DiagramEditorUtil#createInitialModel(), something
> like
>
> /**
> * Create a new instance of domain element associated with canvas.
> * @generated NOT
> */
> private static org.eclipse.uml2.uml.Package createInitialModel() {
> org.eclipse.uml2.uml.Package root =
> UMLFactory.eINSTANCE.createModel();
> root.setName("Model");
> createDefaultPrimitiveTypeImports(root);
> return root;
> }
>
> Regards,
> Michael
>
> "Michael Moser" <mmo@zurich.ibm.com> wrote in message
> news:eh58lc$760$1@utils.eclipse.org...
>> For my application I would like to have the graphical editor come up
>> with two predefined containers (I fancy two large labeled rectangles)
>> inside which the user then starts creating sub-elements and
>> connecting them, etc.
>>
>> This corresponds to two top-level elements that *always* have to be
>> present in the XML files that I am dealing with. I don't want to have
>> to create these outermost elements, they simply should be there right
>> from the begin (i.e. even if creating an new "empty" file or model).
>>
>> Can one create such fixed and predefined figures? How?
>>
>> Michael
>>
>
>
Previous Topic:Compile error in code generated from the GMF tutorial's mindmap example.
Next Topic:How to replace the view of an existing element
Goto Forum:
  


Current Time: Sat Jul 27 12:45:36 GMT 2024

Powered by FUDForum. Page generated in 0.03706 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top