|How to dynamically extend palette [message #164321]
||Wed, 05 December 2007 05:24
Registered: July 2009
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!
|Re: How to dynamically extend palette [message #164482 is a reply to message #164398]
||Thu, 06 December 2007 01:04
Registered: July 2009
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?
Powered by FUDForum
. Page generated in 0.09886 seconds