> Charles,
>
> Comments below.
>
> Charles Martin wrote:
> > Thanks Ed
> >
> > So while the undo feature of EMF is quite nice,
> for my application, I don't really need it. What I
> need (I think) is to know the best way to acquire and
> release a lock on an EMF resource.
> >
> This makes me think you aren't so much tracking
> user's changes but
> something else since users always want to be able to
> undo the changes
> they make directly.
This is for a near-real time trading application. The user views the market data, and enters potential positions. They don't undo anything. if they don't like what they enter, they don't undo it--they simply hit the clear button and then enter a new position. For now, that's all I need.
I say near real time because the analysis takes upto a minute. This is fine for this application.
> > I assume the (only) way to do this is to use an
> EditingCommand to set a flg on the EMF model to
> indicate a lock has been aquired, and to attach a
> Resource ResourceSetListener to the
> TranactionalEditingDomain that sends processing the
> notification that that the resource has been changed.
>
> >
> I'm not entirely clear how the generated plot relates
> to what the user
> is editing. Are there really two models? The data
> being fed into the
> plot and the plot that's produced from their data?
> Is the later
> ditable or only the former? If only the input data
> is editable and the
> plot is like a derived model, you'd probably want to
> have a read
> transaction for the data and cooperatively yield so
> that the UI isn't
> locked out. When the plot is done, you'd likely want
> to completely
> replace the plot currently being viewed. I.e., don't
> modify the
> existing plot but rather replace it after it's
> recomputed...
> >
Yeah, something like this, however, the plot will respond to user edits and reads--you can think of the EMF editor as a join on two SQL tables--one is read from the database every 5 minutes, the other is being edited by the user and persists in time. The plot depends on both.
I'll think about what the "read transaction" and see if i can get that work work.
> > Or perhaps I should just be using the standard
> Eclipse locking mechanism in the Eclipse 3.0 Jobs API
> What makes this a bit confusing is some of the
> on-line example assumes the use of the
> ResourcesPlugin (i.e. not an RCP):
>
> ortunately, assumptions about workspace resources
> being used have
> tended to permeate a lot of APIs. I suspect you
> would want to make use
> of Jobs for this type of thing; the transaction
> support will help with
> controlled access from such jobs.
> >
> http://www.eclipse.org/articles/Article-Concurrency/jo
> bs-api.html
> >
> >
> > I guess it is still just a bit confusing how the
> EMF use of resources differs from the Eclipse
> ResourcesPlugin ?
> EMF's resources are designed to support a purely
> RESTful style of
> access. No assumptions are made about how the
> contents for URIs are set
> and retrieved and all access is delegated to the
> URIConverter; EMF 2.4
> strengthens these APIs further to support the full
> life cycle, including
> delete. Eclipse's workspace is more analogous in
> some ways to a
> repository where you can always know the full closure
> of all the data
> known to the application (what I often refer to as a
> closed world model
> as opposed to REST which is an open world model
> because the data space
> knows no bounds).
Thanks.
> > At first I naively thought I could just take
> advantage of the Eclipse Resources Plugin and the
> ResourceChangeNotifications there, but after having
> look at this a while, it appears that this is NOT the
> thing to do with EMF (especially for an Eclipse EMF
> RCP).
> >
> I suppose you could if the plot itself was saved to a
> resource and the
> editor was displaying the contents of that resource.
> > Of course, I could just "punt" and use the Java
> 1.5 Concurrency Libraries and manage the locks
> myself, but this just does not seem to be the Eclipse
> way or the EMF way.
> >
> I think you'd likely want to use jobs.
Thanks. I'll see what I can do.
> > Again, any clarification is appreciated, and I am
> continuing to plug through as much of this as I can.
> >
> Probably I don't quite understand how the user's data
> is related to the
> plot and if the plot itself is editable or just
> something that's viewed.
Yeah, I thought if I shared some details it might be easier to understand. Actually the whole application is quite straightforward, except for the threading.
> > Thanks again
> >
> > Charles
> >
> > P.S. I have also considered using the Eclipse
> framework for Natures and Builders to treat my
> calculations like a compilation, and to have a "run
> button" . Still, this is a bit of an overkil for
> what I am doing presently, and I still am not 100%
> sure how to intermingle this with EMF, and within an
> RCP.
> >
> Yes, I suppose the question is do you want to have a
> plot resource that
> keeps itself up-to-date whenever the inputs change.
> Certainly that
> pproach turns it into a simpler problem of unload and
> reloading a
> resource based on a workspace delta...
It really is just an issue of consistency...if the EMF model becomes dirty, then the plot is invalid. If the plot is calculating, then the editor has to be disabled. My kneejerk first design is just to place a mutex lock in the main Plugin class and post a message to every view/editor whenever the lock is acquired or released. I have just been trying to see if the Eclipse platform and/or the EMF framework has it's own way of doing this which is more natural.