Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » EditPart Resize on Figure Change
EditPart Resize on Figure Change [message #1792564] Thu, 19 July 2018 14:37
Parsa Pourali is currently offline Parsa PouraliFriend
Messages: 210
Registered: February 2014
Senior Member

Let's assume that I have a custom editPart class which listens to the model property and changes the figure based on the semantic element's properties. For instance, one of the properties is the angel of the image. The user sets the angle to 30 degrees and the image path will change to the path of the predefined image that shows a 30 degrees icon. However, this change of the image needs to resize the editpart since e.g., the 90 degrees image is higher than a 0 degrees image (vertical image vs. horizontal image).

For this, I registered a SwitchImageListener as follows:

EObject obj = resolveSemanticElement();

if (obj instanceof WorkspaceImage) {
WorkspaceImage wkImage = (WorkspaceImage) obj;
primaryShape = new CustomWorkspaceImageFigure(wkImage.getWorkspacePath());
switchImageListener = new SwitchImageListener(this);

and in the listener I have tried maaaaaany ways to resize the editpart but it does not allow and throws illegal modification exception saying that you can't do this in the read only mode or you need a write transaction. I used following codes:

final LayoutConstraint layoutConstraint = (LayoutConstraint) ((Node) ((Node) this.editPart.getModel())
				if (layoutConstraint instanceof Bounds) {
					final Bounds bounds = (Bounds) layoutConstraint;



((GraphicalEditPart) this.getParent()).setLayoutConstraint(this,
			0, 0,

but it throws something like:
!ENTRY org.eclipse.emf.transaction 4 41 2018-07-19 10:26:16.480
!MESSAGE Read-only transaction rolled back
!SUBENTRY 1 org.eclipse.emf.transaction 4 40 2018-07-19 10:26:16.480
!MESSAGE Transaction aborted due to concurrent write

What can I do? Do you have any suggestion? Please advise.

Previous Topic:[Edited] Wrong forum
Next Topic:How to debug with ObeoDesigner
Goto Forum:

Current Time: Wed Jan 27 17:52:23 GMT 2021

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

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

Back to the top