XWT + TableViewer + Retrieve Table Data [message #502600] |
Tue, 08 December 2009 21:15  |
Eclipse User |
|
|
|
Have used XWT.open to show a Collection in a TableViewer.
When the user clicks on a menu item, I need to have access to the data to persist.
What is the best way to achieve this ?
Thanks
- Walter.
|
|
|
|
|
|
Re: XWT + TableViewer + Retrieve Table Data [message #505153 is a reply to message #504021] |
Sun, 27 December 2009 23:38  |
Eclipse User |
|
|
|
Thanks a lot. This solved my problem.
-Walter
"Brian de Alwis" <bsd@acm.org> wrote in message
news:hgbg50$2nb$1@build.eclipse.org...
> Hi Walter. From one e4 newbie to another...
>
> Walter Prabhakar wrote:
>> I have following questions
>> 1) how can I get a context in the stand alone program.
>
> You can create a context: see
> org.eclipse.e4.core.services.context.EclipseContextFactory.
>
>
>> 2) in case of eclipse product I have IEclipseContext but when an menu is
>> clicked then a "Handler class" is called which has a method
>> public void execute(IWorkbench workbench) {
>> System.out.println ( "Save Invoked") ;
>> }
>> I am unable to find a way to get the IEclipseContext object thru
>> IWorkbench object.
> e4 uses injection and dynamic method calling. It has a set of known
> methods that it looks for (e.g., a method called "execute") and then
> examines its signature to provide the requested values. So if you want
> the IEclipseContext, then you simply ask for it :-)
>
> @Inject
> public void execute(IEclipseContext context,
> IWorkbench workbench) {
> System.out.println(...);
> }
>
>
> With e4 1.0M2, you have to annotate the methods with @Inject for e4 to
> consider them. You can also annotate them with @Optional (will be set to
> null if not available), and others. See the org.eclipse.e4.demo.contacts
> for examples.
>
> Brian.
|
|
|
Re: XWT + TableViewer + Retrieve Table Data [message #565685 is a reply to message #502631] |
Wed, 09 December 2009 09:34  |
Eclipse User |
|
|
|
I have following questions
1) how can I get a context in the stand alone program.
2) in case of eclipse product I have IEclipseContext but when an menu is
clicked then a "Handler class" is called which has a method
public void execute(IWorkbench workbench) {
System.out.println ( "Save Invoked") ;
}
I am unable to find a way to get the IEclipseContext object thru
IWorkbench object.
Thanks
-Walter
"Yves YANG" <yves.yang@soyatec.com> wrote in message
news:hfno4k$k8g$1@build.eclipse.org...
> You can give a name to the TableViewer, and use
> XWT.findElementByName(context, "<name>") and then you can get the
> collection by calling getInput().
>
> Best regards
> Yves YANG
> "Walter" <kwchess@gmail.com> wrote in message
> news:hfn181$8sp$1@build.eclipse.org...
>> Have used XWT.open to show a Collection in a TableViewer.
>> When the user clicks on a menu item, I need to have access to the data to
>> persist.
>> What is the best way to achieve this ?
>>
>> Thanks
>> - Walter.
>>
>
>
|
|
|
Re: XWT + TableViewer + Retrieve Table Data [message #566170 is a reply to message #502724] |
Wed, 16 December 2009 15:32  |
Eclipse User |
|
|
|
Hi Walter. From one e4 newbie to another...
Walter Prabhakar wrote:
> I have following questions
> 1) how can I get a context in the stand alone program.
You can create a context: see
org.eclipse.e4.core.services.context.EclipseContextFactory.
> 2) in case of eclipse product I have IEclipseContext but when an menu
> is clicked then a "Handler class" is called which has a method
> public void execute(IWorkbench workbench) {
> System.out.println ( "Save Invoked") ;
> }
> I am unable to find a way to get the IEclipseContext object thru
> IWorkbench object.
e4 uses injection and dynamic method calling. It has a set of known
methods that it looks for (e.g., a method called "execute") and then
examines its signature to provide the requested values. So if you want
the IEclipseContext, then you simply ask for it :-)
@Inject
public void execute(IEclipseContext context,
IWorkbench workbench) {
System.out.println(...);
}
With e4 1.0M2, you have to annotate the methods with @Inject for e4 to
consider them. You can also annotate them with @Optional (will be set
to null if not available), and others. See the
org.eclipse.e4.demo.contacts for examples.
Brian.
|
|
|
Re: XWT + TableViewer + Retrieve Table Data [message #566722 is a reply to message #566170] |
Sun, 27 December 2009 23:38  |
Eclipse User |
|
|
|
Thanks a lot. This solved my problem.
-Walter
"Brian de Alwis" <bsd@acm.org> wrote in message
news:hgbg50$2nb$1@build.eclipse.org...
> Hi Walter. From one e4 newbie to another...
>
> Walter Prabhakar wrote:
>> I have following questions
>> 1) how can I get a context in the stand alone program.
>
> You can create a context: see
> org.eclipse.e4.core.services.context.EclipseContextFactory.
>
>
>> 2) in case of eclipse product I have IEclipseContext but when an menu is
>> clicked then a "Handler class" is called which has a method
>> public void execute(IWorkbench workbench) {
>> System.out.println ( "Save Invoked") ;
>> }
>> I am unable to find a way to get the IEclipseContext object thru
>> IWorkbench object.
> e4 uses injection and dynamic method calling. It has a set of known
> methods that it looks for (e.g., a method called "execute") and then
> examines its signature to provide the requested values. So if you want
> the IEclipseContext, then you simply ask for it :-)
>
> @Inject
> public void execute(IEclipseContext context,
> IWorkbench workbench) {
> System.out.println(...);
> }
>
>
> With e4 1.0M2, you have to annotate the methods with @Inject for e4 to
> consider them. You can also annotate them with @Optional (will be set to
> null if not available), and others. See the org.eclipse.e4.demo.contacts
> for examples.
>
> Brian.
|
|
|
Powered by
FUDForum. Page generated in 0.04307 seconds