''Open Wiki link'' and ''Create Files for Wiki link'' every new created file creates...
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / actions / NextSequenceAction.java
index 13d1d06..f4b032c 100644 (file)
@@ -1,15 +1,11 @@
 package com.quantum.actions;
 
-import org.eclipse.ui.IViewPart;
-
+import com.quantum.ImageStore;
 import com.quantum.Messages;
-import com.quantum.QuantumPlugin;
 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;
 
 public class NextSequenceAction extends BaseSequenceAction {
     
@@ -18,23 +14,17 @@ public class NextSequenceAction extends BaseSequenceAction {
      * @param view
      */
     public NextSequenceAction(IViewPart view) {
-        super(Messages.getString(NextSequenceAction.class.getName() + ".text"), view);
-        setImageDescriptor(QuantumPlugin.getImageDescriptor("append.gif"));    
+        super(Messages.getString(NextSequenceAction.class, "text"), view);
+        setImageDescriptor(ImageStore.getImageDescriptor(ImageStore.APPEND));    
     }
     
-       public void run() {
-               EntityNode sequence = getEntityNode();
-               String name = null;
-               if (sequence.isSequence()) {
-                       Bookmark bookmark = sequence.getBookmark();
-                       DatabaseAdapter adapter = bookmark.getAdapter();
-                       if (adapter == null) return;
-                       name = sequence.getName();
-                       String query = adapter.getNextValue(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.getNextValue(name, sequence.getEntity().getSchema());
        }
 }