Programmatically generate diagram contents [message #236215] |
Wed, 15 July 2009 08:27  |
Eclipse User |
|
|
|
Hi,
I'm working on a graphical editor, that will be additional to an existing
tree-view based editor working on the same data (but not simultanously).
To be exactly it's a bit more complex, so let's just say I want to import
information. So the thing is, I have to load existing data and create the
elements into the graphical representation.
My plan is to initially add all elements invisible somewhere into the
canvas and the user makes them visible over the context menu of the
outline (I'm using the model oriented outline).
Show or hide the elements is not the big deal, but I really don't have a
good idea how to add the elements to the canvas.
I can create the domain models via the
EditorFactory.eINSTANCE.createMyNode() but the visual representation is
still missing.
According to
http://dev.eclipse.org/newslists/news.eclipse.technology.gmf /msg00894.html
I need to create the notational view, but the topic in the linked post is
more how to create additional nodes by graphically creating one node.
All the talking about the different EditPolicies and CreateCommands are
confusing me.
Currently I'm opening the editor and create an empty new file. So what is
the normal way to add programmatically new nodes with their visual
representation to a canvas?
Best regards,
Tobias
|
|
|
|
|
|
Re: Programmatically generate diagram contents [message #236503 is a reply to message #236299] |
Mon, 20 July 2009 08:27  |
Eclipse User |
|
|
|
Hello Tobias,
> But the example is totally based on the selectedElement item, which I
> dont
> know how to get.
> So how could I use this?
It probably depends on a place you are calling this code (clicking a button/saving)...
You can either get current selection from Editor/IWorkbenchWindow.getSelectionService()
or just use corresponsing selection available in popup action (by "clicking
a button" you probably mean some action..)
-----------------
Alex Shatalin
|
|
|
Powered by
FUDForum. Page generated in 0.24323 seconds