Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Transaction Questions
Transaction Questions [message #12360] Thu, 19 January 2006 11:55 Go to next message
Eclipse UserFriend
Originally posted by: stepper.sympedia.de

Hi Christian,

I'm just evaluating the new Transaction API for use in my product.
Here are some questions:

1) Is it necessary that own ResourceSets implement IEditingDomainProvider to be used with TXEditingDomain?

2) Is a concurrent thread allowed to read (only!) the ResourceSet of the TXEditingDomain directly, for example to validate in background?

3) Where is the relation between the physical files in the workspace and their in memory representation, e.g. Resources in the ResourceSet? What shall an editor do when the user hits "Save"?

Cheers
/Eike
Re: Transaction Questions [message #12371 is a reply to message #12360] Thu, 19 January 2006 12:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: stepper.sympedia.de

I'm just about to analyze your Transaction-related changes to the EXTLibraryEditor.
It would be easier, if you annotated all your changes with @generated NOT (or @ADDED).

Btw. I had to comment out the following in ResourceLoadedListener

IEditorReference[] editors = page.findEditors(
new FileEditorInput(file),
" org.eclipse.emf.workbench.examples.extlibrary.presentation.E XTLibraryEditorID ", //$NON-NLS-1$
IWorkbenchPage.MATCH_ID | IWorkbenchPage.MATCH_INPUT);
page.closeEditors(editors, false);

MATCH_ID and MATCH_INPUT can't be resolved.

Cheers
/Eike



Eike Stepper schrieb:
> Hi Christian,
>
> I'm just evaluating the new Transaction API for use in my product.
> Here are some questions:
>
> 1) Is it necessary that own ResourceSets implement
> IEditingDomainProvider to be used with TXEditingDomain?
>
> 2) Is a concurrent thread allowed to read (only!) the ResourceSet of the
> TXEditingDomain directly, for example to validate in background?
>
> 3) Where is the relation between the physical files in the workspace and
> their in memory representation, e.g. Resources in the ResourceSet? What
> shall an editor do when the user hits "Save"?
>
> Cheers
> /Eike
Re: Transaction Questions [message #12379 is a reply to message #12360] Thu, 19 January 2006 13:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Eike,

See responses in-line, below.

Cheers,

Christian


Eike Stepper wrote:

> Hi Christian,
>
> I'm just evaluating the new Transaction API for use in my product.
> Here are some questions:
>
> 1) Is it necessary that own ResourceSets implement IEditingDomainProvider
> to be used with TXEditingDomain?

No. The TXEditingDomain.Factory links the resource set to its editing
domain by attaching an Adapter to it; the getEditingDomain(ResourceSet)
method does not require the IEditingDomainProvider interface. However, if
you do implement that interface for some other reason, then you will need
to ensure that it is consistent with what the factory thinks the
association is.

>
> 2) Is a concurrent thread allowed to read (only!) the ResourceSet of the
> TXEditingDomain directly, for example to validate in background?

I don't understand your question. A thread may actually read multiple
resource sets in different editing domains, but then you would need to be
wary of deadlocks (perhaps by implementing some kind of domain ordering).

Note that the Transaction API doesn't actually implement concurrency as
such; multiple "concurrent" readers of a resource set must cooperatively
yield read access to others. And write access is exclusive of all readers,
yielding or otherwise.

>
> 3) Where is the relation between the physical files in the workspace and
> their in memory representation, e.g. Resources in the ResourceSet? What
> shall an editor do when the user hits "Save"?

The WorkspaceSynchronizer class can provider the IResource representing an
EMF Resource. As you have probably seen already (indicated by your other
post), the example editor uses this in determining when it needs to refresh
from disk.

