dynamic EditorInput [message #299367] |
Wed, 15 February 2006 12:36  |
Eclipse User |
|
|
|
Originally posted by: jgreen.upb.de
Hi everyone,
I seek for a solution in following scenario:
I have a hierarchic model (which is emf, but the following is rather a
workbench question) where the root model is typically opened by the main
editor and maintained there. Now, other editors may edit particular
submodels of this model which are stored in separate files.
mainmodel1.model
- submodel1.model
- submodel2.model
- submodel3.model
Now, loading these sub-models would cause to resolve the main model they
depend on as a new model instance from the file. But, I would like to
provide the previously loaded instance by the main editor.
There could also be a scenario where the main editor did not yet open
the main model, but sub-model editors open the different models
submodel1, submodel2, ... All these editors should also be able to work
on a sub-model referencing the same main model instance.
As I see it, I need to maintain the main model at a higher level. Then,
I also would like to keep the any EditorParts' init()-method as simple
as possible. Most convenient would be to assemble an EditorInput
somewhere that has the maintained, single instantiated main model
attached to it.
What would be the best way to do this? Are there any eclipse-mechanisms
supporting this? Any similar experience? Problems doing so?
Thanks for helping!
Joel
|
|
|
Re: dynamic EditorInput [message #299412 is a reply to message #299367] |
Thu, 16 February 2006 09:54  |
Eclipse User |
|
|
|
Your IEditorInput should contain something that identifies the model (or
submodel). Then your editor should go to some ModelProvider, and ask it
to get you the model that you need.
That way if your IEditorInput references a submodel, when you ask the
ModelProvider it will correctly open the main model and provide back the
submodel.
There is a similar pattern with a normal file editor input, IDocument,
and IDocumentProvider.
Later,
PW
|
|
|
Powered by
FUDForum. Page generated in 0.26843 seconds