Skip to main content


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 10:53 Go to next message
Thomas Zöchbauer is currently offline Thomas ZöchbauerFriend
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 12:15]

Report message to a moderator

Re: Draw Diagram after startup [message #900729 is a reply to message #900279] Wed, 08 August 2012 10:28 Go to previous messageGo to next message
Matthias Gorning is currently offline Matthias GorningFriend
Messages: 81
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 17:47 Go to previous messageGo to next message
Thomas Zöchbauer is currently offline Thomas ZöchbauerFriend
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 20:23 Go to previous messageGo to next message
Thomas Zöchbauer is currently offline Thomas ZöchbauerFriend
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 07:16 Go to previous message
Saniya Mirajkar is currently offline Saniya MirajkarFriend
Messages: 31
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: Thu Mar 28 20:38:51 GMT 2024

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

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

Back to the top