>
> Cheers
> /Eike
Re: Transaction Questions [message #12388 is a reply to message #12371] Thu, 19 January 2006 13:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Eike,

Marking the changes with some kind of comment is a good idea. Raise a
bugzilla and I'll see to it!

Regarding the code that you had to comment out: you need the M4 or later
version of Eclipse 3.2. This new findEditors() method is more correct than
the older simple editor-input-based findEditor() because it considers the
editor type as well, so that we do not accidentally close (e.g.) a text
editor.

Cheers,

Christian


Eike Stepper wrote:

> I'm just about to analyze your Transaction-related changes to the
> EXTLibraryEditor. It would be easier, if you annotated all your changes
> with @generated NOT (or @ADDED).
>
> Btw. I had to comment out the following in ResourceLoadedListener
>
> IEditorReference[] editors = page.findEditors(
> new FileEditorInput(file),
>
" org.eclipse.emf.workbench.examples.extlibrary.presentation.E XTLibraryEditorID ",
> //$NON-NLS-1$ IWorkbenchPage.MATCH_ID | IWorkbenchPage.MATCH_INPUT);
> page.closeEditors(editors, false);
>
> MATCH_ID and MATCH_INPUT can't be resolved.
>
> Cheers
> /Eike
>
>
>
> Eike Stepper schrieb:
>> Hi Christian,
>>
>> I'm just evaluating the new Transaction API for use in my product.
>> Here are some questions:
>>
>> 1) Is it necessary that own ResourceSets implement
>> IEditingDomainProvider to be used with TXEditingDomain?
>>
>> 2) Is a concurrent thread allowed to read (only!) the ResourceSet of the
>> TXEditingDomain directly, for example to validate in background?
>>
>> 3) Where is the relation between the physical files in the workspace and
>> their in memory representation, e.g. Resources in the ResourceSet? What
>> shall an editor do when the user hits "Save"?
>>
>> Cheers
>> /Eike
Re: Transaction Questions [message #14466 is a reply to message #12388] Thu, 19 January 2006 22:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: stepper.sympedia.de

Christian W. Damus schrieb:
> Hi, Eike,
>
> Marking the changes with some kind of comment is a good idea. Raise a
> bugzilla and I'll see to it!

I filed https://bugs.eclipse.org/bugs/show_bug.cgi?id=124558

In the context of the generated editor the following bugzilla might also be interesting:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=108470


> Regarding the code that you had to comment out: you need the M4 or later
> version of Eclipse 3.2. This new findEditors() method is more correct than
> the older simple editor-input-based findEditor() because it considers the
> editor type as well, so that we do not accidentally close (e.g.) a text
> editor.

I see. I've had some problems with M4 and switched back to M3.
I'll try newer I-builds...

Thanks
/Eike
Re: Transaction Questions [message #14496 is a reply to message #12379] Thu, 19 January 2006 22:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: stepper.sympedia.de

Christian W. Damus schrieb:
> Hi, Eike,
>
> See responses in-line, below.
>
> Cheers,
>
> Christian
>
>
> Eike Stepper wrote:
>
>
>>Hi Christian,
>>
>>I'm just evaluating the new Transaction API for use in my product.
>>Here are some questions:
>>
>>1) Is it necessary that own ResourceSets implement IEditingDomainProvider
>>to be used with TXEditingDomain?
>
>
> No. The TXEditingDomain.Factory links the resource set to its editing
> domain by attaching an Adapter to it; the getEditingDomain(ResourceSet)
> method does not require the IEditingDomainProvider interface. However, if
> you do implement that interface for some other reason, then you will need
> to ensure that it is consistent with what the factory thinks the
> association is.

I see. That is a nicer solution than EMF's own one ;-)


>>3) Where is the relation between the physical files in the workspace and
>>their in memory representation, e.g. Resources in the ResourceSet? What
>>shall an editor do when the user hits "Save"?
>
>
> The WorkspaceSynchronizer class can provider the IResource representing an
> EMF Resource. As you have probably seen already (indicated by your other
> post), the example editor uses this in determining when it needs to refresh
> from disk.

I should have been running the editor before looking at its code!
I very much like your solution that now there is a visual 1:1 representation
of modified files and editor instances.

Your Transaction component is really great work! Thanks for this ;-)

Cheers
/Eike
Re: Transaction Questions [message #14527 is a reply to message #14496] Thu, 19 January 2006 22:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Thanks for the positive feedback, Eike! That certainly helps to validate
the approach we're taking with this API.

Please don't hesitate to raise any issues that strike you (as I see you are
already doing). I look forward to them.

cW


Eike Stepper wrote:

