2 * Created on 22-jul-2003
5 package com.quantum.actions;
7 import org.eclipse.ui.IViewPart;
9 import com.quantum.Messages;
10 import com.quantum.QuantumPlugin;
11 import com.quantum.adapters.DatabaseAdapter;
12 import com.quantum.model.Bookmark;
13 import com.quantum.sql.SQLResults;
14 import com.quantum.view.ViewHelper;
15 import com.quantum.view.bookmark.EntityNode;
16 import com.quantum.view.tableview.TableView;
18 public class PrevSequenceAction extends BaseSequenceAction {
23 public PrevSequenceAction(IViewPart view) {
24 super(Messages.getString(PrevSequenceAction.class.getName() + ".text"), view);
25 setImageDescriptor(QuantumPlugin.getImageDescriptor("grid.gif"));
29 EntityNode sequence = getEntityNode();
30 if (sequence.isSequence()) {
31 Bookmark bookmark = sequence.getBookmark();
32 DatabaseAdapter adapter = bookmark.getAdapter();
33 if (adapter == null) return;
34 String name = sequence.getName();
35 String query = adapter.getPrevValue(name, sequence.getEntity().getSchema());
36 SQLResults results = ViewHelper.tryGetResults(view, getConnection(), query);
37 if (results != null && ! results.isError())
38 TableView.getInstance().loadQuery(bookmark, results);