Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » [GMF] create a graphic Object with an RCP action
[GMF] create a graphic Object with an RCP action [message #535121] Fri, 21 May 2010 11:16 Go to next message
Zied is currently offline ZiedFriend
Messages: 26
Registered: February 2010
Junior Member
Hi,
I have a little problem.
how to create a graphic object in the diagram when I execute an action?

thanks in advance

[Updated on: Fri, 21 May 2010 16:20]

Report message to a moderator

Re: [GMF] create a Node programilly [message #535224 is a reply to message #535121] Fri, 21 May 2010 16:13 Go to previous messageGo to next message
Zied is currently offline ZiedFriend
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

Re: [GMF] create a Node programilly [message #535638 is a reply to message #535224] Tue, 25 May 2010 05:22 Go to previous message
Jevon  is currently offline Jevon Friend
Messages: 164
Registered: July 2009
Senior Member
Hi Zied,

What is the problem? Are you getting an exception/stack trace? Or is the
element not being created?

Jevon

Zied wrote:
> 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% 20Runtime.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.
>
> Thanks in advance.
Previous Topic:Labels being Clipped when Exporting Diagram to Image (SVG/PDF)
Next Topic:job creates commands, until app freeze, why?
Goto Forum:
  


Current Time: Tue May 28 07:18:37 GMT 2024

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

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

Back to the top