introduced IConstant.DEBUG flag
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.sql / src / net / sourceforge / phpdt / sql / actions / SetSchemaAction.java
1 package net.sourceforge.phpdt.sql.actions;
2
3 import org.eclipse.jface.action.Action;
4 import org.eclipse.jface.action.IAction;
5 import org.eclipse.jface.dialogs.InputDialog;
6 import org.eclipse.jface.viewers.ISelection;
7 import org.eclipse.ui.IViewActionDelegate;
8 import org.eclipse.ui.IViewPart;
9
10 import net.sourceforge.phpdt.sql.bookmarks.Bookmark;
11 import net.sourceforge.phpdt.sql.view.BookmarkView;
12
13 public class SetSchemaAction extends Action implements IViewActionDelegate {
14         BookmarkView view;
15         public void init(IViewPart view) {
16                 this.view = (BookmarkView) view;
17         }
18
19         public void run(IAction action) {
20                 run();
21         }
22         
23         public void run() {
24                 Bookmark bookmark = view.getCurrentBookmark();
25                 InputDialog dialog = new InputDialog(view.getSite().getShell(), 
26                     "Set Schema", "Please enter the name of new schema:",
27                     bookmark.getSchema(), null);
28                 dialog.open();
29                 String value = dialog.getValue();
30                 if (value != null) {
31                         bookmark.setSchema(value);
32                 }
33         }
34
35         public void selectionChanged(IAction action, ISelection selection) {
36         }
37
38 }