Community
Participate
Working Groups
Steps: 1. Create new context 2. Add Ecore class element to context. The context looks something like this: pre. <?xml version="1.0" encoding="UTF-8"?> <InteractionHistory Id="local-3" Version="1"> <InteractionEvent Delta="null" EndDate="2011-09-15 11:47:34.878 CEST" Interest="0.01700002" Kind="propagation" Navigation="org.eclipse.mylyn.core.model.edges.containment" OriginId="org.eclipse.mylyn.core.model.interest.propagation" StartDate="2011-09-15 11:47:34.878 CEST" StructureHandle="/Tools/DefaultName2.ecore" StructureKind=""/> <InteractionEvent Delta="null" EndDate="2011-09-15 11:47:25.599 CEST" Interest="1.0" Kind="selection" Navigation="null" OriginId="org.eclipse.ui.navigator.ProjectExplorer" StartDate="2011-09-15 11:47:25.599 CEST" StructureHandle="/Tools/DefaultName2.ecore" StructureKind="ecore"/> <InteractionEvent Delta="null" EndDate="2011-09-15 11:47:34.869 CEST" Interest="1.0" Kind="selection" Navigation="null" OriginId="org.eclipse.ui.navigator.ProjectExplorer" StartDate="2011-09-15 11:47:34.869 CEST" StructureHandle="platform:/resource/Tools/DefaultName2.ecore#//EPackage0/EClass1" StructureKind="ecore"/> </InteractionHistory> 3. Remove DefaultName2.ecore from context The resulting context looks like this: pre. <?xml version="1.0" encoding="UTF-8"?> <InteractionHistory Id="local-3" Version="1"> <InteractionEvent Delta="null" EndDate="2011-09-15 11:51:34.384 CEST" Interest="5.0340004" Kind="propagation" Navigation="org.eclipse.mylyn.core.model.edges.containment" OriginId="org.eclipse.mylyn.core.model.interest.propagation" StartDate="2011-09-15 11:50:39.824 CEST" StructureHandle="" StructureKind="java" NumEvents="4" CreationCount="0"/> <InteractionEvent Delta="null" EndDate="2011-09-15 11:51:34.383 CEST" Interest="5.017" Kind="propagation" Navigation="org.eclipse.mylyn.core.model.edges.containment" OriginId="org.eclipse.mylyn.core.model.interest.propagation" StartDate="2011-09-15 11:50:39.824 CEST" StructureHandle="=Tools" StructureKind="java" NumEvents="4" CreationCount="1"/> <InteractionEvent Delta="null" EndDate="2011-09-15 11:51:34.259 CEST" Interest="3.0" Kind="selection" Navigation="null" OriginId="org.eclipse.ui.navigator.ProjectExplorer" StartDate="2011-09-15 11:47:34.869 CEST" StructureHandle="platform:/resource/Tools/DefaultName2.ecore#//EPackage0/EClass1" StructureKind="ecore" NumEvents="3" CreationCount="2"/> <InteractionEvent Delta="null" EndDate="2011-09-15 11:51:34.383 CEST" Interest="4.0" Kind="propagation" Navigation="org.eclipse.mylyn.core.model.edges.containment" OriginId="org.eclipse.mylyn.core.model.interest.propagation" StartDate="2011-09-15 11:50:39.824 CEST" StructureHandle="/" StructureKind="resource" NumEvents="4" CreationCount="1"/> <InteractionEvent Delta="null" EndDate="2011-09-15 11:51:34.383 CEST" Interest="4.0" Kind="propagation" Navigation="null" OriginId="org.eclipse.ui.navigator.ProjectExplorer" StartDate="2011-09-15 11:50:39.824 CEST" StructureHandle="/Tools" StructureKind="resource" NumEvents="4" CreationCount="1"/> </InteractionHistory> The "platform:/resource/Tools/DefaultName2.ecore#//EPackage0/EClass" element is still in the context. The other things that looks strange is that there are no propagation events for the EPackage0 node in the interaction history.
I assume the java elements are extraneous. This is actually a bit of a deeper issue that we've discussed before but we need to keep thinking about. Given: 1. We track elements at the model -- e.g. Ecore -- level, not the view -- e.g. GMF Node -- level. 2. The model elements can be added in many different ways -- e.g. Ecoretools diagram, Ecoretools outline editor, eventually Ecore diagram editor. 3. These model elements are contained in different resources. 4. (Resources typically map to files, but we can't rely on that.) 5. There is a specific containment relationship between a model element -- e.g. EClass -- and resource -- e.g. ".ecore" file. 6. However, there is not a specific containment relationship between a specific given resource and the model component *from the users point of view*. For example, a user might open an ecorediag file and add elements without ever opening the related ecore file. 7. A diagram may reference elements from multiple resources. Theis all means that the situation is unlike say the Java context situation where ultimately there is a one to one mapping between a given element and an IFile. Now, It would seem reasonable to simply legislate that we cannonize .ecore to do this, but given 6 it's problemattic. Perhaps there is some other Context framework mechanism that would help with this, but the only solution I can think of right now is to do this: 1. Come up with some kind of weak reference style sweep and delete mechanism, where every time we remove a resource, we a) go through the list of all contained items within that resource, b) find the matching elements in the referenced ecore resources(s) and then c) go through all of the elements in each resource -- loading all of their related resources (7) -- and check to see if there is a path to that element form that resource. 2. Create a hidden special context type or use the ecore content type to legislate a logical model that is based on the ecore resource but does not point to the actual resource. We might need to do some kind of reference counting (? :O) and would still need to go through step c) above when the last element is removed. See also bug 352009 -- this was discussed at the beginning in another bug but I can't find it now. It occurs to me that Benny might have some ideas given his recent work with the logical models.
See for context bug 357768
I understand that we we can't necessarily identify a resource but if we know the resource as in this example we shouldn't the interest be propagated? Otherwise focusing in the Project Explorer won't work.
Actually, we should always be able to identify at least one unique resource, the issue is sort of the inverse. Sorry, I'm sure I'm making this issue seem even more complex than it is. Something else I should explain...we don't actually track the root package -- all EMF models have one and only one root package and that's the top-level resource package. I'm not sure if that's the issue, I'll look at your workspace and try to figure that out.
There are a bunch of interrelated issues here. I'm going to try to consolidate them into this one bug.
*** Bug 357768 has been marked as a duplicate of this bug. ***
(In reply to comment #4) > Actually, we should always be able to identify at least one unique resource, the > issue is sort of the inverse. Sorry, I'm sure I'm making this issue seem even > more complex than it is. What about models that are not resource based?
(In reply to comment #7) > What about models that are not resource based? OK, we need to be really careful about terms now. If you mean EMF Resource based, then there is no such thing. That's what makes them so attractive because every model is contained by one and only one EMF Resource with a strict URI. But that doesn't mean that the URI will look anything like a typical Eclipse resource URI.* If you mean "IResource" i.e. in the "mylyn.resource" sense, then that is a good question because there we know for sure that we'll have that case show up a lot. This is why I think it makes sense to stick with the EMF resource URI as the ultimate thing that we're propogating interest across, but it seems that we also might want / need to propagate to the (Mylyn) 'resource' type as well. Thinking about it some more, I think we actually need a different content type altogether for this, like "emf" to represent emf resources. Right now, we're using "ecore" but that's elided with an ecore model *instance*. I think there are a bunch of related issues here and that's why I'm going to try to gether them up in this one bug. *They could be for example a CDO model which is hosted on some kind of distributed system somewhere or some case that doesn't even support a hierarchical style URI, perhaps a GUID or something. Like mongo:/<db-name>/<class-based-collection-name>/<id-of-object-in-collection/ (see http://www.eclipse.org/forums/index.php/mv/msg/203479/650609/)
We need to propagate interest to workspace resources if we can determine a workspace resources (e.g. the URI points to a workspace file). Otherwise filtering in navigator views will not work reliably. This needs be covered through regression tests.
OK, so here's how all the pieces relate. For domains: (e.g. user views ecore model in project explorer, etc...) 1. Model elements have 1..1 unique handles. Model Element Type: "ecore" (or "uml2..") 2. Model elements have *..1 unique root packages. 3. Packages are model elements. Package Element Type: "ecore". (We were treating package and resource as equivalent, but I've just changed that to make them separate explicit interest elements.) 4. Root Package elements have 1..1 unique resources. Type: "ecore" perhaps should be "emfresource" 5. EMF Resources have 1..0 Workspace Resource ("platform:/resource..", IFile) For diagrams: (e.g. user opens an ecore_daig) 1. Diagram elements have 1..1 domain model elements. Model element type: "ecore" (or "uml2..") So given this, if a user selects an element in the diagram, it should a) mark the domain ("ecore") element as interesting, b) propagate up to parent package c) to parent "ecore" resource and then d) to workspace resource IFF that exists. It won't propagate to the diagram file itself but that's fine, because the only way for the user to edit the diagram is to actually have it open in an editor. This all works as outlined above. Does it seem sensible? Any ideas about how to perhaps put it under better testing? I'm having a hard time getting around the issue of actually forcing the selection from the diagram and or project explorer. I could do this with SWTBot, but we can't use that in our automated testing. I've tried simulating it by using monitor.handleWorkbenchPartSelection(editor, selection, true); but that doesn't seem to do what I want.
> So given this, if a user selects an element in the diagram, it should a) mark > the domain ("ecore") element as interesting, b) propagate up to parent package > c) to parent "ecore" resource and then d) to workspace resource IFF that exists. Sounds good to me. > It won't propagate to the diagram file itself but that's fine, because the only > way for the user to edit the diagram is to actually have it open in an editor. The diagram file is the model for the presentation, right? As long as it gets some interest through the part selections (or whatever) that should be sufficient. > This all works as outlined above. Does it seem sensible? Any ideas about how to > perhaps put it under better testing? I'm having a hard time getting around the > issue of actually forcing the selection from the diagram and or project > explorer. I could do this with SWTBot, but we can't use that in our automated > testing. I prefer not to but if it's the best approach to test the integrations we should consider it.
(In reply to comment #11) > > It won't propagate to the diagram file itself but that's fine, because the > only > > way for the user to edit the diagram is to actually have it open in an editor. > > The diagram file is the model for the presentation, right? As long as it gets > some interest through the part selections (or whatever) that should be > sufficient. Yes "model for the presentation" captures it exactly. It's possible that for some kinds of GMF models we'll actually want to capture the presentation model as well, but I can't think of any good reasons to do that with the usages I've imagined. So just to be clear, the only interest for the diagram model will come from just what the resources ui would provide absent modeling bridge. But for the user it will look exactly the same. To see what I mean, look at an open .ecore and .ecorediag file in the project explorer. It seems to me that the propogation is working correctly but there might be some context features that I'm not aware of.
I'm marking this as closed. I've got the testing much more complete now as well since I've finally figured out how to mimic diagram selections, removals and additions pretty well.