1) Added missing strings for italic, underline and strike through.
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.sql / src / net / sourceforge / phpdt / sql / actions / ConnectAction.java
1 package net.sourceforge.phpdt.sql.actions;
2
3 import java.sql.Connection;
4
5 import org.eclipse.jface.action.Action;
6 import org.eclipse.jface.action.IAction;
7 import org.eclipse.jface.viewers.ISelection;
8 import org.eclipse.ui.IViewActionDelegate;
9 import org.eclipse.ui.IViewPart;
10 import org.eclipse.ui.IWorkbenchPart;
11
12 import net.sourceforge.phpdt.sql.Messages;
13 import net.sourceforge.phpdt.sql.view.BookmarkView;
14 import net.sourceforge.phpdt.sql.view.bookmark.BookmarkNode;
15
16 public class ConnectAction extends Action implements IViewActionDelegate {
17         private BookmarkView view;
18         /**
19          * Constructor for Action1.
20          */
21         public ConnectAction() {
22                 super();
23         }
24
25         /**
26          * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
27          */
28         public void setActivePart(IAction action, IWorkbenchPart targetPart) {
29         }
30
31         /**
32          * @see IActionDelegate#run(IAction)
33          */
34         public void run(IAction action) {
35                 run();
36         }
37
38         /**
39          * @see IActionDelegate#selectionChanged(IAction, ISelection)
40          */
41         public void selectionChanged(IAction action, ISelection selection) {
42         }
43
44         /**
45          * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart)
46          */
47         public void init(IViewPart view) {
48                 this.view = (BookmarkView) view;
49         }
50
51         /**
52          * @see org.eclipse.jface.action.IAction#run()
53          */
54         public void run() {
55                 BookmarkNode current = view.getCurrentBookmark();
56                 view.setStatus(Messages.getString("ConnectAction.ConnectingTo") + current.getName() + "...");  //$NON-NLS-2$ //$NON-NLS-1$
57                 Connection con = current.getConnection();
58                 if (con != null) {
59                         view.refreshBookmarkData();
60                         view.expandCurrent(current);
61                 } else {
62                         view.setStatus(Messages.getString("ConnectAction.ErrorConnecting") + current.getName());  //$NON-NLS-1$
63                 }
64         }
65 }