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 org.eclipse.swt.SWT;
|
14
|
import org.eclipse.swt.events.SelectionAdapter;
|
15
|
import org.eclipse.swt.events.SelectionEvent;
|
16
|
import org.eclipse.swt.layout.GridData;
|
17
|
import org.eclipse.swt.layout.GridLayout;
|
18
|
import org.eclipse.swt.widgets.Button;
|
19
|
import org.eclipse.swt.widgets.Composite;
|
20
|
import org.eclipse.swt.widgets.FileDialog;
|
21
|
import org.eclipse.swt.widgets.Label;
|
22
|
import org.eclipse.swt.widgets.Text;
|
23
|
|
24
|
/**
|
25
|
* <p>ImportFromFileDataSourceWizardPage class.</p>
|
26
|
*
|
27
|
* @author n.hoffmann
|
28
|
* @created 04.08.2009
|
29
|
* @version 1.0
|
30
|
*/
|
31
|
public class ImportFromFileDataSourceWizardPageFacadeImpl extends ImportFromFileDataSourceWizardPageFacade {
|
32
|
|
33
|
private FileDialog fileDialog;
|
34
|
/* (non-Javadoc)
|
35
|
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
|
36
|
*/
|
37
|
|
38
|
protected Object getInstanceInternal(String title, String description, String[] extensions)
|
39
|
{
|
40
|
ImportFromFileDataSourceWizardPageFacadeImpl INST = new ImportFromFileDataSourceWizardPageFacadeImpl();
|
41
|
INST.setTitle(title);
|
42
|
INST.setDescription(description);
|
43
|
INST.extensions = extensions;
|
44
|
return INST;
|
45
|
}
|
46
|
|
47
|
/** {@inheritDoc} */
|
48
|
public void createControlInternal(Composite parent) {
|
49
|
final Composite composite = new Composite(parent, SWT.NULL);
|
50
|
|
51
|
setPageComplete(false);
|
52
|
|
53
|
GridLayout gridLayout = new GridLayout();
|
54
|
gridLayout.numColumns = 3;
|
55
|
composite.setLayout(gridLayout);
|
56
|
|
57
|
Label folderLabel = new Label(composite, SWT.NONE);
|
58
|
folderLabel.setText("File");
|
59
|
|
60
|
fileDialog = new FileDialog(parent.getShell());
|
61
|
|
62
|
fileDialog.setFilterExtensions(extensions);
|
63
|
|
64
|
text_file = new Text(composite, SWT.BORDER);
|
65
|
text_file.setEditable(false);
|
66
|
text_file.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
|
67
|
|
68
|
|
69
|
Button button = new Button(composite, SWT.PUSH);
|
70
|
button.setText("Browse...");
|
71
|
|
72
|
button.addSelectionListener(new SelectionAdapter(){
|
73
|
|
74
|
/* (non-Javadoc)
|
75
|
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
|
76
|
*/
|
77
|
@Override
|
78
|
public void widgetSelected(SelectionEvent e) {
|
79
|
String path = fileDialog.open();
|
80
|
text_file.setText(path);
|
81
|
setPageComplete(true);
|
82
|
}
|
83
|
|
84
|
});
|
85
|
|
86
|
setControl(composite);
|
87
|
}
|
88
|
}
|