Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to programmatically resize a structured edit part
How to programmatically resize a structured edit part [message #86120] Mon, 18 December 2006 03:37 Go to next message
Eclipse UserFriend
Hi all,

depending on some decorations, I want to resize a "structured" edit part - a
UML class with a name label, compartments for properties and methods - by
some code.

To make the class node wider, I tried to call setSize() on nodeFigure and
classFigure level but without effect. Calling setSize() on the label figure
enlarges that one, but I don't manage to trigger a refresh of the parent
figure by calling invalidate() / invalidateTree().
I tried both working on the figures from within the decorator and from a
newly created edit policy.

I already recognized a significant number of resize-related threads here,
but none of them deals with programmatic resize.

Thanks for your help,

Martin
Re: How to programmatically resize a structured edit part [message #86150 is a reply to message #86120] Mon, 18 December 2006 08:12 Go to previous messageGo to next message
Eclipse UserFriend
Hello Martin,

I think, you should set size on the notation model layer. This means you
have to get Node instance corresponding to the UML class and then call:
- node.getLayoutConstraint() to receive instance of Bounds.
- set size for this Bounds object.

-----------------
Alex Shatalin
Re: How to programmatically resize a structured edit part [message #86165 is a reply to message #86150] Mon, 18 December 2006 10:21 Go to previous messageGo to next message
Eclipse UserFriend
Hi Alex,

I recognized that getLayoutConstraint() returns null for my classname
edit part. However, it returns a contraint when called on the
surrounding class edit part.

But setting values on that object (e.g. setSize()) results in an error
saying that I am not allowed to change the resource from outside a write
transaction.

Isn't there another possibility?
Overriding the responsible LayoutMangager is not a suitable approach, I
think.

Regards,

Martin

Alex Shatalin schrieb:
> Hello Martin,
>
> I think, you should set size on the notation model layer. This means you
> have to get Node instance corresponding to the UML class and then call:
> - node.getLayoutConstraint() to receive instance of Bounds.
> - set size for this Bounds object.
>
> -----------------
> Alex Shatalin
>
>
Re: How to programmatically resize a structured edit part [message #86180 is a reply to message #86165] Mon, 18 December 2006 11:03 Go to previous message
Eclipse UserFriend
Hello Martin,

> I recognized that getLayoutConstraint() returns null for my classname
> edit part. However, it returns a contraint when called on the
> surrounding class edit part.
That's correct - you can change a size of surrounding node only (Class Node).


> But setting values on that object (e.g. setSize()) results in an error
> saying that I am not allowed to change the resource from outside a
> write transaction.
You can create new AbstractEMFOperation() instance using proper EditingDomain
as a parameter (accessor method is available in GraphicalEditPart), put working
code into implementation of doExecute() method and execute this operation.

-----------------
Alex Shatalin
Previous Topic:gmf - emf - uml2 version conflict
Next Topic:urgent: the problem with resizing svg figure
Goto Forum:
  


Current Time: Sat Jul 26 05:09:42 EDT 2025

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

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

Back to the top