Skip to main content



      Home
Home » Modeling » Graphiti » Get an instance of IDiagramContainer from a programmatically created diagram
Get an instance of IDiagramContainer from a programmatically created diagram [message #1462467] Wed, 05 November 2014 10:58 Go to next message
Eclipse UserFriend
Hi all,
after having created a new diagram with the following code:

// Create the diagram
		final Diagram newDiagram = Graphiti.getPeCreateService().createDiagram(componentID, diagramName, true);


I need to programmtically create shapes and connections in it. How can I get the IDiagramContainer instance without opening it?

Until now, what I do is this:

		// Create the diagram
		final Diagram newDiagram = Graphiti.getPeCreateService().createDiagram(componentID, diagramName, true);
		
		// Create the file
		final IFile newDiagramFile = diagramFolder.getFile(diagramName + "." + editorExtension); //$NON-NLS-1$
		final URI uri = URI.createPlatformResourceURI(newDiagramFile.getFullPath().toString(), true);
		FileService.createEmfFileForDiagram(uri, newDiagram);


// Open and save the diagram
		final String providerId = GraphitiUi.getExtensionManager().getDiagramTypeProviderId(newDiagram.getDiagramTypeId());
		final IDiagramContainer diagramContainer = EclipseIDEUtils.openDiagramEditor(newDiagram, providerId, editorID);
		




And after this I can programmtically create shapes in it.

Any idea?

Thanks for your attention
Simone

[Updated on: Wed, 05 November 2014 10:59] by Moderator

Re: Get an instance of IDiagramContainer from a programmatically created diagram [message #1463412 is a reply to message #1462467] Thu, 06 November 2014 09:38 Go to previous messageGo to next message
Eclipse UserFriend
Simone,

actually, you should not need an IDiagramContainer to programmatically
create shapes. Have you seen this section in the docu?
http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.graphiti.doc%2Fresources%2Fdocu%2Fgfw%2Fdark-feature-processing.htm&cp=27_1_11

The 2 classes mentioned on that page are part of the finalized tutorial
project part of the SDK, they should pretty much explain what you intend to
do.

Michael
Re: Get an instance of IDiagramContainer from a programmatically created diagram [message #1463619 is a reply to message #1463412] Thu, 06 November 2014 14:07 Go to previous message
Eclipse UserFriend
Many Many Many thanks Smile
Previous Topic:Updating decorators need a shape to be moved
Next Topic:How to set the selection programmatically?
Goto Forum:
  


Current Time: Wed Jul 16 08:50:06 EDT 2025

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

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

Back to the top