2 * Created on 12-jul-2003
5 package com.quantum.view.bookmark;
6 import java.util.ArrayList;
7 import java.util.Collection;
8 import java.util.Iterator;
9 import java.util.Vector;
11 import com.quantum.IQuantumConstants;
13 import org.eclipse.jface.dialogs.Dialog;
14 import org.eclipse.swt.SWT;
15 import org.eclipse.swt.layout.GridData;
16 import org.eclipse.swt.widgets.Composite;
17 import org.eclipse.swt.widgets.Control;
18 import org.eclipse.swt.widgets.List;
19 import org.eclipse.swt.widgets.Shell;
20 import org.eclipse.ui.help.WorkbenchHelp;
26 public class AddSchemaDialog extends Dialog {
28 protected Vector input;
30 private Vector selection;
32 * Creates a new AddSchemaDialog.
34 public AddSchemaDialog(Shell parentShell, Vector input) {
41 * Method declared on Window.
43 protected void configureShell(Shell newShell) {
44 super.configureShell(newShell);
45 newShell.setText("Set Schemas");
46 WorkbenchHelp.setHelp(
48 IQuantumConstants.ADD_SCHEMA_DIALOG_CONTEXT);
51 * Method declared on Dialog
53 protected Control createDialogArea(Composite parent) {
54 Composite composite = (Composite) super.createDialogArea(parent);
56 list = new List(composite, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI);
57 GridData data = new GridData(GridData.FILL_BOTH);
58 list.setLayoutData(data);
59 for (Iterator iter = input.iterator(); iter.hasNext();) {
60 String element = (String) iter.next();
67 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
69 protected void okPressed() {
70 // If it's OK, then the selection is not null. Null is used to signal a canceled dialog.
71 selection = new Vector();
73 String selecStr[] = list.getSelection();
74 for (int i = 0; i < selecStr.length; i++) {
75 String string = selecStr[i];
76 selection.add(string);
82 public Collection getSelectedSchemas() {
83 return this.selection == null ? null : new ArrayList(this.selection);