Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » getting the shell in SelectionAdapter while in a wizard
getting the shell in SelectionAdapter while in a wizard [message #451027] Mon, 21 February 2005 19:24 Go to next message
Duncan Krebs is currently offline Duncan KrebsFriend
Messages: 79
Registered: July 2009
Member
Hi,
I'm new to SWT and am stuck on this one. I have a button in a jface wizard
that when clicked I want to display a directory selection dialog. However
inside my widgetSeleceted method on the default SelectionAdapter I can't
figure out how to get the shell that I need to pass to the the New Dialog
constructor.

I tried getting first the control from e.item and then the shell from the
control but its giving me a null pointer exception. I suppose I could also
implement my own SelectionAdapter but I'm thinking there has to be an
easier way. Thanks. - dkrebs
Re: getting the shell in SelectionAdapter while in a wizard [message #451029 is a reply to message #451027] Mon, 21 February 2005 22:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tranjim.hotmail.com

have you tried Display.getCurrent().getActiveShell()?

"Duncan Krebs" <duncan@krebsnet.com> wrote in message
news:cvdch6$23m$1@www.eclipse.org...
> Hi,
> I'm new to SWT and am stuck on this one. I have a button in a jface wizard
> that when clicked I want to display a directory selection dialog. However
> inside my widgetSeleceted method on the default SelectionAdapter I can't
> figure out how to get the shell that I need to pass to the the New Dialog
> constructor.
> I tried getting first the control from e.item and then the shell from the
> control but its giving me a null pointer exception. I suppose I could also
> implement my own SelectionAdapter but I'm thinking there has to be an
> easier way. Thanks. - dkrebs
>
>
Re: getting the shell in SelectionAdapter while in a wizard [message #451031 is a reply to message #451027] Tue, 22 February 2005 05:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

Duncan Krebs wrote:
> Hi,
> I'm new to SWT and am stuck on this one. I have a button in a jface
> wizard that when clicked I want to display a directory selection dialog.
> However inside my widgetSeleceted method on the default SelectionAdapter
> I can't figure out how to get the shell that I need to pass to the the
> New Dialog constructor.
> I tried getting first the control from e.item and then the shell from
> the control but its giving me a null pointer exception. I suppose I
> could also implement my own SelectionAdapter but I'm thinking there has
> to be an easier way. Thanks. - dkrebs
>
>

usually when i create wizard i pass the workbenchwindow into it.

CL
Re: getting the shell in SelectionAdapter while in a wizard [message #451072 is a reply to message #451029] Tue, 22 February 2005 16:37 Go to previous messageGo to next message
Duncan Krebs is currently offline Duncan KrebsFriend
Messages: 79
Registered: July 2009
Member
Jim:
Thanks for the tip, I got that to work okay. Now I'm wondering how I can
retrieve the value of a text box in the dialog when it returns to the main
window. For example, with the tip you just showed me I now have a dialog
with a browse button that when clicked it lets the user select a folder
and the value is set in the text box next to the browse button. Then when
they click okay I need to get that value of the text box in the code that
opened the dialog window. Seems pretty simple, but I can't figure it out.
Thanks for taking pitty.


Jim Tran wrote:

> have you tried Display.getCurrent().getActiveShell()?

> "Duncan Krebs" <duncan@krebsnet.com> wrote in message
> news:cvdch6$23m$1@www.eclipse.org...
>> Hi,
>> I'm new to SWT and am stuck on this one. I have a button in a jface wizard
>> that when clicked I want to display a directory selection dialog. However
>> inside my widgetSeleceted method on the default SelectionAdapter I can't
>> figure out how to get the shell that I need to pass to the the New Dialog
>> constructor.
>> I tried getting first the control from e.item and then the shell from the
>> control but its giving me a null pointer exception. I suppose I could also
>> implement my own SelectionAdapter but I'm thinking there has to be an
>> easier way. Thanks. - dkrebs
>>
>>
Re: getting the shell in SelectionAdapter while in a wizard [message #451114 is a reply to message #451072] Wed, 23 February 2005 14:09 Go to previous message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

I think a wizard should handle its own business and not return any data
to be processed by some other methods. That is what I have done.
Otherwise you need, upon pushing finish or whatever, copy all your
values from your text box into local variables. Then add a method that
returns that local variable to your dialog/wizard class. I think that
is the best way.

CL



Duncan Krebs wrote:
> Jim:
> Thanks for the tip, I got that to work okay. Now I'm wondering how I can
> retrieve the value of a text box in the dialog when it returns to the
> main window. For example, with the tip you just showed me I now have a
> dialog with a browse button that when clicked it lets the user select a
> folder and the value is set in the text box next to the browse button.
> Then when they click okay I need to get that value of the text box in
> the code that opened the dialog window. Seems pretty simple, but I can't
> figure it out. Thanks for taking pitty.
>
> Jim Tran wrote:
>
>> have you tried Display.getCurrent().getActiveShell()?
>
>
>> "Duncan Krebs" <duncan@krebsnet.com> wrote in message
>> news:cvdch6$23m$1@www.eclipse.org...
>>
>>> Hi,
>>> I'm new to SWT and am stuck on this one. I have a button in a jface
>>> wizard that when clicked I want to display a directory selection
>>> dialog. However inside my widgetSeleceted method on the default
>>> SelectionAdapter I can't figure out how to get the shell that I need
>>> to pass to the the New Dialog constructor.
>>> I tried getting first the control from e.item and then the shell from
>>> the control but its giving me a null pointer exception. I suppose I
>>> could also implement my own SelectionAdapter but I'm thinking there
>>> has to be an easier way. Thanks. - dkrebs
>>>
>>>
>
>
Previous Topic:change size of a component at runtime
Next Topic:Swing JDialogs and SWT_AWT.new_Frame()
Goto Forum:
  


Current Time: Thu Apr 25 22:39:36 GMT 2024

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

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

Back to the top