Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Initializing a dialog?
Initializing a dialog? [message #447279] Mon, 13 December 2004 07:00 Go to next message
Eclipse UserFriend
Originally posted by: manish.garg.gmail.com

Hi,

I have case where I want to open a dialog and set some data in the text
fields.
My calls looks like the following.:

1. MyDialog dlg= new MyDialog (...);
2. dlg.initializeValues();
3, dlg.open();

I initialize the value through the method initializeValues on line 2.
However, the textbox which gets calls setEnabledOK() in the modifyListener
and at this point I get a nullPointerException. The setEnabledOK cannot be
called before dlg.open(). But setting the values in the textBox will cause
this to happen.

It looks like a common case and there must be a solutions to this so I hope
someone will reply.

thanks
Manish

p.s.: I cannot swap lines 2 and 3 because the dlg.initializeValues() will
not be called.
Re: Initializing a dialog? [message #447286 is a reply to message #447279] Mon, 13 December 2004 10:37 Go to previous messageGo to next message
Stefan Pietsch is currently offline Stefan PietschFriend
Messages: 68
Registered: July 2009
Member
Hi Manish,

if you extend a jface Dialog try to implement your own create-method. Here
you call the super implementation and then your method initializeValues.

public void create() {

super.create();

initializeValues();

}

Bye Stefan

"Manish Garg" <manish.garg@gmail.com> schrieb im Newsbeitrag
news:cpjelm$mmi$1@www.eclipse.org...
> Hi,
>
> I have case where I want to open a dialog and set some data in the text
> fields.
> My calls looks like the following.:
>
> 1. MyDialog dlg= new MyDialog (...);
> 2. dlg.initializeValues();
> 3, dlg.open();
>
> I initialize the value through the method initializeValues on line 2.
> However, the textbox which gets calls setEnabledOK() in the modifyListener
> and at this point I get a nullPointerException. The setEnabledOK cannot be
> called before dlg.open(). But setting the values in the textBox will cause
> this to happen.
>
> It looks like a common case and there must be a solutions to this so I
hope
> someone will reply.
>
> thanks
> Manish
>
> p.s.: I cannot swap lines 2 and 3 because the dlg.initializeValues() will
> not be called.
>
>
Re: Initializing a dialog? [message #447408 is a reply to message #447279] Tue, 14 December 2004 14:05 Go to previous message
Yves Harms is currently offline Yves HarmsFriend
Messages: 80
Registered: July 2009
Member
You can only access fields in the dialogs (e.g. with setTitle, setImage,
setText) between open() and closing the dialog. In case of modal dialogs
open() blocks until you close the dialog.

If you want to use Dialog or TitleAreaDialog for exmaple you would have
to override createDialogArea and (optional) createButtonBar which both
will be called when the dialog is opened.

yves

> Hi,
>
> I have case where I want to open a dialog and set some data in the text
> fields.
> My calls looks like the following.:
>
> 1. MyDialog dlg= new MyDialog (...);
> 2. dlg.initializeValues();
> 3, dlg.open();
>
> I initialize the value through the method initializeValues on line 2.
> However, the textbox which gets calls setEnabledOK() in the modifyListener
> and at this point I get a nullPointerException. The setEnabledOK cannot be
> called before dlg.open(). But setting the values in the textBox will cause
> this to happen.
>
> It looks like a common case and there must be a solutions to this so I hope
> someone will reply.
>
> thanks
> Manish
>
> p.s.: I cannot swap lines 2 and 3 because the dlg.initializeValues() will
> not be called.
>
>
Previous Topic:How do I Searc a Table Item and selecting the corresponding Table row in SWT?
Next Topic:Visual Editor for SWT released yet?
Goto Forum:
  


Current Time: Sun Oct 25 20:27:52 GMT 2020

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

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

Back to the top