Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Edit Model using Commands
Edit Model using Commands [message #674357] Thu, 26 May 2011 15:37 Go to next message
Klaus S. is currently offline Klaus S.Friend
Messages: 11
Registered: January 2011
Junior Member
I have a multithreaded application and want to perform some operations on the model of the diagram, like change some attributes of a certain modelobject. I initiate a command, which performs some actions, like this:

TransactionalEditingDomain transactionalEditingDomain = TransactionUtil.getEditingDomain(featureProvider.getDomainModelResource());
		    if (transactionalEditingDomain == null) {
		    	transactionalEditingDomain = TransactionalEditingDomain.Factory.INSTANCE
		    			.createEditingDomain(featureProvider.getDomainModelResource().getResourceSet());
			}
	
		   AddInteractionCommand operation = new AddInteractionCommand(transactionalEditingDomain, action, elementInteraction);
		   transactionalEditingDomain.getCommandStack().execute(operation);


AddInteractionCommand inherits from org.eclipse.emf.transaction.RecordingCommand.

The trouble comes when the postcommit of the transaction is been executed and org.eclipse.graphiti.ui.internal.editor.DomainModelChangeListener.resourceSetChanged(ResourceSetChangeEvent) is called. The method requests for an Display object and this happens to be null by calling Display.getCurrent():

Display.getCurrent().asyncExec(new Runnable() {

			@Override
			public void run() {
				if (getDiagramTypeProvider().isAutoUpdateAtRuntime() && getDiagramTypeProvider().getDiagramEditor().isDirty()) {
					// The notification service takes care of not only the
					// linked BOs but also asks the diagram provider about
					// related BOs.
					getDiagramTypeProvider().getNotificationService().updatePictogramElements(dirtyPes);
				} else {
					getDiagramTypeProvider().getDiagramEditor().refresh();
				}
			}

		});


Am I going a wrong way?
Or might this problem easily solved if DomainModelChangeListener asks for the global Display (Display.getDefault()) , in case Display.getCurrent() returns null because the current thread has no Display-Instance?
Re: Edit Model using Commands [message #675070 is a reply to message #674357] Mon, 30 May 2011 08:27 Go to previous messageGo to next message
Tim Kaiser is currently offline Tim KaiserFriend
Messages: 118
Registered: July 2009
Senior Member
Hi,

i think you are right.
Can you open a bugzilla?

Best, Tim
Re: Edit Model using Commands [message #675071 is a reply to message #675070] Mon, 30 May 2011 08:31 Go to previous messageGo to next message
Tim Kaiser is currently offline Tim KaiserFriend
Messages: 118
Registered: July 2009
Senior Member
....i see the issue is already fixed in head.
If you move to Graphiti 0.8, you should be happy. Best, Tim
Re: Edit Model using Commands [message #675075 is a reply to message #675071] Mon, 30 May 2011 08:40 Go to previous message
Klaus S. is currently offline Klaus S.Friend
Messages: 11
Registered: January 2011
Junior Member
ok, thanks!
Previous Topic:Graphiti without transactional editing domain?
Next Topic:Updating text in graphiti
Goto Forum:
  


Current Time: Sun Jul 12 14:19:15 GMT 2020

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

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

Back to the top