1 package net.sourceforge.phpdt.sql.actions;
3 import org.eclipse.jface.action.Action;
4 import org.eclipse.jface.action.IAction;
5 import org.eclipse.jface.viewers.ISelection;
6 import org.eclipse.ui.IViewActionDelegate;
7 import org.eclipse.ui.IViewPart;
9 import net.sourceforge.phpdt.sql.Messages;
10 import net.sourceforge.phpdt.sql.sql.MultiSQLServer;
11 import net.sourceforge.phpdt.sql.view.BookmarkView;
12 import net.sourceforge.phpdt.sql.view.TableView;
13 import net.sourceforge.phpdt.sql.view.bookmark.BookmarkNode;
14 import net.sourceforge.phpdt.sql.view.bookmark.TableNode;
15 import net.sourceforge.phpdt.sql.view.bookmark.TreeNode;
16 import net.sourceforge.phpdt.sql.view.bookmark.ViewNode;
18 public class ViewTableDetailsAction extends Action implements IViewActionDelegate {
21 public void init(IViewPart view) {
22 this.view = (BookmarkView) view;
25 public void run(IAction action) {
29 TreeNode node = (TreeNode) view.getCurrent();
30 StringBuffer query = new StringBuffer();
31 query.append(Messages.getString("MetaDataKey")+Messages.getString("MetaDataKeySeparator")); //$NON-NLS-1$ //$NON-NLS-2$
32 if (node instanceof TableNode) {
33 query.append(((TableNode) node).getName());
34 } else if (node instanceof ViewNode) {
35 query.append(((ViewNode) node).getName());
37 MultiSQLServer server = MultiSQLServer.getInstance();
38 BookmarkNode current = view.getCurrentBookmark();
40 TableView.getInstance().loadQuery(current, server.execute(current.getConnection(), query.toString()));
42 public void selectionChanged(IAction action, ISelection selection) {