Project

General

Profile

Download (3.07 KB) Statistics
| Branch: | Tag: | Revision:
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.DirectoryDialog;
21
import org.eclipse.swt.widgets.Label;
22
import org.eclipse.swt.widgets.Text;
23

    
24
/**
25
 * <p>
26
 * ExportToFileDestinationWizardPage class.
27
 * </p>
28
 * 
29
 * @author n.hoffmann
30
 * @created 15.06.2009
31
 * @version 1.0
32
 */
33
public class ExportToFileDestinationWizardPageFacadeImpl extends ExportToFileDestinationWizardPageFacade {
34

    
35
	private DirectoryDialog folderDialog;
36
	
37
	public ExportToFileDestinationWizardPageFacadeImpl() {
38
		super();
39
	}
40
	
41
	private ExportToFileDestinationWizardPageFacadeImpl(String pageName) {
42
		super(pageName);
43
	}
44

    
45
	protected Object getInstanceInternal(String pageName, String type, String title, String description, String extension)
46
	{
47
		ExportToFileDestinationWizardPageFacadeImpl INST = new ExportToFileDestinationWizardPageFacadeImpl(pageName); 
48
		INST.type = type;
49
		INST.extension = extension;
50
		INST.setTitle(title);
51
		INST.setDescription(description);
52
		return INST;
53
	}
54

    
55
	/*
56
	 * (non-Javadoc)
57
	 * 
58
	 * @see
59
	 * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
60
	 * .Composite)
61
	 */
62
	/** {@inheritDoc} */
63
	public void createControlInternal(Composite parent) {
64

    
65
		setPageComplete(false);
66

    
67
		Composite composite = new Composite(parent, SWT.NONE);
68
		GridLayout gridLayout = new GridLayout();
69
		gridLayout.numColumns = 3;
70
		composite.setLayout(gridLayout);
71

    
72
		Label fileLabel = new Label(composite, SWT.NONE);
73
		fileLabel.setText("File");
74

    
75
		text_exportFileName = new Text(composite, SWT.BORDER);
76
		text_exportFileName.setText(generateFilename());
77
		text_exportFileName.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
78
				true, false, 2, 1));
79

    
80
		Label folderLabel = new Label(composite, SWT.NONE);
81
		folderLabel.setText("Folder");
82

    
83
		folderDialog = new DirectoryDialog(parent.getShell());
84

    
85
		text_folder = new Text(composite, SWT.BORDER);
86
		text_folder.setEditable(false);
87
		text_folder.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
88
				false));
89

    
90
		Button button = new Button(composite, SWT.PUSH);
91
		button.setText("Browse...");
92

    
93
		button.addSelectionListener(new SelectionAdapter() {
94
			/*
95
			 * (non-Javadoc)
96
			 * 
97
			 * @see
98
			 * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse
99
			 * .swt.events.SelectionEvent)
100
			 */
101
			@Override
102
			public void widgetSelected(SelectionEvent e) {
103
				super.widgetSelected(e);
104
				String path = folderDialog.open();
105
				if (path != null) { // a folder was selected
106
					text_folder.setText(path);
107
					setPageComplete(true);
108
				}
109
			}
110
		});
111

    
112
		setControl(composite);
113
	}
114
}
(1-1/2)