1 package net.sourceforge.phpdt.sql.actions;
3 import net.sourceforge.phpdt.sql.sql.MultiSQLServer;
4 import net.sourceforge.phpdt.sql.view.BookmarkView;
5 import net.sourceforge.phpdt.sql.view.TableView;
6 import net.sourceforge.phpdt.sql.view.bookmark.TableNode;
7 import net.sourceforge.phpdt.sql.view.bookmark.TreeNode;
8 import net.sourceforge.phpdt.sql.view.bookmark.ViewNode;
10 import org.eclipse.jface.action.Action;
11 import org.eclipse.jface.action.IAction;
12 import org.eclipse.jface.viewers.ISelection;
13 import org.eclipse.ui.IViewActionDelegate;
14 import org.eclipse.ui.IViewPart;
15 import org.eclipse.ui.IWorkbenchPage;
16 import org.eclipse.ui.PartInitException;
17 import org.eclipse.ui.PlatformUI;
19 public class ViewTableDetailsAction extends Action implements IViewActionDelegate {
22 public void init(IViewPart view) {
23 this.view = (BookmarkView) view;
26 public void run(IAction action) {
30 TreeNode node = (TreeNode) view.getCurrent();
31 StringBuffer query = new StringBuffer();
32 query.append("METADATA:");
33 if (node instanceof TableNode) {
34 query.append(((TableNode) node).getName());
35 } else if (node instanceof ViewNode) {
36 query.append(((ViewNode) node).getName());
40 PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
41 page.showView(TableView.TABLEVIEW_ID);
42 } catch (PartInitException e) {
44 MultiSQLServer server = MultiSQLServer.getInstance();
45 TableView.getInstance().loadQuery(server.execute(query.toString()));
47 public void selectionChanged(IAction action, ISelection selection) {