>
>
> Christian W. Damus schrieb:
>> Hi, Eike,
>>
>> See responses in-line, below.
>>
>> Cheers,
>>
>> Christian
>>
>>
>> Eike Stepper wrote:
>>
>>
>>>Hi Christian,
>>>
>>>I'm just evaluating the new Transaction API for use in my product.
>>>Here are some questions:
>>>
>>>1) Is it necessary that own ResourceSets implement IEditingDomainProvider
>>>to be used with TXEditingDomain?
>>
>>
>> No. The TXEditingDomain.Factory links the resource set to its editing
>> domain by attaching an Adapter to it; the getEditingDomain(ResourceSet)
>> method does not require the IEditingDomainProvider interface. However,
>> if you do implement that interface for some other reason, then you will
>> need to ensure that it is consistent with what the factory thinks the
>> association is.
>
> I see. That is a nicer solution than EMF's own one ;-)
>
>
>>>3) Where is the relation between the physical files in the workspace and
>>>their in memory representation, e.g. Resources in the ResourceSet? What
>>>shall an editor do when the user hits "Save"?
>>
>>
>> The WorkspaceSynchronizer class can provider the IResource representing
>> an
>> EMF Resource. As you have probably seen already (indicated by your other
>> post), the example editor uses this in determining when it needs to
>> refresh from disk.
>
> I should have been running the editor before looking at its code!
> I very much like your solution that now there is a visual 1:1
> representation of modified files and editor instances.
>
> Your Transaction component is really great work! Thanks for this ;-)
>
> Cheers
> /Eike
Re: Transaction Questions [message #14555 is a reply to message #14466] Thu, 19 January 2006 23:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Yes, Eike,

I followed that newsgroup thread with some interest, but I hadn't had a look
at what you and Steven had contributed. I should do so.

cW


Eike Stepper wrote:

>
>
> Christian W. Damus schrieb:
>> Hi, Eike,
>>
>> Marking the changes with some kind of comment is a good idea. Raise a
>> bugzilla and I'll see to it!
>
> I filed https://bugs.eclipse.org/bugs/show_bug.cgi?id=124558
>
> In the context of the generated editor the following bugzilla might also
> be interesting: https://bugs.eclipse.org/bugs/show_bug.cgi?id=108470
>
>
>> Regarding the code that you had to comment out: you need the M4 or later
>> version of Eclipse 3.2. This new findEditors() method is more correct
>> than the older simple editor-input-based findEditor() because it
>> considers the editor type as well, so that we do not accidentally close
>> (e.g.) a text editor.
>
> I see. I've had some problems with M4 and switched back to M3.
> I'll try newer I-builds...
>
> Thanks
> /Eike
Re: Transaction Questions [message #14588 is a reply to message #14496] Fri, 20 January 2006 12:38 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------020900020601010109090306
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Eike,

AdapterFactoryEditingDomain has these methods so it's not generally
necessary for a resource set to implement IEditingDomainProvider
directly; it can provide the support using an adapters:

static public EditingDomain getEditingDomainFor(Object object)
{
if (object instanceof IEditingDomainProvider)
{
EditingDomain editingDomain =
((IEditingDomainProvider)object).getEditingDomain();
return editingDomain;
}
else if (object instanceof EObject)
{
EditingDomain editingDomain =
AdapterFactoryEditingDomain.getEditingDomainFor((EObject)obj ect);
return editingDomain;
}
else if (object instanceof FeatureMap.Entry)
{
return getEditingDomainFor(((FeatureMap.Entry)object).getValue());
}
else if (object instanceof IWrapperItemProvider)
{
return
getEditingDomainFor(((IWrapperItemProvider)object).getValue( ));
}
else
{
return null;
}
}

static public EditingDomain getEditingDomainFor(EObject object)
{
Resource resource = object.eResource();
if (resource != null)
{
IEditingDomainProvider editingDomainProvider =

(IEditingDomainProvider)EcoreUtil.getExistingAdapter(resourc e,
IEditingDomainProvider.class);
if (editingDomainProvider != null)
{
return editingDomainProvider.getEditingDomain();
}
else
{
ResourceSet resourceSet = resource.getResourceSet();
if (resourceSet instanceof IEditingDomainProvider)
{
EditingDomain editingDomain =
((IEditingDomainProvider)resourceSet).getEditingDomain();
return editingDomain;
}
else if (resourceSet != null)
{
editingDomainProvider =
(IEditingDomainProvider)EcoreUtil.getExistingAdapter(resourc eSet,
IEditingDomainProvider.class);
if (editingDomainProvider != null)
{
return editingDomainProvider.getEditingDomain();
}
}
}
}

return null;
}




Eike Stepper wrote:

>
>
> Christian W. Damus schrieb:
>
>> Hi, Eike,
>>
>> See responses in-line, below.
>>
>> Cheers,
>>
>> Christian
>>
>>
>> Eike Stepper wrote:
>>
>>
>>> Hi Christian,
>>>
>>> I'm just evaluating the new Transaction API for use in my product.
>>> Here are some questions:
>>>
>>> 1) Is it necessary that own ResourceSets implement
>>> IEditingDomainProvider
>>> to be used with TXEditingDomain?
>>
>>
>>
>> No. The TXEditingDomain.Factory links the resource set to its editing
>> domain by attaching an Adapter to it; the getEditingDomain(ResourceSet)
>> method does not require the IEditingDomainProvider interface.
>> However, if
>> you do implement that interface for some other reason, then you will
>> need
>> to ensure that it is consistent with what the factory thinks the
>> association is.
>
>
> I see. That is a nicer solution than EMF's own one ;-)
>
>
>>> 3) Where is the relation between the physical files in the workspace
>>> and
>>> their in memory representation, e.g. Resources in the ResourceSet? What
>>> shall an editor do when the user hits "Save"?
>>
>>
>>
>> The WorkspaceSynchronizer class can provider the IResource
>> representing an
>> EMF Resource. As you have probably seen already (indicated by your
>> other
>> post), the example editor uses this in determining when it needs to
>> refresh
>> from disk.
>
>
> I should have been running the editor before looking at its code!
> I very much like your solution that now there is a visual 1:1
> representation
> of modified files and editor instances.
>
> Your Transaction component is really great work! Thanks for this ;-)
>
> Cheers
> /Eike



