|
Re: [GMF] create a Node programilly [message #535224 is a reply to message #535121] |
Fri, 21 May 2010 16:13 |
Zied Messages: 26 Registered: February 2010 |
Junior Member |
|
|
I have done a flowchart GMF diagram and i want to create a graphic object when I execute an action.
I have tried to execute the same process as the GMF sequence Diagram in this site
http:// help.eclipse.org/help33/index.jsp?topic=/org.eclipse.gmf.doc /prog-guide/runtime/Developer%20Guide%20to%20Diagram%20Runti me.html
here is the code
///
View diagramView =FlowChartDiagramEditPart.HANDLER.getDiagramView();
// EMF model of the diagram
FlowChartDiagram diagramViewModel = (FlowChartDiagram) diagramView.getElement();
IElementType type = (IElementType) FlowchartElementTypes.ClassMGMS_2002;
// EMF class extend from EObject
ClassMGMS mgms = FlowchartFactory.eINSTANCE.createClassMGMS();
CreateElementRequest request = new CreateElementRequest(type);
request.setContainer(diagramViewModel);
ClassMGMSCreateCommand mgmsCreateCommand = new ClassMGMSCreateCommand(request);
IProgressMonitor pg =ProgressManager.getInstance().createProgressGroup();
try {
mgmsCreateCommand.execute(pg, null);
} catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Please could some one HELP me because this code work only after I create the same object (id=2002) from the palette.
Thanks in advance.
[Updated on: Fri, 21 May 2010 16:15] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03797 seconds