1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2007 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
|
|
11
|
package eu.etaxonomy.taxeditor.singlesource.io.wizard;
|
12
|
|
13
|
import java.io.File;
|
14
|
import java.net.URI;
|
15
|
|
16
|
import javax.naming.OperationNotSupportedException;
|
17
|
|
18
|
import org.apache.log4j.Logger;
|
19
|
import org.eclipse.jface.wizard.WizardPage;
|
20
|
import org.eclipse.swt.widgets.Composite;
|
21
|
import org.eclipse.swt.widgets.Text;
|
22
|
|
23
|
import eu.etaxonomy.taxeditor.singlesource.ImplementationLoader;
|
24
|
|
25
|
/**
|
26
|
* <p>ImportFromFileDataSourceWizardPage class.</p>
|
27
|
*
|
28
|
* @author n.hoffmann
|
29
|
* @created 04.08.2009
|
30
|
* @version 1.0
|
31
|
*/
|
32
|
public abstract class ImportFromFileDataSourceWizardPageFacade extends WizardPage {
|
33
|
private static final Logger logger = Logger.getLogger(ExportToFileDestinationWizardPageFacade.class);
|
34
|
|
35
|
protected static final ImportFromFileDataSourceWizardPageFacade IMPL;
|
36
|
static {
|
37
|
IMPL = (ImportFromFileDataSourceWizardPageFacade)ImplementationLoader.newInstance(ImportFromFileDataSourceWizardPageFacade.class);
|
38
|
}
|
39
|
|
40
|
/** Constant <code>PAGE_NAME="CdmXmlDataSourceWizardPage"</code> */
|
41
|
public static final String PAGE_NAME = "CdmXmlDataSourceWizardPage";
|
42
|
|
43
|
protected String[] extensions = {"*.xml"};
|
44
|
|
45
|
protected Text text_file;
|
46
|
|
47
|
|
48
|
protected ImportFromFileDataSourceWizardPageFacade() {
|
49
|
super(PAGE_NAME);
|
50
|
}
|
51
|
|
52
|
/**
|
53
|
* <p>Constructor for ImportFromFileDataSourceWizardPage.</p>
|
54
|
*
|
55
|
* @param title a {@link java.lang.String} object.
|
56
|
* @param description a {@link java.lang.String} object.
|
57
|
* @param extensions an array of {@link java.lang.String} objects.
|
58
|
*/
|
59
|
public static ImportFromFileDataSourceWizardPageFacade getInstance(String title, String description, String[] extensions) {
|
60
|
return (ImportFromFileDataSourceWizardPageFacade) IMPL.getInstanceInternal(title,description,extensions);
|
61
|
}
|
62
|
|
63
|
protected abstract Object getInstanceInternal(String title, String description, String[] extensions);
|
64
|
/**
|
65
|
* <p>XML</p>
|
66
|
*
|
67
|
* @return a {@link eu.etaxonomy.taxeditor.singlesource.io.wizard.ImportFromFileDataSourceWizardPageFacade} object.
|
68
|
*/
|
69
|
public static ImportFromFileDataSourceWizardPageFacade XML(){
|
70
|
return getInstance("Xml File", "Select XML file.", new String[]{"*.xml"});
|
71
|
}
|
72
|
|
73
|
|
74
|
|
75
|
/* (non-Javadoc)
|
76
|
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
|
77
|
*/
|
78
|
/** {@inheritDoc} */
|
79
|
public void createControl(Composite parent) {
|
80
|
try {
|
81
|
createControlInternal(parent);
|
82
|
} catch (OperationNotSupportedException e) {
|
83
|
logger.warn("ImportFromFileDataSourceWizardPageFacade.createControl currently not supported !");
|
84
|
}
|
85
|
|
86
|
}
|
87
|
|
88
|
public abstract void createControlInternal(Composite parent) throws OperationNotSupportedException;
|
89
|
|
90
|
/**
|
91
|
* <p>getFile</p>
|
92
|
*
|
93
|
* @return a {@link java.io.File} object.
|
94
|
*/
|
95
|
public File getFile() {
|
96
|
return new File(text_file.getText());
|
97
|
}
|
98
|
|
99
|
/**
|
100
|
* <p>getUri</p>
|
101
|
*
|
102
|
* @return a {@link java.net.URI} object.
|
103
|
*/
|
104
|
public URI getUri() {
|
105
|
return getFile().toURI();
|
106
|
}
|
107
|
|
108
|
}
|