--------------020900020601010109090306
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Eike,<br>
<br>
AdapterFactoryEditingDomain has these methods so it's not generally
necessary for a resource set to implement IEditingDomainProvider
directly; it can provide the support using an adapters:<br>
<blockquote><small>&nbsp; static public EditingDomain
getEditingDomainFor(Object object)</small><br>
<small>&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp; if (object instanceof IEditingDomainProvider)</small><br>
<small>&nbsp;&nbsp;&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EditingDomain editingDomain =
((IEditingDomainProvider)object).getEditingDomain();</small ><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return editingDomain;</small><br>
<small>&nbsp;&nbsp;&nbsp; }</small><br>
<small>&nbsp;&nbsp;&nbsp; else if (object instanceof EObject)</small><br>
<small>&nbsp;&nbsp;&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EditingDomain editingDomain =
AdapterFactoryEditingDomain.getEditingDomainFor((EObject)obj ect); </small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return editingDomain;</small><br>
<small>&nbsp;&nbsp;&nbsp; }</small><br>
<small>&nbsp;&nbsp;&nbsp; else if (object instanceof FeatureMap.Entry)</small><br>
<small>&nbsp;&nbsp;&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return
getEditingDomainFor(((FeatureMap.Entry)object).getValue());</small ><br>
<small>&nbsp;&nbsp;&nbsp; }</small><br>
<small>&nbsp;&nbsp;&nbsp; else if (object instanceof IWrapperItemProvider)</small><br>
<small>&nbsp;&nbsp;&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return
getEditingDomainFor(((IWrapperItemProvider)object).getValue( )); </small><br>
<small>&nbsp;&nbsp;&nbsp; }</small><br>
<small>&nbsp;&nbsp;&nbsp; else</small><br>
<small>&nbsp;&nbsp;&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return null;</small><br>
<small>&nbsp;&nbsp;&nbsp; }</small><br>
<small>&nbsp; }<br>
<br>
&nbsp; static public EditingDomain getEditingDomainFor(EObject object)<br>
&nbsp; {<br>
&nbsp;&nbsp;&nbsp; Resource resource = object.eResource();<br>
&nbsp;&nbsp;&nbsp; if (resource != null)<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IEditingDomainProvider editingDomainProvider =<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; (IEditingDomainProvider)EcoreUtil.getExistingAdapter(resourc e,
IEditingDomainProvider.class);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (editingDomainProvider != null)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; return editingDomainProvider.getEditingDomain();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; ResourceSet resourceSet = resource.getResourceSet();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; if (resourceSet instanceof IEditingDomainProvider)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; EditingDomain editingDomain =
((IEditingDomainProvider)resourceSet).getEditingDomain();<br >
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return editingDomain;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; else if (resourceSet != null)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; editingDomainProvider =
(IEditingDomainProvider)EcoreUtil.getExistingAdapter(resourc eSet,
IEditingDomainProvider.class);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (editingDomainProvider != null)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return editingDomainProvider.getEditingDomain();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp; return null;<br>
&nbsp; }<br>
</small></blockquote>
<br>
<br>
<br>
Eike Stepper wrote:
<blockquote cite="middqp53t$70j$1@utils.eclipse.org" type="cite"><br>
<br>
Christian W. Damus schrieb:
<br>
<blockquote type="cite">Hi, Eike,
<br>
<br>
See responses in-line, below.
<br>
<br>
Cheers,
<br>
<br>
Christian
<br>
<br>
<br>
Eike Stepper wrote:
<br>
<br>
<br>
<blockquote type="cite">Hi Christian,
<br>
<br>
I'm just evaluating the new Transaction API for use in my product.
<br>
Here are some questions:
<br>
<br>
1) Is it necessary that own ResourceSets implement
IEditingDomainProvider
<br>
to be used with TXEditingDomain?
<br>
</blockquote>
<br>
<br>
No.&nbsp; The TXEditingDomain.Factory links the resource set to its editing
<br>
domain by attaching an Adapter to it; the getEditingDomain(ResourceSet)
<br>
method does not require the IEditingDomainProvider interface.&nbsp; However,
if
<br>
you do implement that interface for some other reason, then you will
need
<br>
to ensure that it is consistent with what the factory thinks the
<br>
association is.
<br>
</blockquote>
<br>
I see. That is a nicer solution than EMF's own one ;-)
<br>
<br>
<br>
<blockquote type="cite">
<blockquote type="cite">3) Where is the relation between the
physical files in the workspace and
<br>
their in memory representation, e.g. Resources in the ResourceSet? What
<br>
shall an editor do when the user hits "Save"?
<br>
</blockquote>
<br>
<br>
The WorkspaceSynchronizer class can provider the IResource representing
an
<br>
EMF Resource.&nbsp; As you have probably seen already (indicated by your
other
<br>
post), the example editor uses this in determining when it needs to
refresh
<br>
from disk.
<br>
</blockquote>
<br>
I should have been running the editor before looking at its code!
<br>
I very much like your solution that now there is a visual 1:1
representation
<br>
of modified files and editor instances.
<br>
<br>
Your Transaction component is really great work! Thanks for this ;-)
<br>
<br>
Cheers
<br>
/Eike
<br>
</blockquote>
<br>
</body>
</html>

