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.adapters.NoSuchAdapterException;
12 import net.sourceforge.phpdt.sql.sql.MultiSQLServer;
13 import net.sourceforge.phpdt.sql.sql.SQLResults;
14 import net.sourceforge.phpdt.sql.view.BookmarkView;
15 import net.sourceforge.phpdt.sql.view.TableView;
16 import net.sourceforge.phpdt.sql.view.bookmark.BookmarkNode;
17 import net.sourceforge.phpdt.sql.view.bookmark.SequenceNode;
18 import net.sourceforge.phpdt.sql.view.bookmark.TreeNode;
20 public class NextSequenceAction extends Action implements IViewActionDelegate {
23 public void init(IViewPart view) {
24 this.view = (BookmarkView) view;
27 public void run(IAction action) {
32 TreeNode node = (TreeNode) view.getCurrent();
35 if (node instanceof SequenceNode) {
36 SequenceNode sequence = (SequenceNode) node;
37 BookmarkNode parent = (BookmarkNode) sequence.getParent();
38 DatabaseAdapter adapter = AdapterFactory.getInstance().getAdapter(parent.getType());
39 name = sequence.getName();
40 String query = adapter.getNextValue(name);
41 MultiSQLServer server = MultiSQLServer.getInstance();
42 SQLResults results = server.execute(query);
43 TableView.getInstance().loadQuery(results);
45 } catch (NoSuchAdapterException e) {
49 public void selectionChanged(IAction action, ISelection selection) {