1 package com.quantum.actions;
3 import com.quantum.Messages;
4 import com.quantum.QuantumPlugin;
5 import com.quantum.adapters.AdapterFactory;
6 import com.quantum.adapters.DatabaseAdapter;
7 import com.quantum.model.Bookmark;
8 import com.quantum.sql.SQLResults;
9 import com.quantum.view.ViewHelper;
10 import com.quantum.view.bookmark.EntityNode;
11 import com.quantum.view.tableview.TableView;
13 import org.eclipse.ui.IViewPart;
15 public class NextSequenceAction extends BaseSequenceAction {
21 public NextSequenceAction(IViewPart view) {
22 super(Messages.getString(NextSequenceAction.class.getName() + ".text"), view);
23 setImageDescriptor(QuantumPlugin.getImageDescriptor("append.gif"));
27 EntityNode node = getEntityNode();
29 if (node.isSequence()) {
30 EntityNode sequence = (EntityNode) node;
31 Bookmark bookmark = sequence.getBookmark();
32 DatabaseAdapter adapter = AdapterFactory.getInstance().getAdapter(bookmark.getType());
33 if (adapter == null) return;
34 name = sequence.getName();
35 String query = adapter.getNextValue(name, sequence.getEntity().getSchema());
37 SQLResults results = ViewHelper.tryGetResults(view, getConnection(), query);
38 if (results != null && ! results.isError())
39 TableView.getInstance().loadQuery(bookmark, results);