public void widgetSelected(SelectionEvent event) { buttonPressed(CANCEL); } });
protected void buttonPressed(int buttonId) { if (buttonId == OK) { okPressed(); } else if (buttonId == CANCEL) { cancelPressed(); } }
protected void cancelPressed() { setReturnCode(CANCEL); close(); }
public void create() { shell = createShell(); contents = createContents(shell); //initialize the bounds of the shell to that appropriate for the contents initializeBounds(); }
public int open() { if (shell == null) { create(); } shell.open(); if (block) { runEventLoop(shell); } return returnCode; }
protected void initializeBounds() { if (resizeListener != null) { shell.removeListener(SWT.Resize,resizeListener); } if (resizeHasOccurred) { // Check if shell size has been set already. return; } Point size = getInitialSize(); Point location = getInitialLocation(size); shell.setBounds(location.x, location.y, size.x, size.y); }
protected Control createContents(Composite parent) { Composite composite = new Composite(parent, 0); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; layout.verticalSpacing = 0; composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); composite.setFont(parent.getFont()); dialogArea = createDialogArea(composite); buttonBar = createButtonBar(composite); return composite; }
protected final Shell createShell() { Shell newShell = new Shell(parentShell, shellStyle); resizeListener = new Listener() { public void handleEvent(Event e) { resizeHasOccurred = true; } }; newShell.addListener(SWT.Resize,resizeListener); newShell.setData(this); newShell.addShellListener(getShellListener()); configureShell(newShell); return newShell; }
protected void configureShell(Shell shell) { super.configureShell(shell); if (title != null) { shell.setText(title); } }
protected Control createButtonBar(Composite parent) { Control control = super.createButtonBar(parent); lsDevicesListener.widgetSelected(null); return control; }
protected void configureShell(Shell shell) { super.configureShell(shell); shell.setText("Select device..."); }
protected void okPressed() { setReturnCode(OK); close(); }
protected void configureShell(Shell shell) { super.configureShell(shell); if (title != null) { shell.setText(title); } }
public void widgetSelected(SelectionEvent event) { buttonPressed(OK); } });
public void shellClosed(ShellEvent event) { event.doit= false; // don't close now setReturnCode(CANCEL); close(); } };