Project

General

Profile

Download (2.59 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2013 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
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.
9
*/
10
package eu.etaxonomy.taxeditor.dataimport.wizard;
11

    
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;
20

    
21
import eu.etaxonomy.cdm.ext.biocase.BioCaseQuery;
22
import eu.etaxonomy.taxeditor.dataimport.DataImportEditor;
23
import eu.etaxonomy.taxeditor.dataimport.DataImportSpecimenEditorInput;
24

    
25
/**
26
 * Wizard for querying BioCASe provider.
27
 * @author pplitzner
28
 * @date 11.09.2013
29
 *
30
 */
31
public class SpecimenSearchWizard extends Wizard implements IImportWizard {
32
    @SuppressWarnings("unused")
33
    private static final Logger logger = Logger.getLogger(SpecimenSearchWizard.class);
34

    
35
    private BioCaseQuery query;
36
    private SpecimenSearchWizardPage searchPage;
37

    
38
    /**
39
     * Creates a new SpecimenSearchWizard
40
     */
41
    public SpecimenSearchWizard() {
42
        //default constructor needed for RCP extension points
43
    }
44

    
45

    
46
    /* (non-Javadoc)
47
     * @see org.eclipse.jface.wizard.Wizard#performFinish()
48
     */
49
    @Override
50
    public boolean performFinish() {
51
        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
52

    
53
        try {
54
            query = searchPage.getQuery();
55
            DataImportSpecimenEditorInput input = new DataImportSpecimenEditorInput(query);
56
            page.openEditor(input, DataImportEditor.ID, true);
57
        } catch ( PartInitException e ) {
58
            //Put your exception handler here if you wish to
59
        }
60
        return true;
61
    }
62

    
63
    /* (non-Javadoc)
64
     * @see org.eclipse.jface.wizard.Wizard#addPages()
65
     */
66
    @Override
67
    public void addPages() {
68
        addPage(searchPage);
69
    }
70

    
71
    /* (non-Javadoc)
72
     * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
73
     */
74
    @Override
75
    public void init(IWorkbench workbench, IStructuredSelection selection) {
76
        query = new BioCaseQuery();
77
        searchPage = new SpecimenSearchWizardPage("Specimen Search");
78
    }
79

    
80
    /**
81
     * Return a {@link BioCaseQuery} with the parameters entered in the wizard
82
     * @return the query
83
     */
84
    public BioCaseQuery getQuery() {
85
        return query;
86
    }
87

    
88
}
(1-1/2)