Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ve-dev] Is there someplace to store orphan constraints?


Hi Gerald,

>Does VE provide any mechanism that could be used for caching a set of Lists orgainized by, say, EditPart?  Need not be permanently persistent, but available for the duration of a VE editing session against a particular java file.  

Couple of ways to tackle this.  First is to use the edit domain that you can get anytime from EditDomain.getEditDomain(EditPart anEditPart).  This is a singleton object that lives for the duration of the open editor and is for the exact purpose you want.  It has an API to get and put arbitrary pieces of data, and in fact is already used to do things like key which edit part is used by which model object (so synchronized selection can occur) and so forth.

The other way is to create EMF annotations, however I don't think this is what you want because this is really designed for information you want to persist.

>In any case, is EditPart the best object to use as the key selector for these Lists?

Yes, unless you have to deal with scenarios where the edit part gets changed beneath you.  For example, if you delete something the edit part gets thrown away, and on undo a new one comes back even though it's the same model object that gets restored.  If your scenario had to deal with maintaining the key-value link across a delete and undo you might want to key by the IJavaInstance instead, although from your description I think that edit part is probably the best to use for your situation.

Best regards,

Joe Winchester

Back to the top