Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to dynamically extend palette
How to dynamically extend palette [message #164321] Wed, 05 December 2007 05:24 Go to next message
sam is currently offline samFriend
Messages: 20
Registered: July 2009
Junior Member
Hi, there,

Suppose I have an object "service" in my domain model, I also defined
corresponding graph and tool element in "gmfgraph" and "gmftool" file. In
reality, there may be many different services which are the instance of
"service" with different values. My question is how I can extend palette
to include the services dynamically and programmatically, since only until
the application runs, can I know the instances of all the service. That
means I can't define them through tooling and mapping.

By the way, as a test, I tried to define them statically. First, I create
the corresponding entries in the palette through modifying "gmftool" file.
Second, I add new node mapping by mapping the domain element "service" to
the corresponding entry in the palette and to the same "service" graph
definition. The wired thing is that I can drag and drop the services from
the palette to the canvas, however, they won't show up until I add or move
or delete some other elements. It seems a refreshing problem, but I am not
sure. Any idea to solve this problem?

My GMF is 2.01.

Thank you very much for the great help!
Sam
Re: How to dynamically extend palette [message #164398 is a reply to message #164321] Wed, 05 December 2007 14:22 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello sam,

> instance of "service" with different values. My question is how I can
> extend palette to include the services dynamically and
Try implementing IPaletteProvider.

-----------------
Alex Shatalin
Re: How to dynamically extend palette [message #164482 is a reply to message #164398] Thu, 06 December 2007 01:04 Go to previous messageGo to next message
sam is currently offline samFriend
Messages: 20
Registered: July 2009
Junior Member
thanks for the help, Alex! however, I don't know how to implement this
IPaletteProvider interface. for example, I can instance PaletteFactory
class in the method of "contributeToPalette", then there seems no way to
add customized tool entry. or because I implement wrong? could you please
give me more information about how to implement? (by the way, I think I
should put this new class under the diagram.providers directory of
"diagram" project, also I should name this file as "diagram" project name
+ "PaletteProvider", right? since I doubt there is some kind of naming
convention. Another strange thing is that under "diagram.providers"
directory, there are "EditPartProvider", "IconProvider", "ParserProvider"
and "ViewProvider", all of them are auto generated. however, there is no
"PaletteProvider" auto generated). Sorry for the newbie question, since I
am just trying to use GMF.

By the way, I wonder if I can extend PaletteFactory directly? Since in
that class, I can create customized ToolEntry and PaletteContainer, then I
just add to "PaletteRoot", is that correct?

thanks again!
Sam
Re: How to dynamically extend palette [message #164587 is a reply to message #164482] Thu, 06 December 2007 16:44 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello sam,

> By the way, I wonder if I can extend PaletteFactory directly? Since in
> that class, I can create customized ToolEntry and PaletteContainer,
> then I just add to "PaletteRoot", is that correct?
Sure you can mofigy generated code is it's more appropriate.

-----------------
Alex Shatalin
Re: How to dynamically extend palette [message #164633 is a reply to message #164587] Thu, 06 December 2007 21:39 Go to previous messageGo to next message
sam is currently offline samFriend
Messages: 20
Registered: July 2009
Junior Member
thank you very much, Alex!
Re: How to dynamically extend palette [message #1060338 is a reply to message #164633] Fri, 24 May 2013 08:23 Go to previous messageGo to next message
Luca Salemio is currently offline Luca SalemioFriend
Messages: 15
Registered: May 2013
Junior Member
Hello Sam,
I think I have encountered the same problem as yours. I am trying to build a graphical editor that as a Block concept in my ecore metamodel and the user can define different blocks to have into the palette that reflect this Block definition.

At this point I really don't know how to programatically extend my palette to have this different Blocks. You talked about IPaletteProvider to add under diagram.providers.

Can you please help me and give me some more information as you have reached your goal ?

Thank you very much in advance.

Best regards,
Luca.
Re: How to dynamically extend palette [message #1250821 is a reply to message #1060338] Wed, 19 February 2014 16:34 Go to previous message
PEREZ MEDINA Jorge Luis is currently offline PEREZ MEDINA Jorge LuisFriend
Messages: 9
Registered: January 2014
Junior Member
Hello,

I have the same problem and i need some explications about it.

Thanks in advance

Jorge
Previous Topic:Add nodes dynamically in the palette
Next Topic:read-only transaction context problem
Goto Forum:
  


Current Time: Thu Apr 25 05:24:11 GMT 2024

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

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

Back to the top