Refactory: removed unnecessary local variables and imports.
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.sql / src / net / sourceforge / phpdt / sql / actions / NextSequenceAction.java
index 0b6cddd..1d4b96a 100644 (file)
@@ -8,7 +8,6 @@ import org.eclipse.ui.IViewPart;
 
 import net.sourceforge.phpdt.sql.adapters.AdapterFactory;
 import net.sourceforge.phpdt.sql.adapters.DatabaseAdapter;
-import net.sourceforge.phpdt.sql.adapters.NoSuchAdapterException;
 import net.sourceforge.phpdt.sql.sql.MultiSQLServer;
 import net.sourceforge.phpdt.sql.sql.SQLResults;
 import net.sourceforge.phpdt.sql.view.BookmarkView;
@@ -31,18 +30,16 @@ public class NextSequenceAction extends Action implements IViewActionDelegate {
        public void run() {
                TreeNode node = (TreeNode) view.getCurrent();
                String name = null;
-               try {
-                       if (node instanceof SequenceNode) {
-                               SequenceNode sequence = (SequenceNode) node;
-                               BookmarkNode parent = (BookmarkNode) sequence.getParent();
-                               DatabaseAdapter adapter = AdapterFactory.getInstance().getAdapter(parent.getType());
-                               name = sequence.getName();
-                               String query = adapter.getNextValue(name);
-                               MultiSQLServer server = MultiSQLServer.getInstance();
-                               SQLResults results = server.execute(query);
-                               TableView.getInstance().loadQuery(results);
-                       }
-               } catch (NoSuchAdapterException e) {
+               if (node instanceof SequenceNode) {
+                       SequenceNode sequence = (SequenceNode) node;
+                       BookmarkNode parent = (BookmarkNode) sequence.getParent();
+                       DatabaseAdapter adapter = AdapterFactory.getInstance().getAdapter(parent.getType());
+                       if (adapter == null) return;
+                       name = sequence.getName();
+                       String query = adapter.getNextValue(name);
+                       MultiSQLServer server = MultiSQLServer.getInstance();
+                       SQLResults results = server.execute(parent.getConnection(), query);
+                       TableView.getInstance().loadQuery(parent, results);
                }
        }