RSS news reader; initially copied from "all the news"
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / actions / PrevSequenceAction.java
index 875df6d..ba086d0 100644 (file)
@@ -4,15 +4,10 @@
  */
 package com.quantum.actions;
 
+import com.quantum.ImageStore;
 import com.quantum.Messages;
-import com.quantum.QuantumPlugin;
-import com.quantum.adapters.AdapterFactory;
 import com.quantum.adapters.DatabaseAdapter;
-import com.quantum.model.Bookmark;
-import com.quantum.sql.SQLResults;
-import com.quantum.view.ViewHelper;
 import com.quantum.view.bookmark.EntityNode;
-import com.quantum.view.tableview.TableView;
 
 import org.eclipse.ui.IViewPart;
 
@@ -23,22 +18,16 @@ public class PrevSequenceAction extends BaseSequenceAction {
      */
     public PrevSequenceAction(IViewPart view) {
         super(Messages.getString(PrevSequenceAction.class.getName() + ".text"), view);
-        setImageDescriptor(QuantumPlugin.getImageDescriptor("grid.gif"));
+        setImageDescriptor(ImageStore.getImageDescriptor(ImageStore.GRID));
     }
 
-    public void run() {
-               EntityNode node = getEntityNode();
-               if (((EntityNode) node).isSequence()) {
-            EntityNode sequence = (EntityNode) node;
-                       Bookmark bookmark = sequence.getBookmark();
-                       DatabaseAdapter adapter = AdapterFactory.getInstance().getAdapter(
-                bookmark.getType());
-                       if (adapter == null) return;
-                       String name = sequence.getName();
-                       String query = adapter.getPrevValue(name, sequence.getEntity().getSchema());
-                       SQLResults results = ViewHelper.tryGetResults(view, getConnection(), query);
-                       if (results != null && ! results.isError()) 
-                               TableView.getInstance().loadQuery(bookmark, results);
-               }
+       /**
+        * @param sequence
+        * @param name
+        * @param adapter
+        * @return
+        */
+       protected String getQuery(EntityNode sequence, String name, DatabaseAdapter adapter) {
+               return adapter.getPrevValue(name, sequence.getEntity().getSchema());
        }
 }