Obtain JFace Viewer selection within a wizard [message #462451] |
Mon, 29 January 2007 17:34 |
Eclipse User |
|
|
|
Originally posted by: newsgroup.weyands.net
Hello Newsgroup,
i'm working on a little Plugin. The Data is presented with a TreeViewer.
To add new Objects to my tree im working on a wizard right now, but
could not figure out how i can get the item that's selected when i fire
my action (item -> contextMenu -> wizardaction).
The ISelectionListener seems to be for View-View interaction only - any
hint on how i can obtain the selectedObject in my wizard?
Any Help is appreciated!
-Chris
|
|
|
|
Re: Obtain JFace Viewer selection within a wizard [message #462466 is a reply to message #462460] |
Mon, 29 January 2007 19:14 |
Eclipse User |
|
|
|
Originally posted by: newsgroup.weyands.net
Snjezana Peco schrieb:
> Use the Viewer.addSelectionChangedListener(ISelectionChangedListener
> listener) method.
> You can get the selected item by using getSelection()
>
> Snjeza
>
Thanks for your reply Snjeza,
the SelectionChangedListener is added to my view. But i can't figure out
how to access this information within my Wizard class.
I've added the following lines to my createPartControl Method of my viewer:
treeViewer.addSelectionChangedListener(new ISelectionChangedListener () {
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection)
event.getSelection();
}
});
getViewSite().setSelectionProvider(treeViewer);
But i got no direct access to my viewer within the wizard to add the
SelectionChangedListener to this class..
Greetings
-chris
> Christian Weyand wrote:
>> Hello Newsgroup,
>>
>> i'm working on a little Plugin. The Data is presented with a
>> TreeViewer. To add new Objects to my tree im working on a wizard
>> right now, but could not figure out how i can get the item that's
>> selected when i fire my action (item -> contextMenu -> wizardaction).
>>
>> The ISelectionListener seems to be for View-View interaction only -
>> any hint on how i can obtain the selectedObject in my wizard?
>>
>> Any Help is appreciated!
>>
>> -Chris
|
|
|
|
|
Re: Obtain JFace Viewer selection within a wizard [message #462619 is a reply to message #462544] |
Wed, 31 January 2007 03:38 |
Eclipse User |
|
|
|
Originally posted by: partyhut.internode.on.net
Hi Daniel,
I had the same question few days ago with my SWT + Jface app(not RCP).
How exactly to forwards the seleciton change event to a listener? Can
the listener be the parent composite or the parent's parent?
Thank you!
HS
Daniel Krügler wrote:
> Christian Weyand wrote:
>> Snjezana Peco schrieb:
>>
>>> Use the Viewer.addSelectionChangedListener(ISelectionChangedListener
>>> listener) method.
>>> You can get the selected item by using getSelection()
>>>
>>> Snjeza
>>>
>>
>> Thanks for your reply Snjeza,
>>
>> the SelectionChangedListener is added to my view. But i can't figure
>> out how to access this information within my Wizard class.
>>
>> I've added the following lines to my createPartControl Method of my
>> viewer:
>>
>> treeViewer.addSelectionChangedListener(new ISelectionChangedListener () {
>> public void selectionChanged(SelectionChangedEvent event) {
>> IStructuredSelection selection =
>> (IStructuredSelection) event.getSelection();
>> }
>> });
>>
>> getViewSite().setSelectionProvider(treeViewer);
>>
>> But i got no direct access to my viewer within the wizard to add the
>> SelectionChangedListener to this class..
>
> First: Don't forget to register your view as selection provider
> Second: You have a basic design problem not related to your IDE and
> programming language. One solution for this would be that your
> view forwards the selection change event to interested listeners (e.g.
> your wizard).
>
> Greetings from Bremen,
>
> Daniel Krügler
|
|
|
Powered by
FUDForum. Page generated in 0.04674 seconds