[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.rcp] Re: How to set the test in the InputDialog?

I had a try:


public class InputFileDialog extends InputDialog {

private Text inputLine;
private String fileSelection;

@Override
protected Control createDialogArea(Composite parent) {
	Composite composite = (Composite)super.createDialogArea(parent);
	Control[] children = composite.getChildren();
	for (Control control : children) {
		if(control instanceof Text) {
			inputLine = (Text)control;
			
		}
	}
	// ....
	Button fileButton = new Button(composite, SWT.PUSH);
	fileButton.addMouseListener(new MouseAdapter() {
		public void mouseUp(MouseEvent e) {
			super.mouseUp(e);
			FileDialog fileDialog = new FileDialog(shell, SWT.OPEN);
			fileSelection = fileDialog.open();
			inputLine.setText(fileSelection);
			inputLine.setFocus();
			inputLine.update();
			System.out.println(inputLine.getText());
		}
	});
	return composite;
}
}

The problem is that the input-line still remains empty after oopening the FileDailog but the output of inputLine.getText() on the console succeeds. So what is my fault?

greets
Jan