Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Update existing diagrams after model change
Update existing diagrams after model change [message #216341] Sun, 25 January 2009 23:28 Go to next message
Eclipse UserFriend
Originally posted by: Holger.Kremss.itemis.de

Hi,

we have an editor, which has already been used by the customer. So we
have some existing data. Now we had to change some elements and changed
some views as well on customer request. One figure has now 2 external
labels mapped to features, which did exist before, but didn't have any
labels. It works well for new diagrams. But, if I open one of the old
diagrams, the external labels will never be displayed, probably because
they do not exist in the legacy diagram data.

I tried everything to display these labels, playing around with
canonical edit policies and stuff, but I'm stuck and running out of
time. Does anybody have an idea, how to create/refresh/enable/display
these (new) external labels?

I think my question is more general: Is there a way to update diagram
views, if the graphical model or mapping model has been changed?

Thanks in advance.
Re: Update existing diagrams after model change [message #216353 is a reply to message #216341] Mon, 26 January 2009 06:19 Go to previous messageGo to next message
Robert Wloch is currently offline Robert WlochFriend
Messages: 109
Registered: July 2009
Senior Member
Hi Holger,

you could delete the diagram file (make a backup first, of course, or
simply rename it). Then, right-clicking the EMF model belonging to the
diagram shows an "initialize FOO diagram" entry in the context menu.
Usually this would work. There's just one drawback: you'll loose the
layout and eventually you'll have to arrange your figures again.

Rob
Re: Update existing diagrams after model change [message #216361 is a reply to message #216353] Mon, 26 January 2009 07:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Holger.Kremss.itemis.de

Yeah, this would work, but our editor has only one file for model AND
diagram. So I can't 'delete' the diagram easily, I would have to modify
each file and I wonder, if there isn't a better solution while
initializing the diagram. The other drawback is even worse, because our
diagrams may be quite large (multiple pages printout) and I'm afraid
re-arranging every diagram manually is not acceptable for the customer.


Robert Wloch schrieb:
> you could delete the diagram file (make a backup first, of course, or
> simply rename it). Then, right-clicking the EMF model belonging to the
> diagram shows an "initialize FOO diagram" entry in the context menu.
> Usually this would work. There's just one drawback: you'll loose the
> layout and eventually you'll have to arrange your figures again.
Re: Update existing diagrams after model change [message #216398 is a reply to message #216341] Mon, 26 January 2009 18:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Holger.Kremss.itemis.de

Doesn't anyone else have an idea how to display the new external labels,
when opening the old model diagrams? :-( I expect no complete code
example how to do it, just some hints, which bring me back on the road.
Is it really that complicated?

Any help is appreciated.

Thanks, Holger


Holger Kremss schrieb:
> Hi,
>
> we have an editor, which has already been used by the customer. So we
> have some existing data. Now we had to change some elements and changed
> some views as well on customer request. One figure has now 2 external
> labels mapped to features, which did exist before, but didn't have any
> labels. It works well for new diagrams. But, if I open one of the old
> diagrams, the external labels will never be displayed, probably because
> they do not exist in the legacy diagram data.
>
> I tried everything to display these labels, playing around with
> canonical edit policies and stuff, but I'm stuck and running out of
> time. Does anybody have an idea, how to create/refresh/enable/display
> these (new) external labels?
>
> I think my question is more general: Is there a way to update diagram
> views, if the graphical model or mapping model has been changed?
>
> Thanks in advance.
Re: Update existing diagrams after model change [message #216406 is a reply to message #216341] Tue, 27 January 2009 01:54 Go to previous messageGo to next message
Alex Boyko is currently offline Alex BoykoFriend
Messages: 200
Registered: July 2009
Senior Member
Hi,

How did you introduce your new label views? In a view factory? New
decorating views?
Do you extend GMF notation meta-model? If you do, you could upversion the
NSURI of your notation model and then register a ResourceHandler to
migrate new models to old and vice versa. The postLoad() method of the
resource handler would find the views that need label views to be attached.
Hope this helps.

Cheers.
Alex
Re: Update existing diagrams after model change [message #216445 is a reply to message #216361] Tue, 27 January 2009 09:02 Go to previous messageGo to next message
Enrico Schnepel is currently offline Enrico SchnepelFriend
Messages: 121
Registered: July 2009
Senior Member
Hello Holger,

I think you could find the view element from the notational model using the
EcoreUtil.CrossReferencer class (have a look at org.eclipse.gmf.internal.
codegen.util.EmfUtils) and change the notational view model element
according to your new figure layout.

Regards

Enrico

Holger Kremss wrote:

> Yeah, this would work, but our editor has only one file for model AND
> diagram. So I can't 'delete' the diagram easily, I would have to modify
> each file and I wonder, if there isn't a better solution while
> initializing the diagram. The other drawback is even worse, because our
> diagrams may be quite large (multiple pages printout) and I'm afraid
> re-arranging every diagram manually is not acceptable for the customer.
>
>
> Robert Wloch schrieb:
>> you could delete the diagram file (make a backup first, of course, or
>> simply rename it). Then, right-clicking the EMF model belonging to the
>> diagram shows an "initialize FOO diagram" entry in the context menu.
>> Usually this would work. There's just one drawback: you'll loose the
>> layout and eventually you'll have to arrange your figures again.
Re: Update existing diagrams after model change [message #216787 is a reply to message #216406] Fri, 30 January 2009 00:53 Go to previous message
Eclipse UserFriend
Originally posted by: Holger.Kremss.itemis.de

Hi Alex,

many thanks, this was a big help for me. The resource handler postLoad()
was exactly what I was looking for. I'm now iterating through the
notational model and search for missing (external label) nodes and
create some:

while (it.hasNext()) {

Node node = it.next();

...

// Checking for type "5026" children

...

Node n = node.createChild(NotationPackage.Literals.NODE);
n.setType("5026");
n.setLayoutConstraint(NotationFactory.eINSTANCE.createLocati on());

...

}

I'm not sure, if this is 100% correct, but it does the job.

Regards,

Holger


Alex Boyko schrieb:
> Hi,
>
> How did you introduce your new label views? In a view factory? New
> decorating views?
> Do you extend GMF notation meta-model? If you do, you could upversion
> the NSURI of your notation model and then register a ResourceHandler to
> migrate new models to old and vice versa. The postLoad() method of the
> resource handler would find the views that need label views to be attached.
> Hope this helps.
>
> Cheers.
> Alex
>
Previous Topic:A stubborn Cut + Paste problem
Next Topic:Live validation question
Goto Forum:
  


Current Time: Thu Apr 25 04:50:04 GMT 2024

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

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

Back to the top