1 package net.sourceforge.phpdt.sql.actions;
3 import org.eclipse.jface.action.Action;
4 import org.eclipse.jface.action.IAction;
5 import org.eclipse.jface.viewers.ISelection;
6 import org.eclipse.ui.IViewActionDelegate;
7 import org.eclipse.ui.IViewPart;
9 import net.sourceforge.phpdt.sql.adapters.AdapterFactory;
10 import net.sourceforge.phpdt.sql.adapters.DatabaseAdapter;
11 import net.sourceforge.phpdt.sql.sql.MultiSQLServer;
12 import net.sourceforge.phpdt.sql.sql.SQLResults;
13 import net.sourceforge.phpdt.sql.view.BookmarkView;
14 import net.sourceforge.phpdt.sql.view.TableView;
15 import net.sourceforge.phpdt.sql.view.bookmark.BookmarkNode;
16 import net.sourceforge.phpdt.sql.view.bookmark.SequenceNode;
17 import net.sourceforge.phpdt.sql.view.bookmark.TreeNode;
19 public class NextSequenceAction extends Action implements IViewActionDelegate {
22 public void init(IViewPart view) {
23 this.view = (BookmarkView) view;
26 public void run(IAction action) {
31 TreeNode node = (TreeNode) view.getCurrent();
33 if (node instanceof SequenceNode) {
34 SequenceNode sequence = (SequenceNode) node;
35 BookmarkNode parent = (BookmarkNode) sequence.getParent();
36 DatabaseAdapter adapter = AdapterFactory.getInstance().getAdapter(parent.getType());
37 if (adapter == null) return;
38 name = sequence.getName();
39 String query = adapter.getNextValue(name);
40 MultiSQLServer server = MultiSQLServer.getInstance();
41 SQLResults results = server.execute(parent.getConnection(), query);
42 TableView.getInstance().loadQuery(parent, results);
46 public void selectionChanged(IAction action, ISelection selection) {