ExportResultSetDataAction.java :  » Database-Client » QuantumDB » com » quantum » flatfiles » action » Java Open Source

Java Open Source » Database Client » QuantumDB 
QuantumDB » com » quantum » flatfiles » action » ExportResultSetDataAction.java
package com.quantum.flatfiles.action;

import com.quantum.flatfiles.wizard.ExportResultSetDataWizard;
import com.quantum.sql.SQLResultSetResults;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite;


/**
 * @author BC Holmes
 */
public class ExportResultSetDataAction extends Action implements IObjectActionDelegate {

  private IWorkbenchPartSite site;
  private SQLResultSetResults resultSet;

  public void run(IAction action) {
    if (this.resultSet != null) {
          ExportResultSetDataWizard wizard = new ExportResultSetDataWizard(this.resultSet);
          WizardDialog dialog = new WizardDialog(this.site.getShell(), wizard);
          dialog.open();
    }
  }

  public void selectionChanged(IAction action, ISelection selection) {
    this.resultSet = (SQLResultSetResults) ((IStructuredSelection) selection).getFirstElement();
  }

  public void setActivePart(IAction action, IWorkbenchPart targetPart) {
    this.site = targetPart.getSite();
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.