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
.dataimport
.wizard
;
12 import org
.apache
.log4j
.Logger
;
13 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
14 import org
.eclipse
.jface
.wizard
.Wizard
;
15 import org
.eclipse
.ui
.IImportWizard
;
16 import org
.eclipse
.ui
.IWorkbench
;
17 import org
.eclipse
.ui
.IWorkbenchPage
;
18 import org
.eclipse
.ui
.PartInitException
;
19 import org
.eclipse
.ui
.PlatformUI
;
21 import eu
.etaxonomy
.cdm
.ext
.biocase
.BioCaseQuery
;
22 import eu
.etaxonomy
.taxeditor
.dataimport
.DataImportEditor
;
23 import eu
.etaxonomy
.taxeditor
.dataimport
.DerivedUnitEditorInput
;
24 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
27 * Wizard for querying BioCASe provider.
32 public class SpecimenSearchWizard
extends Wizard
implements IImportWizard
{
33 @SuppressWarnings("unused")
34 private static final Logger logger
= Logger
.getLogger(SpecimenSearchWizard
.class);
36 private BioCaseQuery query
;
37 private SpecimenSearchWizardPage searchPage
;
40 * Creates a new SpecimenSearchWizard
42 public SpecimenSearchWizard() {
43 //default constructor needed for RCP extension points
45 //check if connected to a data source. If not this will open an error dialog
46 CdmStore
.getCurrentApplicationConfiguration();
51 * @see org.eclipse.jface.wizard.Wizard#performFinish()
54 public boolean performFinish() {
55 IWorkbenchPage page
= PlatformUI
.getWorkbench().getActiveWorkbenchWindow().getActivePage();
58 query
= searchPage
.getQuery();
59 DerivedUnitEditorInput input
= new DerivedUnitEditorInput(query
);
60 page
.openEditor(input
, DataImportEditor
.ID
, true);
61 } catch ( PartInitException e
) {
62 //Put your exception handler here if you wish to
68 * @see org.eclipse.jface.wizard.Wizard#addPages()
71 public void addPages() {
76 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
79 public void init(IWorkbench workbench
, IStructuredSelection selection
) {
80 query
= new BioCaseQuery();
81 searchPage
= new SpecimenSearchWizardPage("Specimen Search");
85 * Return a {@link BioCaseQuery} with the parameters entered in the wizard
88 public BioCaseQuery
getQuery() {