2 * Created on 22-jul-2003
5 package com.quantum.actions;
7 import com.quantum.ImageStore;
8 import com.quantum.Messages;
9 import com.quantum.adapters.DatabaseAdapter;
10 import com.quantum.model.Bookmark;
11 import com.quantum.sql.SQLResults;
12 import com.quantum.view.ViewHelper;
13 import com.quantum.view.bookmark.EntityNode;
14 import com.quantum.view.tableview.TableView;
16 import org.eclipse.ui.IViewPart;
18 public class PrevSequenceAction extends BaseSequenceAction {
23 public PrevSequenceAction(IViewPart view) {
24 super(Messages.getString(PrevSequenceAction.class.getName() + ".text"), view);
25 setImageDescriptor(ImageStore.getImageDescriptor(ImageStore.GRID));
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);