package net.sourceforge.phpdt.sql.actions;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+
+import net.sourceforge.phpdt.sql.Messages;
import net.sourceforge.phpdt.sql.sql.MultiSQLServer;
import net.sourceforge.phpdt.sql.view.BookmarkView;
import net.sourceforge.phpdt.sql.view.TableView;
+import net.sourceforge.phpdt.sql.view.bookmark.BookmarkNode;
import net.sourceforge.phpdt.sql.view.bookmark.TableNode;
import net.sourceforge.phpdt.sql.view.bookmark.TreeNode;
import net.sourceforge.phpdt.sql.view.bookmark.ViewNode;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-
public class ViewTableDetailsAction extends Action implements IViewActionDelegate {
BookmarkView view;
public void run() {
TreeNode node = (TreeNode) view.getCurrent();
StringBuffer query = new StringBuffer();
- query.append("METADATA:");
+ query.append(Messages.getString("MetaDataKey")+Messages.getString("MetaDataKeySeparator")); //$NON-NLS-1$ //$NON-NLS-2$
if (node instanceof TableNode) {
query.append(((TableNode) node).getName());
} else if (node instanceof ViewNode) {
query.append(((ViewNode) node).getName());
}
- try {
- IWorkbenchPage page =
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- page.showView(TableView.TABLEVIEW_ID);
- } catch (PartInitException e) {
- }
MultiSQLServer server = MultiSQLServer.getInstance();
- TableView.getInstance().loadQuery(server.execute(query.toString()));
+ BookmarkNode current = view.getCurrentBookmark();
+
+ TableView.getInstance().loadQuery(current, server.execute(current.getConnection(), query.toString()));
}
public void selectionChanged(IAction action, ISelection selection) {
}