preparing new release
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / properties / SchemaPropertyPage.java
1 package com.quantum.properties;
2
3 import com.quantum.model.Bookmark;
4 import com.quantum.model.BookmarkHolder;
5 import com.quantum.view.SchemaSelectionControl;
6
7 import org.eclipse.swt.widgets.Composite;
8 import org.eclipse.swt.widgets.Control;
9 import org.eclipse.ui.dialogs.PropertyPage;
10
11 public class SchemaPropertyPage extends PropertyPage {
12         
13         private SchemaSelectionControl control;
14     
15     protected Control createContents(Composite parent) {
16         return this.control = new SchemaSelectionControl(parent, getBookmark());
17     }
18
19     private Bookmark getBookmark() {
20         Bookmark bookmark =
21             ((BookmarkHolder) getElement()).getBookmark();
22         return bookmark;
23     }
24
25     /**
26      * @see org.eclipse.jface.preference.PreferencePage#performApply()
27      */
28     public boolean performOk() {
29         Bookmark bookmark = getBookmark();
30         bookmark.setSchemaSelections(this.control.getSchemas());
31         bookmark.setSchemaRule(this.control.getSchemaRule());
32         return true;
33     }
34     
35     protected void performDefaults() {
36         super.performDefaults();
37         Bookmark bookmark = getBookmark();
38         this.control.setSchemaRule(bookmark.getSchemaRule());
39         this.control.setSchemas(bookmark.getSchemaSelections());
40     }
41 }