1 package com.quantum.actions;
3 import com.quantum.ImageStore;
4 import com.quantum.Messages;
5 import com.quantum.adapters.DatabaseAdapter;
6 import com.quantum.model.Bookmark;
7 import com.quantum.sql.SQLResults;
8 import com.quantum.view.ViewHelper;
9 import com.quantum.view.bookmark.EntityNode;
10 import com.quantum.view.tableview.TableView;
12 import org.eclipse.ui.IViewPart;
14 public class NextSequenceAction extends BaseSequenceAction {
20 public NextSequenceAction(IViewPart view) {
21 super(Messages.getString(NextSequenceAction.class, "text"), view);
22 setImageDescriptor(ImageStore.getImageDescriptor(ImageStore.APPEND));
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);