/** Opens the dialog and returns the input string or null if the dialog was canceled. */ public String open() { Util.setCenteredMinBounds(shell, 300, 150); shell.open(); if (selectFilenameOnly) { String s = text.getText(); int index = s.lastIndexOf('.'); if (index != -1) text.setSelection(new Point(0, index)); else text.setSelection(new Point(0, text.getText().length())); } else { text.setSelection(new Point(0, text.getText().length())); } while (!shell.isDisposed()) { if (!shell.getDisplay().readAndDispatch()) shell.getDisplay().sleep(); } return answer; }