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 ExportBookmarksAction
24 implements IViewActionDelegate {
30 * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart)
32 public void init(IViewPart view) {
33 this.view = (BookmarkView) view;
34 dialog = new FileDialog(view.getSite().getShell(), SWT.SAVE);
35 dialog.setFilterExtensions(new String[]{"*.ini","*.*"}); //$NON-NLS-1$ //$NON-NLS-2$
36 dialog.setFilterNames(new String[]{Messages.getString("filedialog.preferences"),Messages.getString("filedialog.allfiles")}); //$NON-NLS-1$ //$NON-NLS-2$
40 * @see org.eclipse.ui.IActionDelegate#run(IAction)
42 public void run(IAction action) {
43 String filename = dialog.open();
44 if (filename != null) {
45 File exportFile = new File(filename);
46 BookmarkContentProvider.getInstance().save(exportFile);
51 * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
53 public void selectionChanged(IAction action, ISelection selection) {