Skip to main content



      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 09:02 Go to next message
Eclipse UserFriend
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 09:39 Go to previous messageGo to next message
Eclipse UserFriend
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 09:59 Go to previous message
Eclipse UserFriend
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 May 10 11:17:17 EDT 2025

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

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

Back to the top