|
|
Re: EditorPart, IEditorInput and domain/model objects [message #453433 is a reply to message #453416] |
Mon, 31 July 2006 13:07 |
|
Derrick Kittler wrote:
> I am bulding an editor (class extends EditorPart) which has an
> associated IEditorInput that provides model data (a domain object) to my
> editor. this model data is shown as the text values within my editor
> Text objects. When my editor becomes dirty and the doSave() method is
> called I want to save my newly modified model/domain object but there is
> no clear way to tie the text values of the Text objects to the domain
> object through the IEditorInput object. What is the best way to get text
> data(value) from a Text widget and set it that data into a domain object
> before saving? I would hope I don't have to write a mapping of the Text
> inputs (widgets) to my domain object.
Right, you want to look at a way to turn your IEditorInput into your
domain model.
Check out IDocument/IDocumentProvider ... in the TextEditor, the
IEditorInput is given to the IDocumentProvider, which returns the
IDocument (the data model) for the editor to work with.
There is a documentProvider extension point as well.
Later,
PW
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
|
|
|
|
Re: EditorPart, IEditorInput and domain/model objects [message #453507 is a reply to message #453418] |
Tue, 01 August 2006 12:47 |
Eclipse User |
|
|
|
Originally posted by: lamont_gilbert.rigidsoftware.com
Alexander Karnstedt wrote:
> Maybe the JFace Data Binding Framework is an option?
>
> http://wiki.eclipse.org/index.php/JFace_Data_Binding
>
> I think IEditorInput should not contain any model data. The API
> documentation for IEditorInput states:
>
> "Please note that it is important that the editor input be light weight.
> Within the workbench, the navigation history tends to hold on to editor
> inputs as a means of reconstructing the editor at a later time. The
> navigation history can hold on to quite a few inputs (i.e., the default
> is fifty). The actual data model should probably not be held in the
> input."
>
>
> Regards,
> Alex
>
> Derrick Kittler schrieb:
>> I am bulding an editor (class extends EditorPart) which has an
>> associated IEditorInput that provides model data (a domain object) to my
>> editor. this model data is shown as the text values within my editor
>> Text objects. When my editor becomes dirty and the doSave() method is
>> called I want to save my newly modified model/domain object but there is
>> no clear way to tie the text values of the Text objects to the domain
>> object through the IEditorInput object. What is the best way to get text
>> data(value) from a Text widget and set it that data into a domain object
>> before saving? I would hope I don't have to write a mapping of the Text
>> inputs (widgets) to my domain object.
>>
>> Thoughts?
>>
In my case the IEditorInput holds a weakReference to my model. Its true
that the architecture will hold on to the IEditorInputs. I think the
recently opened file list is one place.
--
Respectfully,
CL Gilbert
"Verily, verily, I say unto you, He that entereth not by the door() into the
sheepfold{}, but climbeth up some other *way, the same is a thief and a
robber."
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04307 seconds