misc
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / view / tableview / TableAdapter.java
index 17d7b29..e833620 100644 (file)
@@ -3,16 +3,6 @@ package com.quantum.view.tableview;
 import java.sql.SQLException;
 import java.util.Vector;
 
-import com.quantum.Messages;
-import com.quantum.adapters.AdapterFactory;
-import com.quantum.adapters.DatabaseAdapter;
-import com.quantum.model.Bookmark;
-import com.quantum.model.Entity;
-import com.quantum.model.NotConnectedException;
-import com.quantum.sql.FilterSort;
-import com.quantum.sql.SQLHelper;
-import com.quantum.sql.SQLResults;
-
 import org.eclipse.jface.viewers.CellEditor;
 import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.jface.viewers.TextCellEditor;
@@ -22,10 +12,17 @@ import org.eclipse.swt.widgets.TableColumn;
 import org.eclipse.swt.widgets.TableItem;
 import org.eclipse.swt.widgets.Text;
 
+import com.quantum.Messages;
+import com.quantum.adapters.DatabaseAdapter;
+import com.quantum.model.Bookmark;
+import com.quantum.model.Entity;
+import com.quantum.model.NotConnectedException;
+import com.quantum.sql.FilterSort;
+import com.quantum.sql.SQLHelper;
+import com.quantum.sql.SQLResults;
+
 public class TableAdapter {
        
-       private Table table = null;
-       
        public static final String DEFAULT = ""; //$NON-NLS-1$
        public static final String UTF_8 = "UTF-8"; //$NON-NLS-1$
        public static final String UTF_16 = "UTF-16"; //$NON-NLS-1$
@@ -74,8 +71,8 @@ public class TableAdapter {
         try {
                if (entity != null) {
                 totalSize = SQLHelper.getSize(
-                    bookmark.getConnection(), entity.getCondQualifiedName(), 
-                        AdapterFactory.getInstance().getAdapter(bookmark.getType()));
+                    bookmark.getConnection(), entity.getQualifiedName(), 
+                        bookmark.getAdapter());
                }
         } catch (SQLException e) {
             e.printStackTrace();
@@ -126,9 +123,9 @@ public class TableAdapter {
 
        public String getQuery() {
                if (entity != null) {
-                       DatabaseAdapter adapter = AdapterFactory.getInstance().getAdapter(bookmark.getType());
+                       DatabaseAdapter adapter = bookmark.getAdapter();
                        if (adapter == null) throw new RuntimeException();
-                       else return adapter.getTableQuery((entity).getCondQualifiedName()) + extra.toString();
+                       else return adapter.getTableQuery((entity).getQualifiedName()) + extra.toString();
                }
                return query;
        }
@@ -172,7 +169,6 @@ public class TableAdapter {
                }
        }
        public void loadTable(Table table) {
-               this.table = table;
                table.setHeaderVisible(true);
                for (int i = 0; i < columnNames.size(); i++) {
                        TableColumn column = new TableColumn(table, SWT.NONE);
@@ -225,7 +221,7 @@ public class TableAdapter {
                this.extra = extra;
        }
        public String getTable() {
-               return (entity != null) ? entity.getCondQualifiedName() : null;
+               return (entity != null) ? entity.getQualifiedName() : null;
        }
 
        public void setQuery(String query) {