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 java
.io
.IOException
;
13 import java
.net
.URISyntaxException
;
14 import java
.util
.List
;
16 import org
.apache
.http
.client
.ClientProtocolException
;
17 import org
.apache
.log4j
.Logger
;
18 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
19 import org
.eclipse
.jface
.wizard
.Wizard
;
20 import org
.eclipse
.ui
.IImportWizard
;
21 import org
.eclipse
.ui
.IWorkbench
;
22 import org
.eclipse
.ui
.IWorkbenchPage
;
23 import org
.eclipse
.ui
.PartInitException
;
24 import org
.eclipse
.ui
.PlatformUI
;
26 import eu
.etaxonomy
.cdm
.ext
.biocase
.BioCaseQuery
;
27 import eu
.etaxonomy
.cdm
.ext
.biocase
.BioCaseQueryServiceWrapper
;
28 import eu
.etaxonomy
.cdm
.model
.occurrence
.SpecimenOrObservationBase
;
29 import eu
.etaxonomy
.taxeditor
.dataimport
.DataImportEditor
;
30 import eu
.etaxonomy
.taxeditor
.dataimport
.SpecimenEditorInput
;
37 public class SpecimenSearchWizard
extends Wizard
implements IImportWizard
{
38 private static final Logger logger
= Logger
.getLogger(SpecimenSearchWizard
.class);
40 private BioCaseQueryServiceWrapper bioCaseQueryServiceWrapper
;
41 private BioCaseQuery query
;
42 private List
<SpecimenOrObservationBase
> results
;
47 public SpecimenSearchWizard() {
48 query
= new BioCaseQuery();
49 bioCaseQueryServiceWrapper
= new BioCaseQueryServiceWrapper();
50 this.results
= getResults();
55 * @see org.eclipse.jface.wizard.Wizard#performFinish()
58 public boolean performFinish() {
59 IWorkbenchPage page
= PlatformUI
.getWorkbench().getActiveWorkbenchWindow().getActivePage();
62 SpecimenEditorInput input
= new SpecimenEditorInput(results
);
63 input
.getToolTipText();
64 page
.openEditor(input
, DataImportEditor
.ID
, true);
65 } catch ( PartInitException e
) {
66 //Put your exception handler here if you wish to
72 * @see org.eclipse.jface.wizard.Wizard#addPages()
75 public void addPages() {
76 addPage(new SpecimenSearchWizardPage("Specimen Search", results
));
79 public List
<SpecimenOrObservationBase
> getResults(){
81 return bioCaseQueryServiceWrapper
.query(query
);
82 } catch (ClientProtocolException e
) {
83 // TODO Auto-generated catch block
85 } catch (IOException e
) {
86 // TODO Auto-generated catch block
88 } catch (URISyntaxException e
) {
89 // TODO Auto-generated catch block
96 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
99 public void init(IWorkbench workbench
, IStructuredSelection selection
) {
105 public BioCaseQuery
getQuery() {