Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » How to fill Part with Data?(How can relize the functionality of editor and editorinput in 3.x?)
How to fill Part with Data? [message #957723] Thu, 25 October 2012 12:48 Go to next message
David Reichl is currently offline David ReichlFriend
Messages: 9
Registered: September 2012
Junior Member
Hi!

My goal is: With a doubleclick in a selected Item in a Table (Example: a name of a person in a list), a new Part should open (which shows me the details of the person).

What I've done till now: Use SelectionService when I hit doubleclick. Then using the Command- and HandlerService to open my Handler. In this handler I use a PartDescriptor to make a new Part, use the SelectionService to get the Selection of the part where i selected it, and finally I use the PartService to show the part.

So far so good (or do you think there a better way to do this?).

My Problem: How can I get the data of the selected item to fill the part-fields (name, address etc)? Should I use a InputPart to set the Uri (part.setInputUri)? What is that Uri and where should it point?

All-in-All: How can relize the functionality of editor and editorinput in 3.x?

Thank you!
Re: How to fill Part with Data? [message #958945 is a reply to message #957723] Fri, 26 October 2012 10:39 Go to previous messageGo to next message
Eclipse UserFriend
I use the inputURI approach in my apps. The URI can be anything that you like: the workbench doesn't check for conformance. So you could use "x-myapp:DB-UUID" if the data can be pulled from a database, a "data:" URI with base64-encoded serialized details, 'file:" if an on-disk file, etc.
Re: How to fill Part with Data? [message #958956 is a reply to message #958945] Fri, 26 October 2012 10:45 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Well it depends on your model I guess. Do you have the object itself in the table? Then you might want to use the SelectionService and inject your object into your part via @Active annotation into your part. Then you can put your data into the part elements like you did in an Eclipse 3.x app. If you have to load your data after double click, maybe the solution posted by Brian is more appropriate for your case.
Re: How to fill Part with Data? [message #959399 is a reply to message #958956] Fri, 26 October 2012 17:37 Go to previous messageGo to next message
David Reichl is currently offline David ReichlFriend
Messages: 9
Registered: September 2012
Junior Member
thanks! yes I have the object itself in the table.
now I do it like this: use the SelectionsService in the handler to get the Selection and use the part.setObject(inputobject) methode. in the part use "@Active MPart activePart" and then I get the object via "activePart.getObject()"
what do you think about that?

I actually didn't get what do do so I could do it like "@Active SomeObject object".?
Re: How to fill Part with Data? [message #959452 is a reply to message #959399] Fri, 26 October 2012 18:30 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Have a look at the tutorials from Lars Vogel or Jonas Helming on selection service. You set the object that is selected to the selection service and implement a method in your second part that injects the active selection with @Named (IServiceConstants.ACTIVE_SELECTION) @Optional Object yourObject

Sorry for pointing into the wrong direction with @Active, I mixed them up by mistake
Re: How to fill Part with Data? [message #959577 is a reply to message #959452] Fri, 26 October 2012 20:45 Go to previous message
David Reichl is currently offline David ReichlFriend
Messages: 9
Registered: September 2012
Junior Member
now I got it.
I missed that in the tutorial.

I finally set the hole IStructuredSelection-Object and use a Handler (where i use the @Named (ISer...)@Optionale...) as recommaneded) to open the part. Here I define to open more parts if have selected more Items in my Table. In the Handler I use the same procedure (setSelection...) and in the opened part I Inject the Object via @Named ...

I thinks that works fine.

Thanks for the help!
Previous Topic:Events to Parts without Focus
Next Topic:Tootip for a TreeViewer
Goto Forum:
  


Current Time: Thu Apr 25 11:18:19 GMT 2024

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

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

Back to the top