Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package gui;
- import org.eclipse.jface.dialogs.Dialog;
- import org.eclipse.swt.SWT;
- import org.eclipse.swt.layout.GridData;
- import org.eclipse.swt.layout.GridLayout;
- import org.eclipse.swt.widgets.Composite;
- import org.eclipse.swt.widgets.Control;
- import org.eclipse.swt.widgets.Label;
- import org.eclipse.swt.widgets.Text;
- public class ConnectionDialog extends Dialog {
- Text textRepository;
- Text textUsername;
- Text textPassword;
- ConnectionInfo connectionInfo;
- public ConnectionDialog(GUI gui) {
- super(gui.getShell());
- }
- protected Control createDialogArea(Composite parent) {
- getShell().setText("Connection Settings");
- Composite composite = (Composite) super.createDialogArea(parent);
- composite.setLayout(new GridLayout(2, false));
- new Label(composite, SWT.NULL).setText("Repository");
- textRepository = new Text(composite, SWT.BORDER);
- textRepository.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- new Label(composite, SWT.NULL).setText("Username");
- textUsername = new Text(composite, SWT.BORDER);
- textUsername.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- new Label(composite, SWT.NULL).setText("Password");
- textPassword = new Text(composite, SWT.PASSWORD | SWT.BORDER);
- textPassword.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- return composite;
- }
- public ConnectionInfo getConnectionInfo() {
- return connectionInfo;
- }
- protected void okPressed() {
- connectionInfo = new ConnectionInfo();
- connectionInfo.setRepository(textRepository.getText());
- connectionInfo.setUsername(textUsername.getText());
- connectionInfo.setPassword(textPassword.getText());
- super.okPressed();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement