1 package com.quantum.wizards;
3 import java.beans.PropertyChangeEvent;
4 import java.beans.PropertyChangeListener;
6 import org.eclipse.jface.wizard.Wizard;
8 import com.quantum.ImageStore;
9 import com.quantum.Messages;
10 import com.quantum.model.Bookmark;
11 import com.quantum.model.BookmarkCollection;
12 import com.quantum.model.JDBCDriver;
13 import com.quantum.model.Schema;
15 public class BookmarkWizard extends Wizard implements PropertyChangeListener {
16 private JDBCDriverSelectionWizardPage page1;
17 private BookmarkConnectionWizardPage page2;
18 private BookmarkNameWizardPage page3;
19 private SchemaSelectionWizardPage page4;
21 private Bookmark bookmark;
24 setWindowTitle(Messages.getString("BookmarkWizard.NewBookmark")); //$NON-NLS-1$
25 setDefaultPageImageDescriptor(ImageStore.getImageDescriptor(ImageStore.NEW_BOOKMARK_WIZARD));
26 this.bookmark = new Bookmark();
28 public boolean performFinish() {
29 BookmarkCollection.getInstance().addBookmark(this.bookmark);
33 public void addPages() {
34 this.page1 = new JDBCDriverSelectionWizardPage("page1"); //$NON-NLS-1$
35 this.page1.addPropertyChangeListener(this);
37 this.page2 = new BookmarkConnectionWizardPage("page2"); //$NON-NLS-1$
38 this.page2.addPropertyChangeListener(this);
40 this.page3 = new BookmarkNameWizardPage("page3"); //$NON-NLS-1$
41 this.page3.addPropertyChangeListener(this);
43 this.page4 = new SchemaSelectionWizardPage("page4", this.bookmark); //$NON-NLS-1$
44 this.page4.addPropertyChangeListener(this);
47 public void propertyChange(PropertyChangeEvent event) {
49 if ("driver".equals(event.getPropertyName())) {
50 JDBCDriver driver = (JDBCDriver) event.getNewValue();
51 this.bookmark.setJDBCDriver(driver);
52 this.page2.setDriver(driver);
53 } else if ("name".equals(event.getPropertyName())) {
54 this.bookmark.setName((String) event.getNewValue());
55 } else if ("userid".equals(event.getPropertyName())) {
56 this.bookmark.setUsername((String) event.getNewValue());
57 } else if ("password".equals(event.getPropertyName())) {
58 this.bookmark.setPassword((String) event.getNewValue());
59 } else if ("connectionURL".equals(event.getPropertyName())) {
60 this.bookmark.setConnect((String) event.getNewValue());
61 } else if ("prompt".equals(event.getPropertyName())) {
62 this.bookmark.setPromptForPassword(Boolean.TRUE.equals(event.getNewValue()));
63 } else if ("schemaRule".equals(event.getPropertyName())) {
64 this.bookmark.setSchemaRule(((Integer) event.getNewValue()).intValue());
65 } else if ("schemas".equals(event.getPropertyName())) {
66 this.bookmark.setSchemaSelections((Schema[]) event.getNewValue());
70 public void dispose() {
71 this.page1.removePropertyChangeListener(this);
72 this.page2.removePropertyChangeListener(this);
73 this.page3.removePropertyChangeListener(this);
74 this.page4.removePropertyChangeListener(this);