2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.printpublisher
.wizard
;
14 import org
.eclipse
.swt
.SWT
;
15 import org
.eclipse
.swt
.events
.SelectionAdapter
;
16 import org
.eclipse
.swt
.events
.SelectionEvent
;
17 import org
.eclipse
.swt
.layout
.GridData
;
18 import org
.eclipse
.swt
.layout
.GridLayout
;
19 import org
.eclipse
.swt
.widgets
.Button
;
20 import org
.eclipse
.swt
.widgets
.Composite
;
21 import org
.eclipse
.swt
.widgets
.DirectoryDialog
;
22 import org
.eclipse
.swt
.widgets
.Label
;
23 import org
.eclipse
.swt
.widgets
.Text
;
26 * <p>SelectFolderWizardPage class.</p>
29 * @created Apr 7, 2010
32 public class SelectDirectoryWizardPage
extends AbstractPublishWizardPage
implements IHasPersistableSettings
{
33 private static final String DIALOG_SETTING_OUTPUT_DIRECTORY
= "dialogSettingOutputDirectory";
34 private Composite composite
;
35 private DirectoryDialog folderDialog
;
36 private Text text_folder
;
39 * <p>Constructor for SelectFolderWizardPage.</p>
41 * @param pageName a {@link java.lang.String} object.
43 public SelectDirectoryWizardPage(String pageName
) {
45 setTitle("Select a folder");
49 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
52 public void createControl(Composite parent
) {
53 // configurator = ((IPublishConfigurer) getWizard()).getConfigurator();
55 composite
= new Composite(parent
, SWT
.NULL
);
56 composite
.setLayout(new GridLayout());
58 Label folderLabel
= new Label(composite
, SWT
.NONE
);
59 folderLabel
.setText("Folder");
61 folderDialog
= new DirectoryDialog(parent
.getShell());
63 text_folder
= new Text(composite
, SWT
.BORDER
);
64 text_folder
.setEditable(false);
65 text_folder
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
67 Button button
= new Button(composite
, SWT
.PUSH
);
68 button
.setText("Browse...");
70 button
.addSelectionListener(new SelectionAdapter(){
72 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
75 public void widgetSelected(SelectionEvent e
) {
76 super.widgetSelected(e
);
77 String path
= folderDialog
.open();
78 if(path
!= null){ // a folder was selected
86 setControl(composite
);
90 public void loadSettings() {
91 String directory
= getDialogSettingValue(DIALOG_SETTING_OUTPUT_DIRECTORY
);
93 if(directory
!= null){
94 setDirectory(directory
);
98 private void setDirectory(String directory
){
99 text_folder
.setText(directory
);
100 getConfigurator().setExportFolder(new File(directory
));
102 putDialogSettingValue(DIALOG_SETTING_OUTPUT_DIRECTORY
, directory
);
104 setPageComplete(true);
109 public boolean isPageComplete() {
110 return getConfigurator().getExportFolder() != null;