Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Problems with read-only resources in an editing domain
Problems with read-only resources in an editing domain [message #423135] Tue, 23 September 2008 17:04 Go to next message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
Messages: 524
Registered: July 2009
Senior Member
Hi Ed,

As I tell some days ago, I got to load CDOResources from an XMI based
model. So I can open up an editor for an XMIResource and, if a
CDOResource if referenced somewhere (through its URI), is will be loaded
automatically. However, the editor doesn't let me modify the CDOResource
because it's loaded in the EditingDomain's ResourceSet as "read-only".

To determine if a resource is read-only:
- AdapterFactoryEditingDomain. resourceToReadOnlyMap should be populated
with the proper values.
or
- AdapterFactoryEditingDomain.isReadOnly(URI) returns "false".

The first one doesn't look like a feasible option: a generated sample
Ecore editor never modifies the "resourceToReadOnlyMap".

In the case of the second option, isReadOnly(URI) always returns "true"
for a CDOResource URI, which is the expected according to its
implementation:

protected boolean isReadOnlyURI(URI uri)
{
if (uri.isArchive())
{
return isReadOnlyURI(URI.createURI(uri.authority()));
}

return !uri.isPlatformResource() && (uri.isRelative() ||
!uri.isFile());
}

Since CDO uses URI like this:

cdo://1ff5d226-b1f0-40fb-aba2-0c31b38c764f/myResource

This method will never return false for CDO URI:
CDOResources are not an Archive, nor PlatformResources, and neither a File.

How to get a resource not read-only within an editing domain then?

isReadOnlyURI(URI) seems to be married with the idea of files: anything
that is not a file will always be read-only. I don't feel that's always
necessarily true. This situation proves it.

What do you think? Is the criteria defined in isReadOnlyURI() maybe
incomplete?

Maybe I'm missing some point of the "read-only resource" thing...

Your feedback is very much appreciated :)

Regards,
Víctor.
Re: Problems with read-only resources in an editing domain [message #423140 is a reply to message #423135] Tue, 23 September 2008 17:50 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040309080204090901040102
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

V


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Problems with read-only resources in an editing domain [message #423143 is a reply to message #423140] Tue, 23 September 2008 18:21 Go to previous messageGo to next message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
Messages: 524
Registered: July 2009
Senior Member
Ed,

>> How to get a resource not read-only within an editing domain then?
> This was changed for 2.5...

Oh I see. Wasn't planning to move to 2.4 yet but... It seems it's time
to! :P

>> What do you think? Is the criteria defined in isReadOnlyURI() maybe
>> incomplete?
> It should be using the URIConverter's support for read-only testing.
>
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.emf/org .eclipse.emf/plugins/org.eclipse.emf.edit/src/org/eclipse/em f/edit/domain/AdapterFactoryEditingDomain.java?root=Modeling _Project&r1=1.25&r2=1.26
> < http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.emf/org .eclipse.emf/plugins/org.eclipse.emf.edit/src/org/eclipse/em f/edit/domain/AdapterFactoryEditingDomain.java?root=Modeling _Project&r1=1.25&r2=1.26>
>


Ok, I see. Now URIConverter does the trick...
But then I'll need to modify the editor to user a CDOURIHandler?
Re: Problems with read-only resources in an editing domain [message #423151 is a reply to message #423143] Tue, 23 September 2008 19:41 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
Víctor,

Yes, you'll have to add a handler unless you register CDO as a real live
URL or register it as an EFS scheme...


Víctor Roldán Betancort wrote:
> Ed,
>
>>> How to get a resource not read-only within an editing domain then?
>> This was changed for 2.5...
>
> Oh I see. Wasn't planning to move to 2.4 yet but... It seems it's time
> to! :P
>
>>> What do you think? Is the criteria defined in isReadOnlyURI() maybe
>>> incomplete?
>> It should be using the URIConverter's support for read-only testing.
>>
>>
>> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.emf/org .eclipse.emf/plugins/org.eclipse.emf.edit/src/org/eclipse/em f/edit/domain/AdapterFactoryEditingDomain.java?root=Modeling _Project&r1=1.25&r2=1.26
>>
>>
>> < http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.emf/org .eclipse.emf/plugins/org.eclipse.emf.edit/src/org/eclipse/em f/edit/domain/AdapterFactoryEditingDomain.java?root=Modeling _Project&r1=1.25&r2=1.26>
>>
>>
>
>
> Ok, I see. Now URIConverter does the trick...
> But then I'll need to modify the editor to user a CDOURIHandler?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Problems with read-only resources in an editing domain [message #423173 is a reply to message #423151] Wed, 24 September 2008 11:27 Go to previous message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
Messages: 524
Registered: July 2009
Senior Member
Ed,

thanks for the hint. Fortunately, the new implementation of
isReadOnly(Resource resource) assumes by default that URIs are not
read-only unless URIConverter.ATTRIBUTE_READ_ONLY is added to the URIs
attribute-map. So I don't need to modify anything in the editor, it just
works by using 2.5 :)

Cheers,
Víctor.
Previous Topic:improve resource loading performance
Next Topic:"Initialize by loading" & DocumentRoot
Goto Forum:
  


Current Time: Tue Apr 16 16:24:48 GMT 2024

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

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

Back to the top