initial quantum version
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / properties / DatabaseInformationPropertyPage.java
diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/properties/DatabaseInformationPropertyPage.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/properties/DatabaseInformationPropertyPage.java
new file mode 100644 (file)
index 0000000..e1a0606
--- /dev/null
@@ -0,0 +1,60 @@
+package com.quantum.properties;
+
+import java.sql.SQLException;
+
+import com.quantum.model.Bookmark;
+import com.quantum.model.NotConnectedException;
+import com.quantum.view.bookmark.TreeNode;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+public class DatabaseInformationPropertyPage extends PropertyPage {
+
+       public DatabaseInformationPropertyPage() {
+               super();
+       }
+
+    protected Control createContents(Composite parent) {
+
+        Composite composite = new Composite(parent, SWT.NONE);
+        GridLayout layout = new GridLayout();
+        layout.numColumns = 2;
+        composite.setLayout(layout);
+        GridData data = new GridData(GridData.FILL);
+        data.grabExcessHorizontalSpace = true;
+        composite.setLayoutData(data);
+
+               Label productLabel = new Label(composite, SWT.NONE);
+               productLabel.setText("Product:");
+
+        Label productDescriptionLabel = new Label(composite, SWT.NONE);
+
+        Bookmark bookmark =
+            ((TreeNode) getElement()).getBookmark();
+        String description = null;
+        try {
+            description = bookmark.getDatabase().getInformation();
+        } catch (NotConnectedException e) {
+        } catch (SQLException e) {
+        }
+        if (description == null) {
+            description = "<unknown>";
+        }
+        productDescriptionLabel.setText(description);
+        return composite;
+       }
+
+       protected void performDefaults() {
+       }
+       
+       public boolean performOk() {
+               return true;
+       }
+
+}
\ No newline at end of file