[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [handly-dev] Doing work in Handle or in Body
|
Hi Vlad, hi Vladimir and others!
I'm also very interested in this and looking forward to see Vladimir's response. In the meantime, let me share my 2ยข about it.
From my point of view there are two separate questions to answer:
1) Do we have to load classpath configuration to create a handle? The answer is obviously yes as there's no 1:1 mapping between the basic resource model and Java elements.
2) Do we have to build the project structure to create a handle? Now, it depends on the way a model is implemented, but generally I don't think it is required. What more - I don't think the current Java model example does it - what it does is it loads the classpath configuration, but AFAIK structure building is not triggered until you call getChildren(), getNonJavaResources() or until you call these methods on any of project's child - none of which seems to happen when you create a handle for a package fragment. On the other hand the Java example partially avoids this problem simply by not caching the classpath configuration at all (it's still work in progress and caching is not yet implemented). I can't speak for Vladimir, by according to my our previous discussion with him, his plan to handle classpath caching is to do the same JDT does - store it separately outside the project model body in a object with a bit different life cycle (see PerProjectInfo in JDT). This provides a way to cache project configuration without having to build the project body and possibly keep operating with handles lightweight. For the record, it's the way I'm going to go too.
Maybe a similar approach would work also for your model.
Vladimir, please correct me if I'm wrong or misinterpreting something.
Regards,
Ondrej
On 25. 3. 2015 14:29:17, Vlad Dumitrescu <vladdu55@xxxxxxxxx> wrote:
Hi Vladimir,
I am still a bit uncertain about how to separate handles and bodies, so I'm reviving this older discussion.
The thing that bothers me is that for models that are more complicated than a toy, projects get their configuration from a file or preferences. This configuration belongs to the body, as it's not lightweight and is not a value object since it can be changed. The problem is that, using your simple Java model as example, in order to decide if we should create a handle for a folder or not (if it's on the classpath or not), we need to access the project body to read the classpath. This in turn might trigger building the project's structure and operating with handles is no longer lightweight.
In your Java example you hide this in the API by catching the CoreException, but the side effects can still be significant. In practice it means that there are very few operations that will be "handle only", so I'd like to hear your thoughts about it.
best regards,
Vlad
_______________________________________________
handly-dev mailing list
handly-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/handly-dev