--------------020900020601010109090306--
Re: Transaction Questions [message #563162 is a reply to message #12360] Thu, 19 January 2006 12:51 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6690
Registered: July 2009
Senior Member
I'm just about to analyze your Transaction-related changes to the EXTLibraryEditor.
It would be easier, if you annotated all your changes with @generated NOT (or @ADDED).

Btw. I had to comment out the following in ResourceLoadedListener

IEditorReference[] editors = page.findEditors(
new FileEditorInput(file),
" org.eclipse.emf.workbench.examples.extlibrary.presentation.E XTLibraryEditorID ", //$NON-NLS-1$
IWorkbenchPage.MATCH_ID | IWorkbenchPage.MATCH_INPUT);
page.closeEditors(editors, false);

MATCH_ID and MATCH_INPUT can't be resolved.

Cheers
/Eike



Eike Stepper schrieb:
> Hi Christian,
>
> I'm just evaluating the new Transaction API for use in my product.
> Here are some questions:
>
> 1) Is it necessary that own ResourceSets implement
> IEditingDomainProvider to be used with TXEditingDomain?
>
> 2) Is a concurrent thread allowed to read (only!) the ResourceSet of the
> TXEditingDomain directly, for example to validate in background?
>
> 3) Where is the relation between the physical files in the workspace and
> their in memory representation, e.g. Resources in the ResourceSet? What
> shall an editor do when the user hits "Save"?
>
> Cheers
> /Eike


Re: Transaction Questions [message #563187 is a reply to message #12360] Thu, 19 January 2006 13:38 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Eike,

See responses in-line, below.

Cheers,

Christian


Eike Stepper wrote:

> Hi Christian,
>
> I'm just evaluating the new Transaction API for use in my product.
> Here are some questions:
>
> 1) Is it necessary that own ResourceSets implement IEditingDomainProvider
> to be used with TXEditingDomain?

No. The TXEditingDomain.Factory links the resource set to its editing
domain by attaching an Adapter to it; the getEditingDomain(ResourceSet)
method does not require the IEditingDomainProvider interface. However, if
you do implement that interface for some other reason, then you will need
to ensure that it is consistent with what the factory thinks the
association is.

>
> 2) Is a concurrent thread allowed to read (only!) the ResourceSet of the
> TXEditingDomain directly, for example to validate in background?

I don't understand your question. A thread may actually read multiple
resource sets in different editing domains, but then you would need to be
wary of deadlocks (perhaps by implementing some kind of domain ordering).

Note that the Transaction API doesn't actually implement concurrency as
such; multiple "concurrent" readers of a resource set must cooperatively
yield read access to others. And write access is exclusive of all readers,
yielding or otherwise.

>
> 3) Where is the relation between the physical files in the workspace and
> their in memory representation, e.g. Resources in the ResourceSet? What
> shall an editor do when the user hits "Save"?

The WorkspaceSynchronizer class can provider the IResource representing an
EMF Resource. As you have probably seen already (indicated by your other
post), the example editor uses this in determining when it needs to refresh
from disk.

