Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » EditorPart, IEditorInput and domain/model objects
EditorPart, IEditorInput and domain/model objects [message #453416] Fri, 28 July 2006 19:40 Go to next message
Derrick Kittler is currently offline Derrick KittlerFriend
Messages: 5
Registered: July 2009
Junior Member
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?
Re: EditorPart, IEditorInput and domain/model objects [message #453418 is a reply to message #453416] Sat, 29 July 2006 08:24 Go to previous messageGo to next message
Alexander Karnstedt is currently offline Alexander KarnstedtFriend
Messages: 68
Registered: July 2009
Member
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?
>
Re: EditorPart, IEditorInput and domain/model objects [message #453433 is a reply to message #453416] Mon, 31 July 2006 13:07 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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


Re: EditorPart, IEditorInput and domain/model objects [message #453489 is a reply to message #453418] Mon, 31 July 2006 20:44 Go to previous messageGo to next message
Derrick Kittler is currently offline Derrick KittlerFriend
Messages: 5
Registered: July 2009
Junior Member
Guys, thanks for the replies. Alex, I ended up going with the Data Binding
solution as it aligned well with what I was working to implement. Again,
thank you for your help.

Best
-Derrick
Re: EditorPart, IEditorInput and domain/model objects [message #453507 is a reply to message #453418] Tue, 01 August 2006 12:47 Go to previous messageGo to next message
Eclipse UserFriend
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."
Re: EditorPart, IEditorInput and domain/model objects [message #453551 is a reply to message #453507] Wed, 02 August 2006 13:53 Go to previous messageGo to next message
Derrick Kittler is currently offline Derrick KittlerFriend
Messages: 5
Registered: July 2009
Junior Member
Where is there *solid* information on the JFace Data Binding Project? I am
using it but am finding (in the source code headers) statements like ....

* <strong>EXPERIMENTAL</strong>. This class or interface has been added as
* part of a work in progress. There is no guarantee that this API will
remain
* unchanged during the 3.2 release cycle. Please do not use this API
without
* consulting with the Platform/UI team.

I need to use a validator in the BindSpec object but it appears there is
no sure fire way to know if the API is stable enough to add this
functionality. Is there a JFace Data Binding site that shows activity, has
a forum/message board?

Thanks.
Re: EditorPart, IEditorInput and domain/model objects [message #453553 is a reply to message #453551] Wed, 02 August 2006 14:26 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Derrick Kittler wrote:
>
> I need to use a validator in the BindSpec object but it appears there is
> no sure fire way to know if the API is stable enough to add this
> functionality. Is there a JFace Data Binding site that shows activity,
> has a forum/message board?

The URL specified in the last message is the place to start.
http://wiki.eclipse.org/index.php/JFace_Data_Binding

Check under the "Learning more..." header. There's a big note about how
stable it is :-)

If you'd like to contribute, there resources, and you can open bugs with
specific questions or feedback.

Later,
PW


Re: EditorPart, IEditorInput and domain/model objects [message #453557 is a reply to message #453553] Wed, 02 August 2006 14:52 Go to previous message
Derrick Kittler is currently offline Derrick KittlerFriend
Messages: 5
Registered: July 2009
Junior Member
Thanks Paul ... I have been all over that URL including pulling the SRC
from CVS. I was just hoping for more.

I will heed the fair warning from within the headers and for sure will
help out in any way I can.
-Derrick
Previous Topic:Integration with GEF and RCP actions
Next Topic:Third party jars needing java.class.path in RCP application
Goto Forum:
  


Current Time: Thu Oct 10 11:11:56 GMT 2024

Powered by FUDForum. Page generated in 0.04307 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top