Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Draw Diagram after startup
Draw Diagram after startup [message #900279] Mon, 06 August 2012 06:53 Go to next message
Thomas Zöchbauer is currently offline Thomas Zöchbauer
Messages: 10
Registered: August 2012
Junior Member
Hello,

I have a rcp which contains a graphiti editor plugin (yee Smile ).

Now when i open the editor in my rcp, i want that my diagram draws 2 shapes on the right and left border

(1.

x: 1
y: 1
h: 100
w: 10

(2.

x: 989
y: 1
h: 100
w: 10

))

Where can i hook in to draw this shapes programmatically on my diagram when it is instantiated?

Can i use somewhere outside something similar like addIfPossible() or using an addContext?

thanks

[Updated on: Mon, 06 August 2012 08:15]

Report message to a moderator

Re: Draw Diagram after startup [message #900729 is a reply to message #900279] Wed, 08 August 2012 06:28 Go to previous messageGo to next message
Matthias Gorning is currently offline Matthias Gorning
Messages: 80
Registered: April 2010
Location: Germany
Member
You can try the init() method in your diagram type provider.
Re: Draw Diagram after startup [message #903045 is a reply to message #900729] Tue, 21 August 2012 13:47 Go to previous messageGo to next message
Thomas Zöchbauer is currently offline Thomas Zöchbauer
Messages: 10
Registered: August 2012
Junior Member
hi, thanks think this should work for me Smile

best regards

Thomas
Re: Draw Diagram after startup [message #903076 is a reply to message #903045] Tue, 21 August 2012 16:23 Go to previous messageGo to next message
Thomas Zöchbauer is currently offline Thomas Zöchbauer
Messages: 10
Registered: August 2012
Junior Member
Ok i used the init() method to link a buisness object on the diagram. afterwards i draw some rectangles with the postInit() method. works fine:)

Object bo = getFeatureProvider().getBusinessObjectForPictogramElement(
				diagram);
		if (bo == null) {
			TransactionalEditingDomain editingDomain = getDiagramEditor()
					.getEditingDomain();
			CommandStack commandStack = editingDomain.getCommandStack();
			commandStack.execute(new RecordingCommand(editingDomain) {

				@Override
				protected void doExecute() {
					TestDiagram diagramBO = FbsFactory.eINSTANCE
							.createTestDiagram();
					getDiagram().eResource().getContents().add(diagramBO);
					getFeatureProvider().link(diagram, diagramBO);
				}
			});
		}


@Override
	public void postInit() {
.
.
.
.
.
		getFeatureProvider().addIfPossible(addContext1);
		getFeatureProvider().addIfPossible(addContext2);
	}
Re: Draw Diagram after startup [message #985135 is a reply to message #903076] Thu, 15 November 2012 02:16 Go to previous message
Saniya Mirajkar is currently offline Saniya Mirajkar
Messages: 30
Registered: August 2012
Member
Hi Thomas,

I am struggling to do something similar that you have mentioned with Graphiti 0.9.1.
Just few questions around your example:

1. Which version of Graphiti you are using.For me addIfPossible() method is giving some errors with version 0.9.1.This worked in version 0.8.2.
2. I suppose "FbsFactory" is your own class and the diagramBO object that you are passing the set of BuisnessObjects.
Correct me if wrong.
Previous Topic:Graphiti and Dependency Injection
Next Topic:AddFeature (link element)
Goto Forum:
  


Current Time: Fri Aug 22 01:56:43 EDT 2014

Powered by FUDForum. Page generated in 0.01994 seconds