>
> Cheers
> /Eike
Re: Transaction Questions [message #563212 is a reply to message #12371] Thu, 19 January 2006 13:41 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Eike,

Marking the changes with some kind of comment is a good idea. Raise a
bugzilla and I'll see to it!

Regarding the code that you had to comment out: you need the M4 or later
version of Eclipse 3.2. This new findEditors() method is more correct than
the older simple editor-input-based findEditor() because it considers the
editor type as well, so that we do not accidentally close (e.g.) a text
editor.

Cheers,

Christian


Eike Stepper wrote:

> I'm just about to analyze your Transaction-related changes to the
> EXTLibraryEditor. It would be easier, if you annotated all your changes
> with @generated NOT (or @ADDED).
>
> Btw. I had to comment out the following in ResourceLoadedListener
>
> IEditorReference[] editors = page.findEditors(
> new FileEditorInput(file),
>
" org.eclipse.emf.workbench.examples.extlibrary.presentation.E XTLibraryEditorID ",
> //$NON-NLS-1$ IWorkbenchPage.MATCH_ID | IWorkbenchPage.MATCH_INPUT);
> page.closeEditors(editors, false);
>
> MATCH_ID and MATCH_INPUT can't be resolved.
>
> Cheers
> /Eike
>
>
>
> Eike Stepper schrieb:
>> Hi Christian,
>>
>> I'm just evaluating the new Transaction API for use in my product.
>> Here are some questions:
>>
>> 1) Is it necessary that own ResourceSets implement
>> IEditingDomainProvider to be used with TXEditingDomain?
>>
>> 2) Is a concurrent thread allowed to read (only!) the ResourceSet of the
>> TXEditingDomain directly, for example to validate in background?
>>
>> 3) Where is the relation between the physical files in the workspace and
>> their in memory representation, e.g. Resources in the ResourceSet? What
>> shall an editor do when the user hits "Save"?
>>
>> Cheers
>> /Eike
Re: Transaction Questions [message #563423 is a reply to message #12388] Thu, 19 January 2006 22:20 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6690
Registered: July 2009
Senior Member
Christian W. Damus schrieb:
> Hi, Eike,
>
> Marking the changes with some kind of comment is a good idea. Raise a
> bugzilla and I'll see to it!

I filed https://bugs.eclipse.org/bugs/show_bug.cgi?id=124558

In the context of the generated editor the following bugzilla might also be interesting:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=108470


> Regarding the code that you had to comment out: you need the M4 or later
> version of Eclipse 3.2. This new findEditors() method is more correct than
> the older simple editor-input-based findEditor() because it considers the
> editor type as well, so that we do not accidentally close (e.g.) a text
> editor.

I see. I've had some problems with M4 and switched back to M3.
I'll try newer I-builds...

Thanks
/Eike


Re: Transaction Questions [message #563449 is a reply to message #12379] Thu, 19 January 2006 22:50 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6690
Registered: July 2009
Senior Member
Christian W. Damus schrieb:
> Hi, Eike,
>
> See responses in-line, below.
>
> Cheers,
>
> Christian
>
>
> Eike Stepper wrote:
>
>
>>Hi Christian,
>>
>>I'm just evaluating the new Transaction API for use in my product.
>>Here are some questions:
>>
>>1) Is it necessary that own ResourceSets implement IEditingDomainProvider
>>to be used with TXEditingDomain?
>
>
> No. The TXEditingDomain.Factory links the resource set to its editing
> domain by attaching an Adapter to it; the getEditingDomain(ResourceSet)
> method does not require the IEditingDomainProvider interface. However, if
> you do implement that interface for some other reason, then you will need
> to ensure that it is consistent with what the factory thinks the
> association is.

I see. That is a nicer solution than EMF's own one ;-)


>>3) Where is the relation between the physical files in the workspace and
>>their in memory representation, e.g. Resources in the ResourceSet? What
>>shall an editor do when the user hits "Save"?
>
>
> The WorkspaceSynchronizer class can provider the IResource representing an
> EMF Resource. As you have probably seen already (indicated by your other
> post), the example editor uses this in determining when it needs to refresh
> from disk.

I should have been running the editor before looking at its code!
I very much like your solution that now there is a visual 1:1 representation
of modified files and editor instances.

Your Transaction component is really great work! Thanks for this ;-)

Cheers
/Eike


Re: Transaction Questions [message #563472 is a reply to message #14496] Thu, 19 January 2006 22:56 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Thanks for the positive feedback, Eike! That certainly helps to validate
the approach we're taking with this API.

Please don't hesitate to raise any issues that strike you (as I see you are
already doing). I look forward to them.

cW


Eike Stepper wrote:

