Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » InputDialog getOkButton() and Dialog getButton(id) both returns null, why?
InputDialog getOkButton() and Dialog getButton(id) both returns null, why? [message #297550] Tue, 17 January 2006 05:11 Go to next message
Eclipse UserFriend
Originally posted by: dozerox.gmail.com

Hi,

I tried to change the text of the buttons in
org.eclipse.jface.dialogs.InputDialog. I made own InputDialog class that
had jface InputDialog as superclass and did a methods that should of
return the buttons. I tried both InputDialog class getOkButton() and
Dialog class getButton(id), but bot returns null. Here's what I tried:

------------------------------------------------------------ ---------

import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;

import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Shell;

public class myInputDialog extends InputDialog {

public myInputDialog(Shell arg0, String arg1,
String arg2, String arg3, IInputValidator arg4) {
super(arg0, arg1, arg2, arg3, arg4);
}

public Button getMyOkButton(){
return getOkButton();
}

public Button getMyButton(int id){
return super.getButton(id);
}
}

------------------------------------------------------------ ---------

getMyButton method is called with: getMyButton(IDialogConstants.OK_ID);
but they both return null. Should it work this way?

I also tried to override the createButtonsForButtonBar method in
InputDialog and created the buttons my self like this:

------------------------------------------------------------ ---------

protected void createButtonsForButtonBar(Composite parent) {
okButton = createButton(parent, IDialogConstants.OK_ID,
IDialogConstants.OK_LABEL, true);
cancelButton = createButton(parent, IDialogConstants.CANCEL_ID,
IDialogConstants.CANCEL_LABEL, false);
}

------------------------------------------------------------ ---------

But by overriding the createButtonsForButtonBar method broke the
InputValidator of the InputDialog. I guess the text widget did not get
created when doing this, atleast the stacktraces pointed that way.

Anyways, any help on this would be much appreciated!
Re: InputDialog getOkButton() and Dialog getButton(id) both returns null, why? [message #297551 is a reply to message #297550] Tue, 17 January 2006 05:32 Go to previous message
Eclipse UserFriend
Originally posted by: scheglov_ke.nlmk.ru

doze wrote:

You call these methods in wrong time.
Until open() (or create()) buttons are not created.

> Hi,
>
> I tried to change the text of the buttons in
> org.eclipse.jface.dialogs.InputDialog. I made own InputDialog class that
> had jface InputDialog as superclass and did a methods that should of
> return the buttons. I tried both InputDialog class getOkButton() and
> Dialog class getButton(id), but bot returns null. Here's what I tried:
>
> ------------------------------------------------------------ ---------
>
> import org.eclipse.jface.dialogs.IInputValidator;
> import org.eclipse.jface.dialogs.InputDialog;
>
> import org.eclipse.swt.widgets.Button;
> import org.eclipse.swt.widgets.Shell;
>
> public class myInputDialog extends InputDialog {
>
> public myInputDialog(Shell arg0, String arg1,
> String arg2, String arg3, IInputValidator arg4) {
> super(arg0, arg1, arg2, arg3, arg4);
> }
>
> public Button getMyOkButton(){
> return getOkButton();
> }
>
> public Button getMyButton(int id){
> return super.getButton(id);
> }
> }
>
> ------------------------------------------------------------ ---------
>
> getMyButton method is called with: getMyButton(IDialogConstants.OK_ID);
> but they both return null. Should it work this way?
>
> I also tried to override the createButtonsForButtonBar method in
> InputDialog and created the buttons my self like this:
>
> ------------------------------------------------------------ ---------
>
> protected void createButtonsForButtonBar(Composite parent) {
> okButton = createButton(parent, IDialogConstants.OK_ID,
> IDialogConstants.OK_LABEL, true);
> cancelButton = createButton(parent, IDialogConstants.CANCEL_ID,
> IDialogConstants.CANCEL_LABEL, false);
> }
>
> ------------------------------------------------------------ ---------
>
> But by overriding the createButtonsForButtonBar method broke the
> InputValidator of the InputDialog. I guess the text widget did not get
> created when doing this, atleast the stacktraces pointed that way.
>
> Anyways, any help on this would be much appreciated!


--
SY, Konstantin.
Advanced Eclipse SWT Designer (http://www.swt-designer.com)
Previous Topic:How can I set the position of the cursor in a TestEditor?
Next Topic:Best way for automated team checkout and update?
Goto Forum:
  


Current Time: Mon Jun 09 07:07:20 EDT 2025

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

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

Back to the top