Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Use PartDescriptor to create an input part
icon3.gif  Use PartDescriptor to create an input part [message #1097228] Thu, 29 August 2013 12:08 Go to next message
Sebastien Pennec is currently offline Sebastien Pennec
Messages: 22
Registered: April 2013
Location: Switzerland
Junior Member
Hi,

I've been looking at the PartServiceImpl and it seems like one can use PartDescriptor in the e4xmi only to create MPart instances, and not MInputPart.

Is there a way to use PartDescriptors to create MInputPart templates?

Thanks a lot!

S├ębastien
Re: Use PartDescriptor to create an input part [message #1097267 is a reply to message #1097228] Thu, 29 August 2013 13:16 Go to previous messageGo to next message
Andrzej Szczepanski is currently offline Andrzej Szczepanski
Messages: 16
Registered: May 2013
Junior Member
I don't know of any.
It seems to me that MInputPart (at least for now) has very limited functionality. All it manages to achieve, is to confuse users and make them think that MPart, MInputPart are the new ViewPart, EditorPart.

One idea is to give up MInputPart in your application and just use MPart. It can be saved and have dirtyable property just as MInputPart. Instead of MInputPart::getInputUri():String you can use persisted state
(MPart::getPersistedState() returns a map).

Second idea is to just create it manually like that:
 MInputPart editor = MBasicFactory.INSTANCE.createInputPart();
 editor.setContributionURI(...);
 editor.setCloseable(true);
 URI inputURI = URI.createFileURI(...);
 editor.setLabel(...);
 editor.setInputURI(...);
 editor.setIconURI(...);
 /* add new editor to editor stack */
 MPartStack partStack = (MPartStack) modelService.find(
                editorStackID, application);
 partStack.getChildren().add(editor);
 partService.activate(editor, true);


You can probably use model service to read needed labels and URI's from some kind of snippet, so you would still be able to keep this information in application model.
Re: Use PartDescriptor to create an input part [message #1097798 is a reply to message #1097267] Fri, 30 August 2013 07:01 Go to previous messageGo to next message
Sebastien Pennec is currently offline Sebastien Pennec
Messages: 22
Registered: April 2013
Location: Switzerland
Junior Member
Thanks for the answer, I'll look into that! Smile
Re: Use PartDescriptor to create an input part [message #1108365 is a reply to message #1097798] Fri, 13 September 2013 19:03 Go to previous message
Eric Moffatt is currently offline Eric Moffatt
Messages: 118
Registered: July 2009
Senior Member

We're in the process of deprecating MInputPart so using MPart is the correct approach. We're looking into providing an MEditorDescriptor in Luna to cover off the logic required to map inputs onto the correct editor implementation.
Previous Topic:e4 how to contribute to the workbench main menu and toolbar.
Next Topic:Support for Sharing State Objects across Editors?
Goto Forum:
  


Current Time: Sun Oct 26 02:06:51 GMT 2014

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

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