>
>
> Christian W. Damus schrieb:
>> Hi, Eike,
>>
>> See responses in-line, below.
>>
>> Cheers,
>>
>> Christian
>>
>>
>> Eike Stepper wrote:
>>
>>
>>>Hi Christian,
>>>
>>>I'm just evaluating the new Transaction API for use in my product.
>>>Here are some questions:
>>>
>>>1) Is it necessary that own ResourceSets implement IEditingDomainProvider
>>>to be used with TXEditingDomain?
>>
>>
>> No. The TXEditingDomain.Factory links the resource set to its editing
>> domain by attaching an Adapter to it; the getEditingDomain(ResourceSet)
>> method does not require the IEditingDomainProvider interface. However,
>> if you do implement that interface for some other reason, then you will
>> need to ensure that it is consistent with what the factory thinks the
>> association is.
>
> I see. That is a nicer solution than EMF's own one ;-)
>
>
>>>3) Where is the relation between the physical files in the workspace and
>>>their in memory representation, e.g. Resources in the ResourceSet? What
>>>shall an editor do when the user hits "Save"?
>>
>>
>> The WorkspaceSynchronizer class can provider the IResource representing
>> an
>> EMF Resource. As you have probably seen already (indicated by your other
>> post), the example editor uses this in determining when it needs to
>> refresh from disk.
>
> I should have been running the editor before looking at its code!
> I very much like your solution that now there is a visual 1:1
> representation of modified files and editor instances.
>
> Your Transaction component is really great work! Thanks for this ;-)
>
> Cheers
> /Eike
Re: Transaction Questions [message #563502 is a reply to message #14466] Thu, 19 January 2006 23:00 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Yes, Eike,

I followed that newsgroup thread with some interest, but I hadn't had a look
at what you and Steven had contributed. I should do so.

cW


Eike Stepper wrote:

>
>
> Christian W. Damus schrieb:
>> Hi, Eike,
>>
>> Marking the changes with some kind of comment is a good idea. Raise a
>> bugzilla and I'll see to it!
>
> I filed https://bugs.eclipse.org/bugs/show_bug.cgi?id=124558
>
> In the context of the generated editor the following bugzilla might also
> be interesting: https://bugs.eclipse.org/bugs/show_bug.cgi?id=108470
>
>
>> Regarding the code that you had to comment out: you need the M4 or later
>> version of Eclipse 3.2. This new findEditors() method is more correct
>> than the older simple editor-input-based findEditor() because it
>> considers the editor type as well, so that we do not accidentally close
>> (e.g.) a text editor.
>
> I see. I've had some problems with M4 and switched back to M3.
> I'll try newer I-builds...
>
> Thanks
> /Eike
Re: Transaction Questions [message #563528 is a reply to message #14496] Fri, 20 January 2006 12:38 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33252
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020900020601010109090306
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Eike,

AdapterFactoryEditingDomain has these methods so it's not generally
necessary for a resource set to implement IEditingDomainProvider
directly; it can provide the support using an adapters:

static public EditingDomain getEditingDomainFor(Object object)
{
if (object instanceof IEditingDomainProvider)
{
EditingDomain editingDomain =
((IEditingDomainProvider)object).getEditingDomain();
return editingDomain;
}
else if (object instanceof EObject)
{
EditingDomain editingDomain =
AdapterFactoryEditingDomain.getEditingDomainFor((EObject)obj ect);
return editingDomain;
}
else if (object instanceof FeatureMap.Entry)
{
return getEditingDomainFor(((FeatureMap.Entry)object).getValue());
}
else if (object instanceof IWrapperItemProvider)
{
return
getEditingDomainFor(((IWrapperItemProvider)object).getValue( ));
}
else
{
return null;
}
}

static public EditingDomain getEditingDomainFor(EObject object)
{
Resource resource = object.eResource();
if (resource != null)
{
IEditingDomainProvider editingDomainProvider =

(IEditingDomainProvider)EcoreUtil.getExistingAdapter(resourc e,
IEditingDomainProvider.class);
if (editingDomainProvider != null)
{
return editingDomainProvider.getEditingDomain();
}
else
{
ResourceSet resourceSet = resource.getResourceSet();
if (resourceSet instanceof IEditingDomainProvider)
{
EditingDomain editingDomain =
((IEditingDomainProvider)resourceSet).getEditingDomain();
return editingDomain;
}
else if (resourceSet != null)
{
editingDomainProvider =
(IEditingDomainProvider)EcoreUtil.getExistingAdapter(resourc eSet,
IEditingDomainProvider.class);
if (editingDomainProvider != null)
{
return editingDomainProvider.getEditingDomain();
}
}
}
}

return null;
}




Eike Stepper wrote:

>
>
> Christian W. Damus schrieb:
>
>> Hi, Eike,
>>
>> See responses in-line, below.
>>
>> Cheers,
>>
>> Christian
>>
>>
>> Eike Stepper wrote:
>>
>>
>>> Hi Christian,
>>>
>>> I'm just evaluating the new Transaction API for use in my product.
>>> Here are some questions:
>>>
>>> 1) Is it necessary that own ResourceSets implement
>>> IEditingDomainProvider
>>> to be used with TXEditingDomain?
>>
>>
>>
>> No. The TXEditingDomain.Factory links the resource set to its editing
>> domain by attaching an Adapter to it; the getEditingDomain(ResourceSet)
>> method does not require the IEditingDomainProvider interface.
>> However, if
>> you do implement that interface for some other reason, then you will
>> need
>> to ensure that it is consistent with what the factory thinks the
>> association is.
>
>
> I see. That is a nicer solution than EMF's own one ;-)
>
>
>>> 3) Where is the relation between the physical files in the workspace
>>> and
>>> their in memory representation, e.g. Resources in the ResourceSet? What
>>> shall an editor do when the user hits "Save"?
>>
>>
>>
>> The WorkspaceSynchronizer class can provider the IResource
>> representing an
>> EMF Resource. As you have probably seen already (indicated by your
>> other
>> post), the example editor uses this in determining when it needs to
>> refresh
>> from disk.
>
>
> I should have been running the editor before looking at its code!
> I very much like your solution that now there is a visual 1:1
> representation
> of modified files and editor instances.
>
> Your Transaction component is really great work! Thanks for this ;-)
>
> Cheers
> /Eike



