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.Messages;
9 import com.quantum.model.Bookmark;
10 import com.quantum.model.BookmarkCollection;
11 import com.quantum.model.JDBCDriver;
12 import com.quantum.model.Schema;
14 public class BookmarkWizard extends Wizard implements PropertyChangeListener {
15 private JDBCDriverSelectionWizardPage page1;
16 private BookmarkConnectionWizardPage page2;
17 private BookmarkNameWizardPage page3;
18 private SchemaSelectionWizardPage page4;
20 private Bookmark bookmark;
23 setWindowTitle(Messages.getString("BookmarkWizard.NewBookmark")); //$NON-NLS-1$
24 this.bookmark = new Bookmark();
26 public boolean performFinish() {
27 BookmarkCollection.getInstance().addBookmark(this.bookmark);
31 public void addPages() {
32 this.page1 = new JDBCDriverSelectionWizardPage("page1"); //$NON-NLS-1$
33 this.page1.addPropertyChangeListener(this);
35 this.page2 = new BookmarkConnectionWizardPage("page2"); //$NON-NLS-1$
36 this.page2.addPropertyChangeListener(this);
38 this.page3 = new BookmarkNameWizardPage("page3"); //$NON-NLS-1$
39 this.page3.addPropertyChangeListener(this);
41 this.page4 = new SchemaSelectionWizardPage("page4", this.bookmark); //$NON-NLS-1$
42 this.page4.addPropertyChangeListener(this);
45 public void propertyChange(PropertyChangeEvent event) {
47 if ("driver".equals(event.getPropertyName())) {
48 JDBCDriver driver = (JDBCDriver) event.getNewValue();
49 this.bookmark.setJDBCDriver(driver);
50 this.page2.setDriver(driver);
51 } else if ("name".equals(event.getPropertyName())) {
52 this.bookmark.setName((String) event.getNewValue());
53 } else if ("userid".equals(event.getPropertyName())) {
54 this.bookmark.setUsername((String) event.getNewValue());
55 } else if ("password".equals(event.getPropertyName())) {
56 this.bookmark.setPassword((String) event.getNewValue());
57 } else if ("connectionURL".equals(event.getPropertyName())) {
58 this.bookmark.setConnect((String) event.getNewValue());
59 } else if ("prompt".equals(event.getPropertyName())) {
60 this.bookmark.setPromptForPassword(Boolean.TRUE.equals(event.getNewValue()));
61 } else if ("schemaRule".equals(event.getPropertyName())) {
62 this.bookmark.setSchemaRule(((Integer) event.getNewValue()).intValue());
63 } else if ("schemas".equals(event.getPropertyName())) {
64 this.bookmark.setSchemaSelections((Schema[]) event.getNewValue());
68 public void dispose() {
69 this.page1.removePropertyChangeListener(this);
70 this.page2.removePropertyChangeListener(this);
71 this.page3.removePropertyChangeListener(this);
72 this.page4.removePropertyChangeListener(this);