Testing the post-commit script the only way i know how.
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / actions / ViewTableDetailsAction.java
index 9d16eef..80db996 100644 (file)
@@ -1,17 +1,20 @@
 package com.quantum.actions;
 
 import java.sql.Connection;
+import java.sql.SQLException;
 import java.util.List;
 
 import com.quantum.ImageStore;
 import com.quantum.Messages;
 import com.quantum.model.Bookmark;
 import com.quantum.model.Entity;
-import com.quantum.sql.SQLResults;
+import com.quantum.sql.MultiSQLServer;
+import com.quantum.sql.SQLResultSetCollection;
+import com.quantum.sql.SQLResultSetResults;
+import com.quantum.ui.dialog.ExceptionDisplayDialog;
+import com.quantum.ui.dialog.SQLExceptionDialog;
 import com.quantum.util.connection.ConnectionUtil;
-import com.quantum.view.ViewHelper;
 import com.quantum.view.bookmark.EntityNode;
-import com.quantum.view.tableview.TableView;
 
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.viewers.ISelection;
@@ -26,20 +29,24 @@ public class ViewTableDetailsAction extends SelectionListenerAction  {
        
        public ViewTableDetailsAction(IViewPart view) {
         super(Messages.getString(ViewTableDetailsAction.class, "text"));
-        setImageDescriptor(ImageStore.getImageDescriptor(ImageStore.OPEN_TABLE));
+        setImageDescriptor(ImageStore.getImageDescriptor(ImageStore.TABLE_DETAILS));
                this.view = view;
        }
 
        public void run() {
         Entity entity = getEntity();
-               StringBuffer query = new StringBuffer();
-               query.append(Messages.getString("MetaDataKey")+Messages.getString("MetaDataKeySeparator")); //$NON-NLS-1$ //$NON-NLS-2$
-           query.append(entity.getQuotedTableName());
         Connection connection = connectionUtil.getConnection(getBookmark(), getShell());
         if (connection != null) {
-            SQLResults results = ViewHelper.tryGetResults(view, connection, query.toString());
-            if (results != null && ! results.isError()) 
-                TableView.getInstance().loadQuery(entity.getBookmark(), results);
+               try {
+                   SQLResultSetResults results = 
+                       MultiSQLServer.getInstance().getMetaData(entity, connection);
+                   if (results != null) {
+                       SQLResultSetCollection.getInstance().addSQLResultSet(results);
+                   }
+               } catch (SQLException e) {
+                       SQLExceptionDialog.openException(getShell(), 
+                                       entity == null ? null : entity.getBookmark(), e);
+               }
         }
        }
        public void selectionChanged(IAction action, ISelection selection) {