--------------020900020601010109090306
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Eike,<br>
<br>
AdapterFactoryEditingDomain has these methods so it's not generally
necessary for a resource set to implement IEditingDomainProvider
directly; it can provide the support using an adapters:<br>
<blockquote><small>&nbsp; static public EditingDomain
getEditingDomainFor(Object object)</small><br>
<small>&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp; if (object instanceof IEditingDomainProvider)</small><br>
<small>&nbsp;&nbsp;&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EditingDomain editingDomain =
((IEditingDomainProvider)object).getEditingDomain();</small ><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return editingDomain;</small><br>
<small>&nbsp;&nbsp;&nbsp; }</small><br>
<small>&nbsp;&nbsp;&nbsp; else if (object instanceof EObject)</small><br>
<small>&nbsp;&nbsp;&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EditingDomain editingDomain =
AdapterFactoryEditingDomain.getEditingDomainFor((EObject)obj ect); </small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return editingDomain;</small><br>
<small>&nbsp;&nbsp;&nbsp; }</small><br>
<small>&nbsp;&nbsp;&nbsp; else if (object instanceof FeatureMap.Entry)</small><br>
<small>&nbsp;&nbsp;&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return
getEditingDomainFor(((FeatureMap.Entry)object).getValue());</small ><br>
<small>&nbsp;&nbsp;&nbsp; }</small><br>
<small>&nbsp;&nbsp;&nbsp; else if (object instanceof IWrapperItemProvider)</small><br>
<small>&nbsp;&nbsp;&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return
getEditingDomainFor(((IWrapperItemProvider)object).getValue( )); </small><br>
<small>&nbsp;&nbsp;&nbsp; }</small><br>
<small>&nbsp;&nbsp;&nbsp; else</small><br>
<small>&nbsp;&nbsp;&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return null;</small><br>
<small>&nbsp;&nbsp;&nbsp; }</small><br>
<small>&nbsp; }<br>
<br>
&nbsp; static public EditingDomain getEditingDomainFor(EObject object)<br>
&nbsp; {<br>
&nbsp;&nbsp;&nbsp; Resource resource = object.eResource();<br>
&nbsp;&nbsp;&nbsp; if (resource != null)<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IEditingDomainProvider editingDomainProvider =<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; (IEditingDomainProvider)EcoreUtil.getExistingAdapter(resourc e,
IEditingDomainProvider.class);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (editingDomainProvider != null)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; return editingDomainProvider.getEditingDomain();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; ResourceSet resourceSet = resource.getResourceSet();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; if (resourceSet instanceof IEditingDomainProvider)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; EditingDomain editingDomain =
((IEditingDomainProvider)resourceSet).getEditingDomain();<br >
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return editingDomain;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; else if (resourceSet != null)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; editingDomainProvider =
(IEditingDomainProvider)EcoreUtil.getExistingAdapter(resourc eSet,
IEditingDomainProvider.class);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (editingDomainProvider != null)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return editingDomainProvider.getEditingDomain();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp; return null;<br>
&nbsp; }<br>
</small></blockquote>
<br>
<br>
<br>
Eike Stepper wrote:
<blockquote cite="middqp53t$70j$1@utils.eclipse.org" type="cite"><br>
<br>
Christian W. Damus schrieb:
<br>
<blockquote type="cite">Hi, Eike,
<br>
<br>
See responses in-line, below.
<br>
<br>
Cheers,
<br>
<br>
Christian
<br>
<br>
<br>
Eike Stepper wrote:
<br>
<br>
<br>
<blockquote type="cite">Hi Christian,
<br>
<br>
I'm just evaluating the new Transaction API for use in my product.
<br>
Here are some questions:
<br>
<br>
1) Is it necessary that own ResourceSets implement
IEditingDomainProvider
<br>
to be used with TXEditingDomain?
<br>
</blockquote>
<br>
<br>
No.&nbsp; The TXEditingDomain.Factory links the resource set to its editing
<br>
domain by attaching an Adapter to it; the getEditingDomain(ResourceSet)
<br>
method does not require the IEditingDomainProvider interface.&nbsp; However,
if
<br>
you do implement that interface for some other reason, then you will
need
<br>
to ensure that it is consistent with what the factory thinks the
<br>
association is.
<br>
</blockquote>
<br>
I see. That is a nicer solution than EMF's own one ;-)
<br>
<br>
<br>
<blockquote type="cite">
<blockquote type="cite">3) Where is the relation between the
physical files in the workspace and
<br>
their in memory representation, e.g. Resources in the ResourceSet? What
<br>
shall an editor do when the user hits "Save"?
<br>
</blockquote>
<br>
<br>
The WorkspaceSynchronizer class can provider the IResource representing
an
<br>
EMF Resource.&nbsp; As you have probably seen already (indicated by your
other
<br>
post), the example editor uses this in determining when it needs to
refresh
<br>
from disk.
<br>
</blockquote>
<br>
I should have been running the editor before looking at its code!
<br>
I very much like your solution that now there is a visual 1:1
representation
<br>
of modified files and editor instances.
<br>
<br>
Your Transaction component is really great work! Thanks for this ;-)
<br>
<br>
Cheers
<br>
/Eike
<br>
</blockquote>
<br>
</body>
</html>

--------------020900020601010109090306--


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[Announce] EMFT VALIDATION 1.0.0 I200601191249 is available
Next Topic:[Announce] EMFT VALIDATION 1.0.0 I200601191249 is available
Goto Forum:
  


Current Time: Fri Nov 08 21:55:06 GMT 2024

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

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

Back to the top