[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Re: Creation Tools for pre-defined Elements

I think I have implemented what you describe. I have an external "template" model file, with "prototype" elements. For each prototype I create a palette entry (controlled by a custom extension point in plugin.xml), and the corresponding tool in the palette can then be used to clone the prototype by dragging out a rectangle or by drag'n dropping it onto the diagram.

I have created custom Command, EditPolicy, EditPolicyProvider, CreationFactory, CreationToolEntry, PaletteDrawer and PaletteProvider classes, i.e. one class for almost every role in the main collaborations in GMF/GEF. It would be great to find a way to contribute this into GMF, as it's a very powerful mechanism. E.g. since the template model file is a standard file (model+diagram pair), new prototypes are easily added and existing ones edited.

I can send the code anybody who's interested, but beware that the code is complex and undocumented.

Hallvard

Guillaume Gauffre wrote:
Hi Martin,

I'm trying to do the same thing I think !?
I want to load/load and replace, some instance of my model by using predefined instances, saved in a repository
I filled the palette with this repository but I don't find the way to configure the corresponding tool !
Do you find anything else since your last message ?


Thanks

Guillaume

Martin Prodanov a écrit :
Thanks for helping Alex,

but the Thing is, that it has to be dinamicly. This means that I have the properties for an Element on external .ecore file. I read this file and then decide how many Palette Entries should I create. I.e. we have "MyElement" and we have a Palette Entry for unspecified "MyElement", but from the external .ecore file, we read that we have there "MyElement" with set properties.In this case we can have i.e. 10 different "MyElements" with different properties and for this 10 "MyElements" we have 10 different Palette Entries. The parsing from the file is already done. I distinguish every Element and I'm at the point where I have to create Pelette Entry, which itself has to have a proper Create Tool.So the problem now is how GMF will work with a Creation Factory which I have written. My Creation Factory can read the properties and the getNewObject() Method gives back the Element from the external .ecore whit set properties. As I have seen GMF passes only "IElementType"s and than decides which Element should EMF create.

I'll be very thankful if somebody can help me with an advice or something

Cheers!

Martin