Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » how to implement IEditorInput to get a generated editor to open my generated model
how to implement IEditorInput to get a generated editor to open my generated model [message #419543] Mon, 26 May 2008 22:25 Go to next message
Eclipse UserFriend
Originally posted by: pillii.gmx.de

Hello,

i generated a model and an editor for it.
Editing files with the editor works like a charm.
But i need to edit my model when its in memory.

I am at this point:

// create a class that implements IEditorInput
class MyEditorInput implements IEditorInput
{
....
}

// start the generated editor programmatically
MyEditorInput input = new MyEditorInput(mymodel);
IWorkbenchPage.openEditor(input, "myeditorid")


My problem now is how do i need to implement IEditorInput so that when i
open the editor i dont get error messages.
How does the generated editor expects it to be? Where can i get this
information?
I dont get it...

Thank you for any hints,
Gordian
Re: how to implement IEditorInput to get a generated editor to open my generated model [message #419546 is a reply to message #419543] Mon, 26 May 2008 23:54 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33147
Registered: July 2009
Senior Member
Gordian,

Comments below.

gordian wrote:
> Hello,
>
> i generated a model and an editor for it.
> Editing files with the editor works like a charm.
> But i need to edit my model when its in memory.
>
> I am at this point:
>
> // create a class that implements IEditorInput
> class MyEditorInput implements IEditorInput
> {
> ....
> }
>
> // start the generated editor programmatically
> MyEditorInput input = new MyEditorInput(mymodel);
> IWorkbenchPage.openEditor(input, "myeditorid")
>
>
> My problem now is how do i need to implement IEditorInput so that when
> i open the editor i dont get error messages.
> How does the generated editor expects it to be? Where can i get this
> information?
EditUIUtil.getURI is called and it recognizes a lot of different
possible types of editor input. If yours isn't one of the types it
recognizes, then you might want to try using URIEditorInput and the
specialize the URIConverter so that it (a specialized URIHandler)
recognizes your URI...
> I dont get it...
What do you mean by "in memory"? You mean you have the bytes or you
already have the instance. Look closely at how the generated editor
processes the IEditorInput for clues...
>
> Thank you for any hints,
> Gordian


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: how to implement IEditorInput to get a generated editor to open my generated model [message #419550 is a reply to message #419546] Tue, 27 May 2008 09:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: pillii.gmx.de

Hello,

thank you for your answer!
To answer your question: I have my model as an instance of it in memory.
Now that i know how to implement the IEditorInput Interface, i wondered
if it is possible to generate such an EditorInput class automatically.
EMF should know everything it needs to know..
Is this possible?

Thank you again,
Gordian

Ed Merks schrieb:
> Gordian,
>
> Comments below.
>
> gordian wrote:
>> Hello,
>>
>> i generated a model and an editor for it.
>> Editing files with the editor works like a charm.
>> But i need to edit my model when its in memory.
>>
>> I am at this point:
>>
>> // create a class that implements IEditorInput
>> class MyEditorInput implements IEditorInput
>> {
>> ....
>> }
>>
>> // start the generated editor programmatically
>> MyEditorInput input = new MyEditorInput(mymodel);
>> IWorkbenchPage.openEditor(input, "myeditorid")
>>
>>
>> My problem now is how do i need to implement IEditorInput so that when
>> i open the editor i dont get error messages.
>> How does the generated editor expects it to be? Where can i get this
>> information?
> EditUIUtil.getURI is called and it recognizes a lot of different
> possible types of editor input. If yours isn't one of the types it
> recognizes, then you might want to try using URIEditorInput and the
> specialize the URIConverter so that it (a specialized URIHandler)
> recognizes your URI...
>> I dont get it...
> What do you mean by "in memory"? You mean you have the bytes or you
> already have the instance. Look closely at how the generated editor
> processes the IEditorInput for clues...
>>
>> Thank you for any hints,
>> Gordian
Re: how to implement IEditorInput to get a generated editor to open my generated model [message #419559 is a reply to message #419550] Tue, 27 May 2008 13:08 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33147
Registered: July 2009
Senior Member
Gordian,

If you already have the model, then it probably already is in a resource
in a resource set. I think you'd want the editor to be initialized
quite different in this case. It's not even clear was save will mean in
such an editor. Maybe you can paint a more complete picture of the
workflow by which an existing object needs to be opened in an editor.
Consider issues like which editing domain will be used, how does the
undo stack need to be managed, and what does save verses close without
saving imply?


gordian wrote:
> Hello,
>
> thank you for your answer!
> To answer your question: I have my model as an instance of it in memory.
> Now that i know how to implement the IEditorInput Interface, i
> wondered if it is possible to generate such an EditorInput class
> automatically.
> EMF should know everything it needs to know..
> Is this possible?
>
> Thank you again,
> Gordian
>
> Ed Merks schrieb:
>> Gordian,
>>
>> Comments below.
>>
>> gordian wrote:
>>> Hello,
>>>
>>> i generated a model and an editor for it.
>>> Editing files with the editor works like a charm.
>>> But i need to edit my model when its in memory.
>>>
>>> I am at this point:
>>>
>>> // create a class that implements IEditorInput
>>> class MyEditorInput implements IEditorInput
>>> {
>>> ....
>>> }
>>>
>>> // start the generated editor programmatically
>>> MyEditorInput input = new MyEditorInput(mymodel);
>>> IWorkbenchPage.openEditor(input, "myeditorid")
>>>
>>>
>>> My problem now is how do i need to implement IEditorInput so that
>>> when i open the editor i dont get error messages.
>>> How does the generated editor expects it to be? Where can i get this
>>> information?
>> EditUIUtil.getURI is called and it recognizes a lot of different
>> possible types of editor input. If yours isn't one of the types it
>> recognizes, then you might want to try using URIEditorInput and the
>> specialize the URIConverter so that it (a specialized URIHandler)
>> recognizes your URI...
>>> I dont get it...
>> What do you mean by "in memory"? You mean you have the bytes or you
>> already have the instance. Look closely at how the generated editor
>> processes the IEditorInput for clues...
>>>
>>> Thank you for any hints,
>>> Gordian


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: how to implement IEditorInput to get a generated editor to open my generated model [message #419560 is a reply to message #419559] Tue, 27 May 2008 14:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: pillii.gmx.de

Hello again,

i have the following situation:

Im developing an Eclipse RCP application.
One plugin is responsible for storing and loading my model into a
database. Another plugin is responsible for displaying the data.
Im using the JFace Databinding Framework for updating the model and the ui.
Now i want to open the model editor for models that i got out of the
database.
The editor shall work as if it would operate on a file. So save - and
olny save - should update the given model. Therefore the editor would
have to make a copy of my model i think.

But thats another problem..

I would be happy get the model into the editor. No matter if changes to
the model inside the editor do change the model inside the databse. Its
just for getting started.

Could you please give me a short example or point me to the right place
on how to implement such behavior?

Thank you so much,
Gordian


Ed Merks schrieb:
> Gordian,
>
> If you already have the model, then it probably already is in a resource
> in a resource set. I think you'd want the editor to be initialized
> quite different in this case. It's not even clear was save will mean in
> such an editor. Maybe you can paint a more complete picture of the
> workflow by which an existing object needs to be opened in an editor.
> Consider issues like which editing domain will be used, how does the
> undo stack need to be managed, and what does save verses close without
> saving imply?
>
>
> gordian wrote:
>> Hello,
>>
>> thank you for your answer!
>> To answer your question: I have my model as an instance of it in memory.
>> Now that i know how to implement the IEditorInput Interface, i
>> wondered if it is possible to generate such an EditorInput class
>> automatically.
>> EMF should know everything it needs to know..
>> Is this possible?
>>
>> Thank you again,
>> Gordian
>>
>> Ed Merks schrieb:
>>> Gordian,
>>>
>>> Comments below.
>>>
>>> gordian wrote:
>>>> Hello,
>>>>
>>>> i generated a model and an editor for it.
>>>> Editing files with the editor works like a charm.
>>>> But i need to edit my model when its in memory.
>>>>
>>>> I am at this point:
>>>>
>>>> // create a class that implements IEditorInput
>>>> class MyEditorInput implements IEditorInput
>>>> {
>>>> ....
>>>> }
>>>>
>>>> // start the generated editor programmatically
>>>> MyEditorInput input = new MyEditorInput(mymodel);
>>>> IWorkbenchPage.openEditor(input, "myeditorid")
>>>>
>>>>
>>>> My problem now is how do i need to implement IEditorInput so that
>>>> when i open the editor i dont get error messages.
>>>> How does the generated editor expects it to be? Where can i get this
>>>> information?
>>> EditUIUtil.getURI is called and it recognizes a lot of different
>>> possible types of editor input. If yours isn't one of the types it
>>> recognizes, then you might want to try using URIEditorInput and the
>>> specialize the URIConverter so that it (a specialized URIHandler)
>>> recognizes your URI...
>>>> I dont get it...
>>> What do you mean by "in memory"? You mean you have the bytes or you
>>> already have the instance. Look closely at how the generated editor
>>> processes the IEditorInput for clues...
>>>>
>>>> Thank you for any hints,
>>>> Gordian
Re: how to implement IEditorInput to get a generated editor to open my generated model [message #419561 is a reply to message #419560] Tue, 27 May 2008 15:10 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33147
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040108030809080007000907
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Gordian,

Comments below.

gordian wrote:
> Hello again,
>
> i have the following situation:
>
> Im developing an Eclipse RCP application.
> One plugin is responsible for storing and loading my model into a
> database. Another plugin is responsible for displaying the data.
> Im using the JFace Databinding Framework for updating the model and
> the ui.
> Now i want to open the model editor for models that i got out of the
> database.
Teneo solves this kind of problem. It even works with GMF...
> The editor shall work as if it would operate on a file. So save - and
> olny save - should update the given model. Therefore the editor would
> have to make a copy of my model i think.
>
> But thats another problem..
When you load the model, you have a local copy. Until you save it, it
shouldn't be committed. Teneo supports that...
>
> I would be happy get the model into the editor. No matter if changes
> to the model inside the editor do change the model inside the databse.
> Its just for getting started.
It seems to me you should be passing in a URI that represents the
information you need to connect to the data base and perhaps have a
specialized resource from loading and saving to the database. That's
the approach Teneo uses.
>
> Could you please give me a short example or point me to the right
> place on how to implement such behavior?
Perhaps Teneo provides the complete solution.
<http://www.eclipse.org/modeling/emft/?project=teneo>

http://www.eclipse.org/modeling/emft/?project=teneo

>
> Thank you so much,
> Gordian
>
>
> Ed Merks schrieb:
>> Gordian,
>>
>> If you already have the model, then it probably already is in a
>> resource in a resource set. I think you'd want the editor to be
>> initialized quite different in this case. It's not even clear was
>> save will mean in such an editor. Maybe you can paint a more
>> complete picture of the workflow by which an existing object needs to
>> be opened in an editor. Consider issues like which editing domain
>> will be used, how does the undo stack need to be managed, and what
>> does save verses close without saving imply?
>>
>>
>> gordian wrote:
>>> Hello,
>>>
>>> thank you for your answer!
>>> To answer your question: I have my model as an instance of it in
>>> memory.
>>> Now that i know how to implement the IEditorInput Interface, i
>>> wondered if it is possible to generate such an EditorInput class
>>> automatically.
>>> EMF should know everything it needs to know..
>>> Is this possible?
>>>
>>> Thank you again,
>>> Gordian
>>>
>>> Ed Merks schrieb:
>>>> Gordian,
>>>>
>>>> Comments below.
>>>>
>>>> gordian wrote:
>>>>> Hello,
>>>>>
>>>>> i generated a model and an editor for it.
>>>>> Editing files with the editor works like a charm.
>>>>> But i need to edit my model when its in memory.
>>>>>
>>>>> I am at this point:
>>>>>
>>>>> // create a class that implements IEditorInput
>>>>> class MyEditorInput implements IEditorInput
>>>>> {
>>>>> ....
>>>>> }
>>>>>
>>>>> // start the generated editor programmatically
>>>>> MyEditorInput input = new MyEditorInput(mymodel);
>>>>> IWorkbenchPage.openEditor(input, "myeditorid")
>>>>>
>>>>>
>>>>> My problem now is how do i need to implement IEditorInput so that
>>>>> when i open the editor i dont get error messages.
>>>>> How does the generated editor expects it to be? Where can i get
>>>>> this information?
>>>> EditUIUtil.getURI is called and it recognizes a lot of different
>>>> possible types of editor input. If yours isn't one of the types it
>>>> recognizes, then you might want to try using URIEditorInput and the
>>>> specialize the URIConverter so that it (a specialized URIHandler)
>>>> recognizes your URI...
>>>>> I dont get it...
>>>> What do you mean by "in memory"? You mean you have the bytes or
>>>> you already have the instance. Look closely at how the generated
>>>> editor processes the IEditorInput for clues...
>>>>>
>>>>> Thank you for any hints,
>>>>> Gordian


--------------040108030809080007000907
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Gordian,<br>
<br>
Comments below.<br>
<br>
gordian wrote:
<blockquote cite="mid:g1h6cg$h7q$1@build.eclipse.org" type="cite">Hello
again,
<br>
<br>
i have the following situation:
<br>
<br>
Im developing an Eclipse RCP application.
<br>
One plugin is responsible for storing and loading my model into a
database. Another plugin is responsible for displaying the data.
<br>
Im using the JFace Databinding Framework for updating the model and the
ui.
<br>
Now i want to open the model editor for models that i got out of the
database.
<br>
</blockquote>
Teneo solves this kind of problem.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:ContentProvider problem
Next Topic:Improved String Attribute Editor
Goto Forum:
  


Current Time: Mon May 13 13:50:22 GMT 2024

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

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

Back to the top