| Feature request [message #905220] |
Wed, 29 August 2012 20:16  |
Rushan Gilmullin Messages: 61 Registered: June 2011 |
Member |
|
|
E4 contains cool concept - MPartDescriptor. It allow to describe the parts one time and in one place, without runtime-configuring code. But the advantages that give this concept is not realized in full.
Carefully 3 month before Juno relise I begin work on my Eclipse Workbench equivelent (UWorkbench). I didn't know e4, I have know about it only after Juno relise. Now this project utilized, becouse it is not needed when e4 is coming. I have mentioned it becouse want to say how working with content was implemented in UWorkbench.
First, I want to say, that the UWorkbench model is very, very similar to e4 (despite the fact that I did not know about e4 when develop it). It contains shared elements and it contains MPartDescriptor equivalent. It's called ComponentType, which is template for one type components. And there are yet one model element - ContentType. This element contains two things:
1. reference to concrete ComponentType (MPartDescriptor in e4 case)
2. content filter - the custom rule that takes the content descriptor (Input URI in e4 case) and return true if the given content descriptor relates to this ContentType and false otherwise.
So, using the ContentType we bind the concrete content (definging by content descriptor) to concrete ComponentType. In other words, it analog to file assotiation in OS with difference only that the content descriptor is more generic and abstract concept then file. Now, we can do things such:
1. Open the given content in appropriate editor.
2. Implement Open With command
3. Check when opening givent content - is there this content was opened in given editor and if was opened, then simple switch to it without opening the new instance of MPart.
We only do:
partSerice.openContent("some_content_uri")
to open the "some_content_uri" by default editor (that set in ContentType of this content)
Or:
partSerice.openContent("some_content_uri", partDescriptor)
to open the "some_content_uri" with the given partDescriptor.
If the "some_content_uri" is ipened already in partDescriptor, the method simple activate the part, containing "some_content_uri". Else it will create the new instance of part and load to it the "some_content_uri".
This feature can be implement in different way. Not necessary do as in UWorkbench - by defining the ContentType object. It is possible forexample to provide interface that map the input uri to MPartDescriptor:
interface ContentAssociation {
MPartDescriptor getDescriptor(String inputURI);
}
and then
partSerice.setContentAssociation(contentAssociation);
[Updated on: Wed, 29 August 2012 20:18] Report message to a moderator
|
|
|