show HTML files as local resources (no 'http://' url prefix)
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / view / bookmark / BookmarkContentProvider.java
index 2335110..79d70bf 100644 (file)
@@ -1,17 +1,44 @@
 package com.quantum.view.bookmark;
 
+import java.sql.SQLException;
+
+import com.quantum.model.NotConnectedException;
+import com.quantum.ui.dialog.ExceptionDisplayDialog;
+
 import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IViewPart;
 
 public class BookmarkContentProvider implements ITreeContentProvider {
+       
+       private final IViewPart view;
+
+       public BookmarkContentProvider(IViewPart view) {
+               this.view = view;
+       }
+       
     
        public Object[] getChildren(Object element) {
                if (element instanceof TreeNode) {
                        TreeNode node = (TreeNode) element;
-                       return node.getChildren();
+                       try {
+                               return node.getChildren();
+                       } catch (NotConnectedException e) {
+                               ExceptionDisplayDialog.openError(getShell(), null, null, e);
+                       } catch (SQLException e) {
+                               ExceptionDisplayDialog.openError(getShell(), null, null, e);
+                       }
                }
                return BookmarkListNode.EMPTY_ARRAY;
        }
+       /**
+        * @return
+        */
+       private Shell getShell() {
+               return this.view.getSite().getShell();
+       }
+
        public Object[] getElements(Object inputElement) {
                return getChildren(inputElement);
        }