OK and Cancel button not visible in MessageDialog in JFace / SWT

I have a dialog box with the message:

import org.eclipse.jface.dialogs.MessageDialog


public void openQuestion(Shell parentShell, String title, String question, final int iconStyle){
MessageDialog dialog = new MessageDialog(
                    parentShell,
                    title,
                    getTitleIcon(iconStyle),
                    question,
                    iconStyle,
                    new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL },
                    0
                    ) {
                        @Override
                        public Image getImage() {
                            return getIcon(iconStyle);
                        }
            };

return dialog.open() == IDialogConstants.OK_ID;
    }

      

Here, when I pass the question (parameter) as a small string, I can see the OK, Cancel buttons in the dialog. But on the other hand, when I pass the question (parameter) as a large string in the message dialog, the OK and Cancel buttons are not shown in the dialog. They are hiding. Is there a way that the OK and Cancel buttons will always appear?

+3


source to share


1 answer


No matter what I try, fail to reproduce your problem. It works great for me even for a large multi-line string. Screen image sententer image description here

I guess there is some kind of problem with the layout or size of the Object wrapper you are passing Shell parentShell

, try sending null to the method just to check for the problem openQuestion(null, "Hello Testing", "Test String,1")



Also if you want my test code for link here

+1


source







All Articles