Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Editor behavior
Editor behavior [message #1070587] Thu, 18 July 2013 05:09 Go to next message
Cedric Moonen is currently offline Cedric Moonen
Messages: 269
Registered: August 2009
Senior Member
Hello,

I have an old eclipse 3.x application that I'm trying to move to e4, in order to have an idea of what is possible with e4.

I would like to be able to open an editor which is based on a part descriptor in my application model. Unfortunately, the part service only offers a createPart method and no createInputPart. Of course, I could simply copy/paste the existing code but I was wondering if this shouldn't be in available in the part service, since it seems to be quite a common scenario. Should I open a bug for that ?

I would also like to pass my own object as input to my editor. I'm not working with URIs since the object is already available in my application (it is similar as what is described here).
So, I was thinking of pushing my object in the part context but unfortunately, the context is only available once the part has been created (it is created in the showPart method of the part service). At that time it is too late to put my object in the context, since the part has already been created.
Is there a way to put my input object in the part context before it gets created ?

Thank you
Re: Editor behavior [message #1072426 is a reply to message #1070587] Mon, 22 July 2013 14:36 Go to previous messageGo to next message
Eric Moffatt is currently offline Eric Moffatt
Messages: 118
Registered: July 2009
Senior Member

There is no need to use MInputPart in order to have an 'editor'; in fact the 3.x compatibility layer doesn't use it. All Parts inherit MDirtyable, meaning that they can be
marked as dirty and already participate in the prompts on shutdown...

If you need to store information about the 'file' being edited...consider using the part's 'persistedState' map.
Re: Editor behavior [message #1073111 is a reply to message #1072426] Wed, 24 July 2013 02:58 Go to previous message
Cedric Moonen is currently offline Cedric Moonen
Messages: 269
Registered: August 2009
Senior Member
Thanks for the reply.

Quote:
There is no need to use MInputPart in order to have an 'editor'; in fact the 3.x compatibility layer doesn't use it. All Parts inherit MDirtyable, meaning that they can be
marked as dirty and already participate in the prompts on shutdown...


Ok, what is the purpose of the MInputPart then ? I thought it is to be used for parts that should receive input (like an editor-like behavior), and that's also what is described in this tutorial: http://www.vogella.com/articles/Eclipse4Editor/article.html

Quote:
If you need to store information about the 'file' being edited...consider using the part's 'persistedState' map.


Sorry, I don't really understand this. Isn't the persistedState used to persist the current state of the part, so that when it is re-opened later, it would be displayed in the same state as it was left ?
What I want to achieve is passing my own object to the part, so that it is available in the @PostInitialize method. I could of course create my own set method and create the contents of my part in there, after the input has been set, but I don't really like that idea...
Previous Topic:ClearPersistedState in code
Next Topic:Command Handler is not called since Kepler
Goto Forum:
  


Current Time: Thu Aug 21 10:14:38 EDT 2014

Powered by FUDForum. Page generated in 0.01852 seconds