I'm attaching a slightly enhanced revision of the prototope, newmodel2.zip. The main change is that IHElementDeltaMirror#getResourceDeltas() can now return null, which can be used as a guard by clients that need to support both Eclipse IDE and other targets (it also allowed to ditch HElementDeltaBase.ResourceDeltaContainer).
So, the prototype demonstrates that, by using some tricks based on the "outward impression" [1] that JVM won't resolve a class reference until absolutely necessary, we could keep the design simple and continue to support Eclipse IDE by still exposing IResource etc. in the Handly core API without introducing additional layers of structure *and* enable other targets by making the dependency on o.e.core.resources optional. This is similar to tricks EMF plays (o.e.emf.ecore has an optional dependency on o.e.core.resources).
With this approach, if a model *implementation* were based on, say, java.nio.file instead of o.e.core.resources and needed to run in a plain Java application, it would work perfectly fine -- #getResource()/#getResourceDeltas() would always return null, so JVM would not attempt to load anything IResource.
Regarding the model's *clients*, there are a few things to consider:
* Exposing IResource etc. in the Handly core API (or in a model-specific API for that matter) doesn't make any difference for clients not interesting in workspace-related information, including such clients as Eclipse RCP or plain Java applications -- they would simply not call #getResource() etc. and work just fine since JVM would not attempt to load anything IResource.
* In theory, at least, there might be some clients that could make use of workspace-related information if it were available. Those clients would call #getResource() etc. and check if the return value is not null -- in case it is null such clients would work just fine since JVM would not attempt to load anything IResource. Of course, such clients need to be careful and use appropriate guards before trying to access IResource etc. (such as the check for null above) if they wanted to support both Eclipse IDE and other targets.
Whether we need/can provide more support for those "other targets" remains to be seen and is specifically not something I was trying to address at this time. If enhanced support were indeed deemed desired, we could probably use the same approach of ensuring that such target-specific dependencies remain optional, without introducing additional layers of structure in the core framework.
Best regards,
Vladimir
[1]
https://dev.eclipse.org/mhonarc/lists/handly-dev/msg00176.html