Quantum version 2.4.1
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / actions / ViewTableDetailsAction.java
index 5215912..19d803c 100644 (file)
@@ -1,17 +1,19 @@
 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.QuantumPlugin;
 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.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 +28,23 @@ public class ViewTableDetailsAction extends SelectionListenerAction  {
        
        public ViewTableDetailsAction(IViewPart view) {
         super(Messages.getString(ViewTableDetailsAction.class, "text"));
-        setImageDescriptor(QuantumPlugin.getImageDescriptor("table.gif")); //$NON-NLS-1$
+        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) {
+                       ExceptionDisplayDialog.openError(getShell(), null, null, e);
+               }
         }
        }
        public void selectionChanged(IAction action, ISelection selection) {