Synchronize Label with Property Sheet [message #180067] |
Tue, 01 April 2008 09:51 |
Eclipse User |
|
|
|
Originally posted by: messineo.rosario.gmail.com
Hi,
In my editor there is a label that shows the name of an attribute in a
class node. The attribute in my metamodel has a type that is showed in the
property sheet of attribute. I want that when I add the type to my
attribute in the property sheet this change is reflected in label in such
way:
nameatttibute : Type
This behaviour is the same that uml class diagram already implements , but
I don't known which is the code associated to it.
can someone help me?
Thanks
Rosario
|
|
|
Re: Synchronize Label with Property Sheet [message #180095 is a reply to message #180067] |
Tue, 01 April 2008 12:15 |
Eclipse User |
|
|
|
Originally posted by: trommas.yahoo.com
Hello Rosario.
I would begin with overriding this method in the editPart of the class
node. This captures the semantic change. Ex:
/**
* @generated NOT
*/
@Override
protected void handleNotificationEvent(Notification notification) {
if (notification.getNotifier() instanceof ClassNode) {
getPrimaryShape().updateFace();
}
super.handleNotificationEvent(notification);
}
Then updateFace would be a method in the inner figure class that handles
the graphical part. Maybe something like this would work:
public class ClassNodeFigure extends RoundedRectangle {
private WrapLabel fFigureClassNodeNameFigure;
public ClassNodeFigure() {
...
}
private void updateFace() {
fFigureClassNodeNameFigure.setText("whatever");
}
HTH,
Tomas Zijdemans
Rosario wrote:
> Hi,
>
> In my editor there is a label that shows the name of an attribute in a
> class node. The attribute in my metamodel has a type that is showed in
> the property sheet of attribute. I want that when I add the type to my
> attribute in the property sheet this change is reflected in label in
> such way:
>
> nameatttibute : Type
>
> This behaviour is the same that uml class diagram already implements ,
> but I don't known which is the code associated to it.
>
> can someone help me?
>
> Thanks
>
> Rosario
>
|
|
|
Re: Synchronize Label with Property Sheet [message #180345 is a reply to message #180095] |
Wed, 02 April 2008 10:33 |
Eclipse User |
|
|
|
Originally posted by: messineo.rosario.gmail.com
Hello Tomas,
I think that if I follow your advice I could have some problem when user
edit property label because Parser could return invalid string format.
In my opinion Parser should be modified. In particular the default Parser
MessageFormatParser manage only EAttribute feature but in my situation I
want add to label text the EAttribute of an EReference. I think changing
Parser I could reach my target,
what do you think?
I've seen parsers used in uml class diagram editor but I think it is too
hard understanding how it works.
Thanks
Rosario
|
|
|
Re: Synchronize Label with Property Sheet [message #180372 is a reply to message #180345] |
Wed, 02 April 2008 10:54 |
Eclipse User |
|
|
|
Originally posted by: trommas.yahoo.com
My solution is based on
http://wiki.eclipse.org/GMF_Tips#Making_figures_sensitive_to _attributes_of_semantic_elements
This works great for me, I don't experience any problems with the
Parser. I add an external label that shows the EAttribute of an
EReference - so our scenarios are almost identical.
My solution did not require much effort (and I really am kind of a lousy
programmer)
HTH,
Tomas Zijdemans
Rosario wrote:
> Hello Tomas,
>
> I think that if I follow your advice I could have some problem when user
> edit property label because Parser could return invalid string format.
>
> In my opinion Parser should be modified. In particular the default
> Parser MessageFormatParser manage only EAttribute feature but in my
> situation I want add to label text the EAttribute of an EReference. I
> think changing Parser I could reach my target,
>
> what do you think?
>
> I've seen parsers used in uml class diagram editor but I think it is too
> hard understanding how it works.
>
> Thanks
>
> Rosario
>
|
|
|
Powered by
FUDForum. Page generated in 0.01973 seconds