Skip to main content



      Home
Home » Modeling » Graphiti » Send To Front/Back requires a write txn?
Send To Front/Back requires a write txn? [message #1061921] Tue, 04 June 2013 13:55 Go to next message
Eclipse UserFriend
Hi all,

Is it possible to change the z-order of shapes without having to use a transaction i.e. without going through PEService.sendToFront()/Back()? The use case for this is one shape partially obscured by another shape; it would be useful to send the obscured shape to the front simply by selecting it without having to use a transaction (and causing the editor to become "dirty").

In general, is there a way to make model changes that are simply NOT recorded?

Thanks,
Bob
Re: Send To Front/Back requires a write txn? [message #1061924 is a reply to message #1061921] Tue, 04 June 2013 14:08 Go to previous messageGo to next message
Eclipse UserFriend
Ah ha! I've found a solution!
In my DiagramContainer (or DiagramEditor for 0.9.2) I simply override selectionChanged(IWorkbenchPart,ISelection) and add this after the call to super:

	for (PictogramElement pe : getSelectedPictogramElements()) {
		if (pe instanceof ContainerShape && !(pe instanceof Diagram)) {
			final ContainerShape shape = (ContainerShape)pe;
			ContainerShape container = shape.getContainer();
			int size = container.getChildren().size();
			if (size>1)
				container.getChildren().move(size-1, shape);
		}
	}


the EList.move() method does not require a write transaction for some reason Smile

Bob

[Updated on: Tue, 04 June 2013 14:09] by Moderator

Re: Send To Front/Back requires a write txn? [message #1062137 is a reply to message #1061924] Thu, 06 June 2013 03:53 Go to previous messageGo to next message
Eclipse UserFriend
Bob,

probably this already runs in a write transaction.

All changes to the EMF model done in a Graphiti diagram editor need a
transaction (the editor uses a transaction editing domain).

Michael
Re: Send To Front/Back requires a write txn? [message #1064328 is a reply to message #1062137] Tue, 18 June 2013 14:12 Go to previous messageGo to next message
Eclipse UserFriend
Hmm, I think what's happening is that the implementation (a BasicEList) doesn't send notifications about the move. In any case, it does what I need it to do...until somebody "fixes" the move() behavior Wink
UPDATE: Send To Front/Back requires a write txn? Yes, yes it does! [message #1065975 is a reply to message #1064328] Fri, 28 June 2013 10:44 Go to previous message
Eclipse UserFriend
The EList.move() trick is a very, very, very bad idea because it does not get recorded in the undo stack (well, duh!) The result is that an undo will affect the wrong ContainerShape because the order of children has been switched and the undo command will reverse changes on the wrong element.
Previous Topic:Highlight a PictogramElement
Next Topic:Deleting pictogram elements is slow
Goto Forum:
  


Current Time: Thu Jul 03 04:34:12 EDT 2025

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

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

Back to the top