Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Control Referenced Resource Loading
Control Referenced Resource Loading [message #226969] Wed, 22 April 2009 09:59 Go to next message
Hugues Rérolle is currently offline Hugues RérolleFriend
Messages: 60
Registered: July 2009
Member
Hello,

I have a set of models which reference between them.

Model A
ref Model B1
ref Model C
...
ref Model B2
...


In EMF Editor the dependent files are loading when I spread the hierarchy.

In GMF Editor it seems that all referenced files are loaded when editor
opens. I would want that only the first references (BX in my example)
are loaded (Otherwise the opening can be very long).


How can I control the loading of depending resource in GMF ?



Hugues
Re: Control Referenced Resource Loading [message #227003 is a reply to message #226969] Wed, 22 April 2009 11:30 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Hugues,

AFAIR currently "total loading" of all the cross-referenced resources is
a side-effect of CrossReferenceAdapter attached to newly created ResourceSet
inside GMFEditingDomainFactory. I doubt you can simply switch to WorkspaceEditingDomainFactory
to get rid of this problem - i remember some other malfunctions were shown
up then I switched my diagram editor to WorkspaceEditingDomainFactory.

You can try submitting a request for a runtime team asking them to remove
CrossReferenceAdapter or modify it in a way not to load all the referenced
resources (use new CrossReferenceAdapter(false)) for now.

-----------------
Alex Shatalin
Re: Control Referenced Resource Loading [message #227030 is a reply to message #227003] Wed, 22 April 2009 14:26 Go to previous messageGo to next message
Hugues Rérolle is currently offline Hugues RérolleFriend
Messages: 60
Registered: July 2009
Member
Thanks Alex for your response.


I've patched XXXDiagramEditor.createEditingDomain

Like This (Remove and recreate CrossReferenceAdapter with "false"
parameter) :

@Override
protected TransactionalEditingDomain createEditingDomain() {
TransactionalEditingDomain ted = super.createEditingDomain();
EList<Adapter> list = ted.getResourceSet().eAdapters();
Adapter adapter = null;
for (Adapter _adapter : list)
if (_adapter instanceof CrossReferenceAdapter){
adapter = _adapter;
break;
}
if (adapter != null) {
list.remove(adapter);
list.add(new CrossReferenceAdapter(false));
}
return ted;
}

But I've still all my resources loaded...


Hugues
Re: Control Referenced Resource Loading [message #227130 is a reply to message #227030] Thu, 23 April 2009 12:56 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Hugues,

Can you check if any resources were arleady loaded into corresponding ResrourceSet
in the moment you are removing CrossReference adapter?
Can yu just remove this adapter (comment out the line list.add(new CrossReferenceAdapter(false));)

-----------------
Alex Shatalin
Re: Control Referenced Resource Loading [message #227623 is a reply to message #227130] Mon, 27 April 2009 12:26 Go to previous messageGo to next message
Hugues Rérolle is currently offline Hugues RérolleFriend
Messages: 60
Registered: July 2009
Member
Hi Alex,

Sorry to have delayed my answer.


> Can you check if any resources were arleady loaded into corresponding
> ResrourceSet in the moment you are removing CrossReference adapter?

There is no loaded resource at this moment.

> Can yu just remove this adapter (comment out the line list.add(new
> CrossReferenceAdapter(false));)

It doesn't change anything.


Have you another idea?


Thanks again,

Hugues
Re: Control Referenced Resource Loading [message #227647 is a reply to message #227623] Mon, 27 April 2009 13:43 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Hugues,

> Have you another idea?
Put a breakpoint into ResourceImpl.load() method to see stack trace and determine
a reason why was it called...

-----------------
Alex Shatalin
Re: Control Referenced Resource Loading [message #227752 is a reply to message #227647] Mon, 27 April 2009 17:23 Go to previous messageGo to next message
Hugues Rérolle is currently offline Hugues RérolleFriend
Messages: 60
Registered: July 2009
Member
Hi Alex,

I've put a breakpoint in resourceImpl.load(), and remarked than
DocumentProvider has a createEditingDomain too, I've applied the same
modification (remove and replace by CrossReferenceAdapter(false)) and
it's working fine.

Is it normal that both functions:
"XXXDocumentProvider.createEditingDomain" and
"XXXDiagramEditor.createEditingDomain"
don't use the same editing domain?

Am I right with my solution?

Thanks Alex,

Hugues.


Alex Shatalin wrote:
> Hello Hugues,
>
>> Have you another idea?
> Put a breakpoint into ResourceImpl.load() method to see stack trace and
> determine a reason why was it called...
>
> -----------------
> Alex Shatalin
>
>
Re: Control Referenced Resource Loading [message #227921 is a reply to message #227752] Tue, 28 April 2009 11:54 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Hugues,

> Is it normal that both functions:
> "XXXDocumentProvider.createEditingDomain" and
> "XXXDiagramEditor.createEditingDomain"
> don't use the same editing domain?
I think second one (XXXDiagramEditor.createEditingDomain) will not be called
by generated code...

> Am I right with my solution?
Yes. You have to modify XXXDocumentProvider.createEditingDomain() to change
EditingDomain used by generated diagram editor.

-----------------
Alex Shatalin
Previous Topic:Re: ILinkHelper
Next Topic:2 diagram editors for the same domain metamodel
Goto Forum:
  


Current Time: Tue Nov 21 04:33:06 GMT 2017

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

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