Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Write an element into Diagram(when diagram is not synchronized)
Write an element into Diagram [message #630380] Fri, 01 October 2010 19:18 Go to next message
Fabricio Pellegrini is currently offline Fabricio PellegriniFriend
Messages: 36
Registered: July 2009
Member
Hi,

I would like to know how could I write/add an element programmatically in the diagram when it is not synchronized.
Re: Write an element into Diagram [message #630979 is a reply to message #630380] Tue, 05 October 2010 17:33 Go to previous message
Fabricio Pellegrini is currently offline Fabricio PellegriniFriend
Messages: 36
Registered: July 2009
Member
Maybe I found something.

Diagram diagram = ViewService.createDiagram(model, MethodContentEditPart.MODEL_ID, MethodContentDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
try {
	for(Task task : model.getTasks())
        {
		Node node = ViewService.createNode(diagram, task, MethodContentElementTypes.Task_2003.getId(), MethodContentDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
...										


It should create the node into my diagram, but nothing is happen.

So I tried to insert it on diagram using this:
diagram.insertChild(node);


But when I do it, it throws this exception
java.lang.IllegalArgumentException: The 'no null' constraint is violated
	at org.eclipse.emf.common.util.AbstractEList.validate(AbstractEList.java:101)
	at org.eclipse.emf.ecore.util.EcoreEList.validate(EcoreEList.java:69)
	at org.eclipse.emf.common.util.BasicEList.addUnique(BasicEList.java:424)
	at org.eclipse.emf.common.notify.impl.NotifyingListImpl.doAddUnique(NotifyingListImpl.java:331)
	at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:315)
	at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:307)
	at org.eclipse.gmf.runtime.notation.impl.ViewImpl.insertChild(ViewImpl.java:715)
	at workspace.diagram.part.MethodContentDiagramEditorUtil$1.doExecuteWithResult(MethodContentDiagramEditorUtil.java:192)


any help?

[Updated on: Tue, 05 October 2010 19:08]

Report message to a moderator

Previous Topic:add subMenu
Next Topic:Question concerning Creating "New Elements And Corresponding Views"
Goto Forum:
  


Current Time: Tue Apr 30 16:19:13 GMT 2024

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

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

Back to the top