3 * Copyright (C) 2013 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.editor
.view
.dataimport
;
12 import org
.apache
.log4j
.Logger
;
13 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
14 import org
.eclipse
.core
.runtime
.IStatus
;
15 import org
.eclipse
.core
.runtime
.Status
;
16 import org
.eclipse
.core
.runtime
.jobs
.Job
;
17 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
18 import org
.eclipse
.jface
.wizard
.Wizard
;
19 import org
.eclipse
.ui
.IImportWizard
;
20 import org
.eclipse
.ui
.IWorkbench
;
21 import org
.eclipse
.ui
.IWorkbenchPage
;
22 import org
.eclipse
.ui
.PartInitException
;
23 import org
.eclipse
.ui
.PlatformUI
;
25 import eu
.etaxonomy
.cdm
.ext
.biocase
.BioCaseQuery
;
26 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
29 * Wizard for querying BioCASe provider.
34 public class SpecimenSearchWizard
extends Wizard
implements IImportWizard
{
35 @SuppressWarnings("unused")
36 private static final Logger logger
= Logger
.getLogger(SpecimenSearchWizard
.class);
38 private BioCaseQuery query
;
39 private SpecimenSearchWizardPage searchPage
;
42 * Creates a new SpecimenSearchWizard
44 public SpecimenSearchWizard() {
45 //default constructor needed for RCP extension points
47 //check if connected to a data source. If not this will open an error dialog
48 CdmStore
.getCurrentApplicationConfiguration();
49 this.setWindowTitle("Search Specimens");
54 * @see org.eclipse.jface.wizard.Wizard#performFinish()
57 public boolean performFinish() {
58 final IWorkbenchPage page
= PlatformUI
.getWorkbench().getActiveWorkbenchWindow().getActivePage();
60 query
= searchPage
.getQuery();
61 final SpecimenImportEditorInput input
= new SpecimenImportEditorInput(query
);
62 Job queryJob
= new Job("Query Biocase") {
65 protected IStatus
run(IProgressMonitor monitor
) {
67 return Status
.OK_STATUS
;
72 page
.openEditor(input
, SpecimenImportEditor
.ID
, true);
73 } catch ( PartInitException e
) {
74 //Put your exception handler here if you wish to
80 * @see org.eclipse.jface.wizard.Wizard#addPages()
83 public void addPages() {
88 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
91 public void init(IWorkbench workbench
, IStructuredSelection selection
) {
92 query
= new BioCaseQuery();
93 searchPage
= new SpecimenSearchWizardPage("Specimen Search");
97 * Return a {@link BioCaseQuery} with the parameters entered in the wizard
100 public BioCaseQuery
getQuery() {