10 |
10 |
|
11 |
11 |
package eu.etaxonomy.taxeditor.io.wizard;
|
12 |
12 |
|
|
13 |
import java.io.File;
|
|
14 |
import java.net.URI;
|
|
15 |
|
13 |
16 |
import org.eclipse.jface.wizard.WizardPage;
|
14 |
17 |
import org.eclipse.swt.SWT;
|
|
18 |
import org.eclipse.swt.events.SelectionAdapter;
|
|
19 |
import org.eclipse.swt.events.SelectionEvent;
|
15 |
20 |
import org.eclipse.swt.layout.GridData;
|
16 |
21 |
import org.eclipse.swt.layout.GridLayout;
|
17 |
22 |
import org.eclipse.swt.widgets.Button;
|
18 |
23 |
import org.eclipse.swt.widgets.Composite;
|
19 |
24 |
import org.eclipse.swt.widgets.Event;
|
|
25 |
import org.eclipse.swt.widgets.FileDialog;
|
20 |
26 |
import org.eclipse.swt.widgets.Label;
|
21 |
27 |
import org.eclipse.swt.widgets.Listener;
|
22 |
28 |
import org.eclipse.swt.widgets.Text;
|
... | ... | |
36 |
42 |
|
37 |
43 |
public static final String PAGE_NAME = "ClassificationChooserWizardPage";
|
38 |
44 |
|
|
45 |
//classification
|
39 |
46 |
private Text textClassification;
|
40 |
47 |
private Classification classification;
|
41 |
48 |
private Button btnBrowseClassification;
|
42 |
49 |
|
43 |
50 |
private Button btnClear;
|
44 |
51 |
|
|
52 |
//report
|
|
53 |
private FileDialog fileDialogReport;
|
|
54 |
private Text textFileReport;
|
|
55 |
|
45 |
56 |
/**
|
46 |
57 |
* <p>Constructor for ImportFromFileDataSourceWizardPage.</p>
|
47 |
58 |
*
|
... | ... | |
64 |
75 |
* @return a {@link eu.etaxonomy.taxeditor.io.wizard.ClassificationChooserWizardPage} object.
|
65 |
76 |
*/
|
66 |
77 |
protected static ClassificationChooserWizardPage createPage(){
|
67 |
|
return new ClassificationChooserWizardPage("Choose Classification", "Note: Selecting no classification will create a default one.");
|
|
78 |
return new ClassificationChooserWizardPage("Configure import destinations", "Note: Selecting no classification will create a default one.");
|
68 |
79 |
}
|
69 |
80 |
|
70 |
81 |
|
... | ... | |
81 |
92 |
gridLayout.numColumns = 4;
|
82 |
93 |
composite.setLayout(gridLayout);
|
83 |
94 |
|
|
95 |
//classification
|
84 |
96 |
Label label = new Label(composite, SWT.NONE);
|
85 |
97 |
label.setText("Classification");
|
86 |
98 |
textClassification = new Text(composite, SWT.NONE);
|
... | ... | |
93 |
105 |
btnClear.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
|
94 |
106 |
btnClear.addListener(SWT.Selection, this);
|
95 |
107 |
|
|
108 |
//report
|
|
109 |
Label labelReportFile = new Label(composite, SWT.NONE);
|
|
110 |
labelReportFile.setText("Report File");
|
|
111 |
|
|
112 |
fileDialogReport = new FileDialog(parent.getShell());
|
|
113 |
|
|
114 |
fileDialogReport.setFilterExtensions(new String[]{"*.*"});
|
|
115 |
|
|
116 |
textFileReport = new Text(composite, SWT.BORDER);
|
|
117 |
textFileReport.setEditable(false);
|
|
118 |
textFileReport.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
|
|
119 |
|
|
120 |
|
|
121 |
Button buttonReport = new Button(composite, SWT.PUSH);
|
|
122 |
buttonReport.setText("Browse...");
|
|
123 |
|
|
124 |
buttonReport.addSelectionListener(new SelectionAdapter(){
|
|
125 |
|
|
126 |
/* (non-Javadoc)
|
|
127 |
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
|
|
128 |
*/
|
|
129 |
@Override
|
|
130 |
public void widgetSelected(SelectionEvent e) {
|
|
131 |
String path = fileDialogReport.open();
|
|
132 |
if(path!=null){
|
|
133 |
textFileReport.setText(path);
|
|
134 |
setPageComplete(true);
|
|
135 |
}
|
|
136 |
}
|
|
137 |
|
|
138 |
});
|
|
139 |
|
96 |
140 |
setControl(composite);
|
97 |
141 |
}
|
98 |
142 |
|
... | ... | |
113 |
157 |
}
|
114 |
158 |
}
|
115 |
159 |
|
116 |
|
|
117 |
160 |
/**
|
118 |
161 |
* @return the classification
|
119 |
162 |
*/
|
120 |
163 |
public Classification getClassification() {
|
121 |
164 |
return classification;
|
122 |
165 |
}
|
|
166 |
|
|
167 |
public URI getReportUri(){
|
|
168 |
return new File(textFileReport.getText()).toURI();
|
|
169 |
}
|
123 |
170 |
}
|