Révision 2754
tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/dialogs/ExportCorpusDialog.java (revision 2754) | ||
---|---|---|
4 | 4 |
import java.io.File; |
5 | 5 |
import java.io.FileFilter; |
6 | 6 |
import java.util.Arrays; |
7 |
import java.util.Calendar; |
|
7 | 8 |
import java.util.Comparator; |
8 | 9 |
import java.util.HashSet; |
9 | 10 |
import java.util.LinkedHashMap; |
... | ... | |
31 | 32 |
import org.eclipse.swt.widgets.TableItem; |
32 | 33 |
import org.eclipse.swt.widgets.Text; |
33 | 34 |
import org.txm.Toolbox; |
35 |
import org.txm.core.results.TXMResult; |
|
34 | 36 |
import org.txm.objects.Project; |
35 | 37 |
import org.txm.rcp.swt.dialog.LastOpened; |
36 | 38 |
import org.txm.searchengine.cqp.corpus.CQPCorpus; |
... | ... | |
42 | 44 |
*/ |
43 | 45 |
public class ExportCorpusDialog extends Dialog { |
44 | 46 |
|
45 |
private List<String> defaultFiles = Arrays.asList("HTML", "txm", "data", "registry", "annotations", "analec", "temporary_annotations"); |
|
47 |
/** |
|
48 |
* list of the default files to include in the corpus binary |
|
49 |
*/ |
|
50 |
private List<String> defaultFiles = Arrays.asList("HTML", "txm", "data", "registry", "annotations", "analec", "temporary_annotations", ".settings", ".project"); |
|
46 | 51 |
|
47 | 52 |
private File zipFile; |
48 | 53 |
|
... | ... | |
60 | 65 |
|
61 | 66 |
public final static String ID = ExportCorpusDialog.class.getName(); |
62 | 67 |
|
63 |
private static String lastopenedfile; |
|
64 |
|
|
65 | 68 |
/** |
66 | 69 |
* |
67 | 70 |
* @param parentShell |
... | ... | |
101 | 104 |
|
102 | 105 |
textField = new Text(comp, SWT.SINGLE | SWT.BORDER); |
103 | 106 |
textField.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); |
107 |
textField.setText(Toolbox.getTxmHomePath() + "/" + corpus.getName() + "-" + Toolbox.shortUKDateformat.format(Calendar.getInstance().getTime()) + ".txm"); //$NON-NLS-1$ |
|
104 | 108 |
|
105 | 109 |
selectButton = new Button(comp, SWT.PUSH); |
106 | 110 |
selectButton.setText("..."); |
... | ... | |
108 | 112 |
|
109 | 113 |
@Override |
110 | 114 |
public void widgetSelected(SelectionEvent e) { |
111 |
FileDialog dialog = new FileDialog(selectButton.getShell()); |
|
115 |
FileDialog dialog = new FileDialog(selectButton.getShell(), SWT.SAVE);
|
|
112 | 116 |
|
113 | 117 |
String[] exts = { "*.txm", "*.zip" }; //$NON-NLS-1$ //$NON-NLS-2$ |
114 | 118 |
dialog.setFilterExtensions(exts); |
115 |
if (LastOpened.getFile(ID) != null) { |
|
116 |
lastopenedfile = LastOpened.getFolder(ID) + "/" + LastOpened.getFile(ID); //$NON-NLS-1$ |
|
117 |
} |
|
118 |
else if (lastopenedfile != null) { |
|
119 |
dialog.setFilterPath(new File(lastopenedfile).getAbsolutePath()); |
|
120 |
} |
|
121 |
else { |
|
122 |
dialog.setFilterPath(Toolbox.getTxmHomePath() + "/samples"); //$NON-NLS-1$ |
|
123 |
} |
|
119 |
dialog.setFilterPath(textField.getText()); |
|
120 |
dialog.setFileName(textField.getText()); |
|
124 | 121 |
|
125 |
dialog.setFileName(corpus.getName() + ".txm"); |
|
126 |
|
|
127 | 122 |
String path = dialog.open(); |
128 | 123 |
if (path != null) { |
129 | 124 |
textField.setText(path); |
130 | 125 |
getButton(IDialogConstants.OK_ID).setEnabled(true); |
131 | 126 |
} |
132 | 127 |
else { |
133 |
textField.setText(""); |
|
134 | 128 |
getButton(IDialogConstants.OK_ID).setEnabled(false); |
135 | 129 |
} |
136 | 130 |
} |
... | ... | |
238 | 232 |
}); |
239 | 233 |
|
240 | 234 |
Button clearAllButton = new Button(comp, SWT.PUSH); |
241 |
clearAllButton.setText("Deselect All");
|
|
235 |
clearAllButton.setText("Clear selection");
|
|
242 | 236 |
clearAllButton.addSelectionListener(new SelectionListener() { |
243 | 237 |
|
244 | 238 |
@Override |
Formats disponibles : Unified diff