01: package com.quantum.flatfiles.action;
02:
03: import com.quantum.flatfiles.wizard.ExportResultSetDataWizard;
04: import com.quantum.sql.SQLResultSetResults;
05:
06: import org.eclipse.jface.action.Action;
07: import org.eclipse.jface.action.IAction;
08: import org.eclipse.jface.viewers.ISelection;
09: import org.eclipse.jface.viewers.IStructuredSelection;
10: import org.eclipse.jface.wizard.WizardDialog;
11: import org.eclipse.ui.IObjectActionDelegate;
12: import org.eclipse.ui.IWorkbenchPart;
13: import org.eclipse.ui.IWorkbenchPartSite;
14:
15: /**
16: * @author BC Holmes
17: */
18: public class ExportResultSetDataAction extends Action implements
19: IObjectActionDelegate {
20:
21: private IWorkbenchPartSite site;
22: private SQLResultSetResults resultSet;
23:
24: public void run(IAction action) {
25: if (this .resultSet != null) {
26: ExportResultSetDataWizard wizard = new ExportResultSetDataWizard(
27: this .resultSet);
28: WizardDialog dialog = new WizardDialog(
29: this .site.getShell(), wizard);
30: dialog.open();
31: }
32: }
33:
34: public void selectionChanged(IAction action, ISelection selection) {
35: this .resultSet = (SQLResultSetResults) ((IStructuredSelection) selection)
36: .getFirstElement();
37: }
38:
39: public void setActivePart(IAction action, IWorkbenchPart targetPart) {
40: this.site = targetPart.getSite();
41: }
42: }
|