Merging from 3.0-beta2

* InputDialog now looks better with larger fonts
* Find dialog's button is now Find Next instead of OK

git-svn-id: https://ipscan.svn.sourceforge.net/svnroot/ipscan/trunk@321 375186e5-ef17-0410-b0b6-91563547dcda
This commit is contained in:
angryziber 2008-03-22 23:26:10 +00:00
parent 9ffeae7099
commit aec00a46b6
2 changed files with 10 additions and 6 deletions

View File

@ -108,8 +108,10 @@ public abstract class AbstractModalDialog {
// both buttons
int height = Math.max(okButton.computeSize(SWT.DEFAULT, SWT.DEFAULT).y, Config.getConfig().getGUI().standardButtonHeight);
int distance = height/3;
cancelButton.setLayoutData(LayoutHelper.formData(85, height, null, new FormAttachment(control, 0, SWT.RIGHT), new FormAttachment(control, 8), null));
okButton.setLayoutData(LayoutHelper.formData(85, height, null, new FormAttachment(cancelButton, -distance), new FormAttachment(control, 8), null));
cancelButton.pack();
cancelButton.setLayoutData(LayoutHelper.formData(Math.max(85, cancelButton.getSize().x), height, null, new FormAttachment(control, 0, SWT.RIGHT), new FormAttachment(control, 8), null));
okButton.pack();
okButton.setLayoutData(LayoutHelper.formData(Math.max(85, okButton.getSize().x), height, null, new FormAttachment(cancelButton, -distance), new FormAttachment(control, 8), null));
}
/**

View File

@ -57,9 +57,7 @@ public class InputDialog extends AbstractModalDialog {
cancelButton = new Button(shell, SWT.NONE);
cancelButton.setText(Labels.getLabel("button.cancel"));
positionButtonsInFormLayout(okButton, cancelButton, text);
okButton.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
message = text.getText();
@ -81,7 +79,6 @@ public class InputDialog extends AbstractModalDialog {
this.text.pack();
this.text.setLayoutData(LayoutHelper.formData(Math.max(this.text.getSize().x, 310), SWT.DEFAULT, new FormAttachment(0), null, new FormAttachment(messageLabel), null));
this.text.setFocus();
shell.pack();
}
}
@ -93,6 +90,11 @@ public class InputDialog extends AbstractModalDialog {
public String open(String text, String okButtonText) {
okButton.setText(okButtonText);
setText(text);
// reposition buttons because of changed text
positionButtonsInFormLayout(okButton, cancelButton, this.text);
// layout the shell
shell.pack();
// time to show!
super.open();
return message;
}