misc changes
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / properties / DatabaseInformationPropertyPage.java
1 package com.quantum.properties;
2
3 import java.sql.SQLException;
4
5 import com.quantum.model.Bookmark;
6 import com.quantum.model.NotConnectedException;
7 import com.quantum.view.bookmark.TreeNode;
8
9 import org.eclipse.swt.SWT;
10 import org.eclipse.swt.layout.GridData;
11 import org.eclipse.swt.layout.GridLayout;
12 import org.eclipse.swt.widgets.Composite;
13 import org.eclipse.swt.widgets.Control;
14 import org.eclipse.swt.widgets.Label;
15 import org.eclipse.ui.dialogs.PropertyPage;
16
17 public class DatabaseInformationPropertyPage extends PropertyPage {
18
19         public DatabaseInformationPropertyPage() {
20                 super();
21         }
22
23     protected Control createContents(Composite parent) {
24
25         Composite composite = new Composite(parent, SWT.NONE);
26         GridLayout layout = new GridLayout();
27         layout.numColumns = 2;
28         composite.setLayout(layout);
29         GridData data = new GridData(GridData.FILL);
30         data.grabExcessHorizontalSpace = true;
31         composite.setLayoutData(data);
32
33                 Label productLabel = new Label(composite, SWT.NONE);
34                 productLabel.setText("Product:");
35
36         Label productDescriptionLabel = new Label(composite, SWT.NONE);
37
38         Bookmark bookmark =
39             ((TreeNode) getElement()).getBookmark();
40         String description = null;
41         try {
42             description = bookmark.getDatabase().getInformation();
43         } catch (NotConnectedException e) {
44         } catch (SQLException e) {
45         }
46         if (description == null) {
47             description = "<unknown>";
48         }
49         productDescriptionLabel.setText(description);
50         return composite;
51         }
52
53         protected void performDefaults() {
54         }
55         
56         public boolean performOk() {
57                 return true;
58         }
59
60 }