CreateElementCommand - elements do not appear on diagram [message #547579] |
Sun, 18 July 2010 22:47  |
Eclipse User |
|
|
|
Hey,
I'm having some trouble creating elements programmatically. The problem is that the new element is not displayed on the diagram, no matter how many refreshes - it gets put in the model though. However, it starts to work after I place an element with the editor's palette.
Here's the gist of the code:
public void createElement(Object originalEditPart, DiagramCommandStack dcs, IProgressMonitor progressMonitor) {
IGraphicalEditPart gEditPart = (IGraphicalEditPart)originalEditPart;
final EObject originalImpl = gEditPart.getNotationView().getElement();
TransactionalEditingDomain domain = gEditPart.getEditingDomain();
GraphicalEditPart part = (GraphicalEditPart)originalEditPart;
GraphicalEditPart container = (GraphicalEditPart)part.getParent();
CreateElementRequest req = new CreateElementRequest(domain, originalImpl.eContainer(), Blah_modelElementTypes.SomeType_2005);
CreateElementCommand create = new CreateElementCommand(req);
dcs.execute(new ICommandProxy(create));
refresh();
}
Again, this actually works perfectly fine after I place an element on the diagram with the editor palette, just not before. Has anyone else encountered this problem before?
Thank you!
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04470 seconds