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