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