1 package net.sourceforge.phpdt.sql.actions;
3 import net.sourceforge.phpdt.sql.view.BookmarkView;
4 import net.sourceforge.phpdt.sql.view.TableView;
5 import net.sourceforge.phpdt.sql.view.bookmark.TableNode;
6 import net.sourceforge.phpdt.sql.view.bookmark.TreeNode;
7 import net.sourceforge.phpdt.sql.view.bookmark.ViewNode;
9 import org.eclipse.jface.action.Action;
10 import org.eclipse.jface.action.IAction;
11 import org.eclipse.jface.viewers.ISelection;
12 import org.eclipse.ui.IViewActionDelegate;
13 import org.eclipse.ui.IViewPart;
14 import org.eclipse.ui.IWorkbenchPage;
15 import org.eclipse.ui.PartInitException;
16 import org.eclipse.ui.PlatformUI;
21 * To change this generated comment edit the template variable "typecomment":
22 * Window>Preferences>Java>Templates.
23 * To enable and disable the creation of type comments go to
24 * Window>Preferences>Java>Code Generation.
26 public class ViewTableAction extends Action implements IViewActionDelegate {
29 * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart)
31 public void init(IViewPart view) {
32 this.view = (BookmarkView) view;
36 * @see org.eclipse.ui.IActionDelegate#run(IAction)
38 public void run(IAction action) {
43 TreeNode node = (TreeNode) view.getCurrent();
45 if (node instanceof TableNode) {
46 name = ((TableNode) node).getName();
47 } else if (node instanceof ViewNode) {
48 name = ((ViewNode) node).getName();
53 PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
54 page.showView(TableView.TABLEVIEW_ID);
55 } catch (PartInitException e) {
57 TableView.getInstance().loadTable(name);
61 * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
63 public void selectionChanged(IAction action, ISelection selection) {