1 package net.sourceforge.phpdt.sql.actions;
5 import org.eclipse.jface.action.IAction;
6 import org.eclipse.jface.viewers.ISelection;
7 import org.eclipse.swt.SWT;
8 import org.eclipse.swt.widgets.FileDialog;
9 import org.eclipse.ui.IViewActionDelegate;
10 import org.eclipse.ui.IViewPart;
12 import net.sourceforge.phpdt.sql.view.BookmarkView;
13 import net.sourceforge.phpdt.sql.view.bookmark.BookmarkContentProvider;
18 * To change this generated comment edit the template variable "typecomment":
19 * Window>Preferences>Java>Templates.
20 * To enable and disable the creation of type comments go to
21 * Window>Preferences>Java>Code Generation.
23 public class ImportBookmarksAction implements IViewActionDelegate {
27 * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart)
29 public void init(IViewPart view) {
30 this.view = (BookmarkView) view;
31 dialog = new FileDialog(view.getSite().getShell(), SWT.OPEN);
32 dialog.setFilterExtensions(new String[]{"*.ini","*.*"}); //$NON-NLS-1$ //$NON-NLS-2$
33 dialog.setFilterNames(new String[]{Messages.getString("filedialog.preferences"),Messages.getString("filedialog.allfiles")}); //$NON-NLS-1$ //$NON-NLS-2$
37 * @see org.eclipse.ui.IActionDelegate#run(IAction)
39 public void run(IAction action) {
40 String filename = dialog.open();
41 if (filename != null) {
42 File importFile = new File(filename);
43 BookmarkContentProvider.getInstance().importBookmarks(importFile);
49 * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
51 public void selectionChanged(IAction action, ISelection selection) {