Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 15:58 Go to next message
Simone Di Cola is currently offline Simone Di ColaFriend
Messages: 60
Registered: February 2014
Member
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 15:59]

Report message to a moderator

Re: Get an instance of IDiagramContainer from a programmatically created diagram [message #1463412 is a reply to message #1462467] Thu, 06 November 2014 14:38 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
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 19:07 Go to previous message
Simone Di Cola is currently offline Simone Di ColaFriend
Messages: 60
Registered: February 2014
Member
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: Tue Mar 19 08:05:21 GMT 2024

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

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

Back to the top