Révision 1109
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/handlers/ComputeProgression.java (revision 1109) | ||
---|---|---|
69 | 69 |
// Creating from Corpus |
70 | 70 |
if (selection instanceof CQPCorpus) { |
71 | 71 |
CQPCorpus corpus = (CQPCorpus) selection; |
72 |
|
|
73 |
if (!Progression.canRunProgression(corpus)) { |
|
74 |
Log.severe(ProgressionCoreMessages.ComputeProgression_0); |
|
75 |
// La fonctionnalité Progression n'est pas encore disponible pour les sous-corpus discontinus. |
|
76 |
return null; |
|
72 |
try { |
|
73 |
corpus.compute(); |
|
74 |
if (!Progression.canRunProgression(corpus)) { |
|
75 |
Log.severe(ProgressionCoreMessages.ComputeProgression_0); |
|
76 |
// La fonctionnalité Progression n'est pas encore disponible pour les sous-corpus discontinus. |
|
77 |
return null; |
|
78 |
} |
|
79 |
progression = new Progression(corpus); |
|
80 |
} catch (Exception e) { |
|
81 |
// TODO Auto-generated catch block |
|
82 |
e.printStackTrace(); |
|
77 | 83 |
} |
78 |
progression = new Progression(corpus); |
|
79 | 84 |
} |
80 | 85 |
// Reopening an existing result |
81 | 86 |
else if (selection instanceof Progression) { |
tmp/org.txm.utils/src/org/txm/utils/zip/Zip.java (revision 1109) | ||
---|---|---|
37 | 37 |
import java.io.InputStream; |
38 | 38 |
import java.io.OutputStream; |
39 | 39 |
import java.util.ArrayList; |
40 |
import java.util.Arrays; |
|
40 | 41 |
import java.util.Collections; |
41 | 42 |
import java.util.Enumeration; |
43 |
import java.util.HashSet; |
|
44 |
import java.util.List; |
|
42 | 45 |
import java.util.zip.Deflater; |
43 | 46 |
import java.util.zip.ZipEntry; |
44 | 47 |
import java.util.zip.ZipFile; |
... | ... | |
604 | 607 |
System.out.println("Zip result: "+Zip.extractOneFile(jarFile, "R/", outDir)); |
605 | 608 |
|
606 | 609 |
} |
610 |
|
|
611 |
public static boolean hasEntries(File zipFile, String... paths) { |
|
612 |
HashSet<String> toFind = new HashSet(Arrays.asList(paths)); |
|
613 |
try { |
|
614 |
|
|
615 |
ZipInputStream zis = new ZipInputStream(new BufferedInputStream( |
|
616 |
new FileInputStream(zipFile.getCanonicalFile()))); |
|
617 |
ZipEntry ze; |
|
618 |
|
|
619 |
// Parcours tous les fichiers |
|
620 |
while (null != (ze = zis.getNextEntry())) { |
|
621 |
String currentpath = ze.getName(); |
|
622 |
String filename = currentpath; |
|
623 |
if (filename.endsWith("/")) { |
|
624 |
filename = filename.substring(0, filename.length()-1); |
|
625 |
} |
|
626 |
if (filename.lastIndexOf("/") > 0) { |
|
627 |
filename = filename.substring(filename.lastIndexOf("/")+1); |
|
628 |
} |
|
629 |
if (toFind.contains(filename)) { |
|
630 |
toFind.remove(filename); |
|
631 |
if (toFind.size() == 0) { |
|
632 |
try { |
|
633 |
zis.close(); |
|
634 |
} catch (IOException e) { |
|
635 |
e.printStackTrace(); |
|
636 |
} |
|
637 |
return true; |
|
638 |
} |
|
639 |
} |
|
640 |
} |
|
641 |
|
|
642 |
if (zis != null) { |
|
643 |
try { |
|
644 |
zis.close(); |
|
645 |
} catch (IOException e) { |
|
646 |
e.printStackTrace(); |
|
647 |
} |
|
648 |
} |
|
649 |
} catch (Exception e) { |
|
650 |
System.out.println("Fail to search for "+paths+" from "+zipFile+": "+e); |
|
651 |
Log.printStackTrace(e); |
|
652 |
} |
|
653 |
|
|
654 |
return toFind.size() == 0; |
|
655 |
} |
|
607 | 656 |
} |
608 | 657 |
|
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/MainCorpus.java (revision 1109) | ||
---|---|---|
360 | 360 |
/* (non-Javadoc) |
361 | 361 |
* @see org.txm.searchengine.cqp.corpus.Corpus#load() |
362 | 362 |
*/ |
363 |
protected boolean _load(Element e) {
|
|
363 |
public boolean _load(Element e) {
|
|
364 | 364 |
boolean ret = super._load(e); |
365 | 365 |
|
366 | 366 |
// FIXME: test to create a project scope |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/Load079BinaryCorpus.java (revision 1109) | ||
---|---|---|
1 |
// Copyright © 2010-2013 ENS de Lyon. |
|
2 |
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of |
|
3 |
// Lyon 2, University of Franche-Comté, University of Nice |
|
4 |
// Sophia Antipolis, University of Paris 3. |
|
5 |
// |
|
6 |
// The TXM platform is free software: you can redistribute it |
|
7 |
// and/or modify it under the terms of the GNU General Public |
|
8 |
// License as published by the Free Software Foundation, |
|
9 |
// either version 2 of the License, or (at your option) any |
|
10 |
// later version. |
|
11 |
// |
|
12 |
// The TXM platform is distributed in the hope that it will be |
|
13 |
// useful, but WITHOUT ANY WARRANTY; without even the implied |
|
14 |
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|
15 |
// PURPOSE. See the GNU General Public License for more |
|
16 |
// details. |
|
17 |
// |
|
18 |
// You should have received a copy of the GNU General |
|
19 |
// Public License along with the TXM platform. If not, see |
|
20 |
// http://www.gnu.org/licenses. |
|
21 |
// |
|
22 |
// |
|
23 |
// |
|
24 |
// $LastChangedDate:$ |
|
25 |
// $LastChangedRevision:$ |
|
26 |
// $LastChangedBy:$ |
|
27 |
// |
|
28 |
package org.txm.rcp.commands.workspace; |
|
29 |
|
|
30 |
import java.io.File; |
|
31 |
|
|
32 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
33 |
import org.eclipse.osgi.util.NLS; |
|
34 |
import org.txm.Toolbox; |
|
35 |
import org.txm.objects.BaseOldParameters; |
|
36 |
import org.txm.objects.Project; |
|
37 |
import org.txm.rcp.messages.TXMUIMessages; |
|
38 |
import org.txm.searchengine.cqp.corpus.MainCorpus; |
|
39 |
import org.txm.utils.logger.Log; |
|
40 |
import org.txm.utils.zip.Zip; |
|
41 |
|
|
42 |
// TODO: Auto-generated Javadoc |
|
43 |
/** |
|
44 |
* Create a base from binary files of a base. |
|
45 |
* |
|
46 |
* @author mdecorde |
|
47 |
*/ |
|
48 |
public class Load079BinaryCorpus { |
|
49 |
|
|
50 |
/** |
|
51 |
* Load a 0.7.9 binary corpus archive: |
|
52 |
* |
|
53 |
* 1- test if the corpus directory is already used |
|
54 |
* 2- delete previous corpus version |
|
55 |
* 3- unzip the archive |
|
56 |
* 4- load the binary corpus directory |
|
57 |
* 5- restart TXM engines |
|
58 |
* @throws Exception |
|
59 |
*/ |
|
60 |
public static Project loadBinaryCorpusArchive(final File zipFile, IProgressMonitor monitor) throws Exception { |
|
61 |
|
|
62 |
final File corporaDir = Toolbox.workspace.getLocation(); //$NON-NLS-1$ |
|
63 |
corporaDir.mkdir(); |
|
64 |
|
|
65 |
String basedirname = Zip.getRoot(zipFile); |
|
66 |
if (!Zip.hasEntries(zipFile, "import.xml", "data")) { |
|
67 |
return null; |
|
68 |
} |
|
69 |
|
|
70 |
//ZIPPED FILE |
|
71 |
monitor.beginTask(TXMUIMessages.AddBase_27, 100); |
|
72 |
monitor.subTask(TXMUIMessages.AddBase_28); |
|
73 |
try { |
|
74 |
//System.out.println(NLS.bind(Messages.AddBase_29, zipFile, corporaDir)); |
|
75 |
Zip.decompress(zipFile, corporaDir, false, monitor); |
|
76 |
} catch (Exception e) { |
|
77 |
System.out.println(NLS.bind(TXMUIMessages.AddBase_31, e)); |
|
78 |
org.txm.rcp.utils.Logger.printStackTrace(e); |
|
79 |
return null; |
|
80 |
} |
|
81 |
monitor.worked(50); |
|
82 |
|
|
83 |
monitor.subTask(TXMUIMessages.AddBase_32); |
|
84 |
return loadBinaryCorpusAsDirectory(new File(corporaDir, basedirname), monitor); |
|
85 |
} |
|
86 |
|
|
87 |
/** |
|
88 |
* load the content of the file if its a directory containing at least the sub folders : |
|
89 |
* txm, html, data and registry. |
|
90 |
* |
|
91 |
* @param binCorpusDirectory the basedir |
|
92 |
* @return the base |
|
93 |
* @throws Exception the exception |
|
94 |
*/ |
|
95 |
public static Project loadBinaryCorpusAsDirectory(File binCorpusDirectory, IProgressMonitor monitor) throws Exception { |
|
96 |
if (!(binCorpusDirectory.exists() && binCorpusDirectory.isDirectory())) { |
|
97 |
Log.severe(NLS.bind(TXMUIMessages.AddBase_24, binCorpusDirectory.getAbsolutePath())); |
|
98 |
System.out.println(NLS.bind(TXMUIMessages.AddBase_24, binCorpusDirectory.getAbsolutePath())); |
|
99 |
return null; |
|
100 |
} |
|
101 |
|
|
102 |
//File txmregistry = new File(Toolbox.getTxmHomePath(), "registry"); //$NON-NLS-1$ |
|
103 |
//txmregistry.mkdir(); |
|
104 |
File txmcorpora = new File(Toolbox.getTxmHomePath(), "corpora"); //$NON-NLS-1$ |
|
105 |
txmcorpora.mkdir(); |
|
106 |
Project project = Toolbox.workspace.scanDirectory079(binCorpusDirectory); |
|
107 |
if (project == null) { |
|
108 |
Log.severe(NLS.bind(TXMUIMessages.AddBase_2, binCorpusDirectory)); |
|
109 |
return null; |
|
110 |
} |
|
111 |
|
|
112 |
MainCorpus c = new MainCorpus(project); |
|
113 |
BaseOldParameters params = new BaseOldParameters(new File(project.getProjectDirectory(), "import.xml")); |
|
114 |
c._load(params.corporaElement); |
|
115 |
c.compute(); |
|
116 |
|
|
117 |
Toolbox.workspace.save(); |
|
118 |
return project; |
|
119 |
} |
|
120 |
} |
|
0 | 121 |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/LoadBinaryCorpus.java (revision 1109) | ||
---|---|---|
45 | 45 |
import org.txm.Toolbox; |
46 | 46 |
import org.txm.core.engines.EngineType; |
47 | 47 |
import org.txm.objects.Project; |
48 |
import org.txm.objects.Project; |
|
49 |
import org.txm.objects.Workspace; |
|
50 | 48 |
import org.txm.rcp.StatusLine; |
51 | 49 |
import org.txm.rcp.commands.RestartTXM; |
52 | 50 |
import org.txm.rcp.messages.TXMUIMessages; |
... | ... | |
130 | 128 |
public boolean loadBinaryCorpusArchive(final File zipFile) throws ExecutionException { |
131 | 129 |
|
132 | 130 |
String filename = zipFile.getName(); |
133 |
final File corporaDir = new File(Toolbox.getTxmHomePath(), "corpora"); //$NON-NLS-1$
|
|
131 |
final File corporaDir = Toolbox.workspace.getLocation();
|
|
134 | 132 |
corporaDir.mkdir(); |
135 | 133 |
|
136 | 134 |
if (!filename.endsWith(".txm") && !filename.endsWith(".zip")) { //$NON-NLS-1$ //$NON-NLS-2$ |
... | ... | |
146 | 144 |
|
147 | 145 |
//build binary dir path |
148 | 146 |
basedirname = Zip.getRoot(zipFile); |
147 |
|
|
149 | 148 |
corpusdir = new File(corporaDir, basedirname); |
150 | 149 |
|
151 | 150 |
if (corpusdir.exists()) { |
... | ... | |
179 | 178 |
protected IStatus run(IProgressMonitor monitor) { |
180 | 179 |
this.runInit(monitor); |
181 | 180 |
try { |
182 |
//ZIPPED FILE |
|
183 |
monitor.beginTask(TXMUIMessages.AddBase_27, 100); |
|
184 |
monitor.subTask(TXMUIMessages.AddBase_28); |
|
185 |
try { |
|
186 |
//System.out.println(NLS.bind(Messages.AddBase_29, zipFile, corporaDir)); |
|
187 |
Zip.decompress(zipFile.getAbsolutePath(), corporaDir.getAbsolutePath(), false, this); |
|
188 |
} catch (Exception e) { |
|
189 |
System.out.println(NLS.bind(TXMUIMessages.AddBase_31, e)); |
|
190 |
org.txm.rcp.utils.Logger.printStackTrace(e); |
|
191 |
return Status.CANCEL_STATUS; |
|
181 |
//CHECK ZIPPED FILE |
|
182 |
Project newProject = Load080BinaryCorpus.loadBinaryCorpus(zipFile, monitor); |
|
183 |
if (newProject == null) { |
|
184 |
newProject = Load079BinaryCorpus.loadBinaryCorpusArchive(zipFile, monitor); |
|
192 | 185 |
} |
193 |
monitor.worked(50); |
|
194 |
|
|
195 |
monitor.subTask(TXMUIMessages.AddBase_32); |
|
196 |
Project base = loadBinaryCorpusAsDirectory(new File(corporaDir, basedirname)); |
|
197 |
if (base == null) { |
|
198 |
System.out.println(TXMUIMessages.AddBase_4); |
|
199 |
return Status.CANCEL_STATUS; |
|
186 |
if (newProject == null) { |
|
187 |
System.out.println("Error: cant load corpus from file="+zipFile); |
|
188 |
return Status.CANCEL_STATUS; |
|
200 | 189 |
} |
201 |
//System.out.println("fin load base"); |
|
202 |
monitor.worked(40); |
|
203 |
monitor.subTask(TXMUIMessages.AddBase_33); |
|
204 |
|
|
205 |
this.acquireSemaphore(); |
|
206 |
//Toolbox.updateProperties(ApplicationWorkbenchAdvisor.getProperties()); |
|
207 |
org.txm.Toolbox.restartWorkspace(monitor); |
|
208 |
Toolbox.getEngineManager(EngineType.SEARCH).restartEngines(); |
|
209 |
this.releaseSemaphore(); |
|
210 |
|
|
211 |
final Project base2 = Toolbox.workspace.getProject(base.getName()); //$NON-NLS-1$ |
|
212 |
if (base2 == null) { |
|
213 |
System.out.println(TXMUIMessages.LoadBinaryCorpus_4); |
|
214 |
return null; |
|
215 |
} |
|
216 |
|
|
217 |
//TODO: restore backup step: if thecorpus load failed retrieve corpus backup |
|
218 |
// //System.out.println("New corpus list: "+base.getCorpora()); |
|
219 |
// if (base.getCorpora().size() == 0) { |
|
220 |
// System.out.println(Messages.LoadBinaryCorpus_5); |
|
221 |
// //restoreCorpus(backup, corpusdir); |
|
222 |
// } else { |
|
223 |
// for (String name : base.getCorpora().keySet()) { |
|
224 |
// Corpus corpus = base.getCorpus(name); |
|
225 |
// //System.out.println("Testing corpus with name "+name); |
|
226 |
// if (corpus == null) continue; |
|
227 |
// |
|
228 |
// try { |
|
229 |
// System.out.print(Messages.LoadBinaryCorpus_6+corpus); |
|
230 |
// corpus.getSize(); |
|
231 |
// System.out.println(Messages.LoadBinaryCorpus_0); |
|
232 |
// DeleteDir.deleteDirectory(backup); |
|
233 |
// } catch (Exception e) { |
|
234 |
// System.out.println(Messages.LoadBinaryCorpus_3+e+Messages.LoadBinaryCorpus_7); |
|
235 |
// //CQPSearchEngine.getCqiClient().dropCorpus(name); |
|
236 |
// //Log.info(NLS.bind(Messages.AddBase_23, basename.toUpperCase())); |
|
237 |
// Log.info(Log.toString(e)); |
|
238 |
// //restoreCorpus(backup, corpusdir); |
|
239 |
// } |
|
240 |
// } |
|
241 |
// } |
|
242 |
|
|
190 |
|
|
191 |
final Project newProject2 = newProject; |
|
243 | 192 |
syncExec(new Runnable() { |
244 | 193 |
@Override |
245 | 194 |
public void run() { |
246 | 195 |
RestartTXM.reloadViews(); |
247 | 196 |
//System.out.println("Select newly loaded corpus: "+base2.getCorpora().values()); |
248 |
CorporaView.select(base2.getChildren(MainCorpus.class));
|
|
197 |
CorporaView.select(newProject2.getChildren(MainCorpus.class));
|
|
249 | 198 |
System.err.println(TXMUIMessages.info_txmIsReady); |
250 | 199 |
StatusLine.setMessage(TXMUIMessages.info_txmIsReady); |
251 | 200 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/Load080BinaryCorpus.java (revision 1109) | ||
---|---|---|
1 |
// Copyright © 2010-2013 ENS de Lyon. |
|
2 |
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of |
|
3 |
// Lyon 2, University of Franche-Comté, University of Nice |
|
4 |
// Sophia Antipolis, University of Paris 3. |
|
5 |
// |
|
6 |
// The TXM platform is free software: you can redistribute it |
|
7 |
// and/or modify it under the terms of the GNU General Public |
|
8 |
// License as published by the Free Software Foundation, |
|
9 |
// either version 2 of the License, or (at your option) any |
|
10 |
// later version. |
|
11 |
// |
|
12 |
// The TXM platform is distributed in the hope that it will be |
|
13 |
// useful, but WITHOUT ANY WARRANTY; without even the implied |
|
14 |
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|
15 |
// PURPOSE. See the GNU General Public License for more |
|
16 |
// details. |
|
17 |
// |
|
18 |
// You should have received a copy of the GNU General |
|
19 |
// Public License along with the TXM platform. If not, see |
|
20 |
// http://www.gnu.org/licenses. |
|
21 |
// |
|
22 |
// |
|
23 |
// |
|
24 |
// $LastChangedDate:$ |
|
25 |
// $LastChangedRevision:$ |
|
26 |
// $LastChangedBy:$ |
|
27 |
// |
|
28 |
package org.txm.rcp.commands.workspace; |
|
29 |
|
|
30 |
import java.io.File; |
|
31 |
|
|
32 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
33 |
import org.eclipse.osgi.util.NLS; |
|
34 |
import org.txm.Toolbox; |
|
35 |
import org.txm.objects.Project; |
|
36 |
import org.txm.rcp.messages.TXMUIMessages; |
|
37 |
import org.txm.utils.logger.Log; |
|
38 |
import org.txm.utils.zip.Zip; |
|
39 |
|
|
40 |
/** |
|
41 |
* Load a project from a .txm|zip file |
|
42 |
* |
|
43 |
* @author mdecorde |
|
44 |
*/ |
|
45 |
public class Load080BinaryCorpus { |
|
46 |
|
|
47 |
/** |
|
48 |
* load the content of the file if its a directory containing at least the sub folders : |
|
49 |
* txm, html, data and registry. |
|
50 |
* |
|
51 |
* @param binCorpusDirectory the zipFile |
|
52 |
* @return the base |
|
53 |
* @throws Exception the exception |
|
54 |
*/ |
|
55 |
public static Project loadBinaryCorpus(File zipFile, IProgressMonitor monitor) throws Exception { |
|
56 |
//ZIPPED FILE |
|
57 |
if (monitor != null) monitor.beginTask(TXMUIMessages.AddBase_27, 100); |
|
58 |
if (monitor != null) monitor.subTask(TXMUIMessages.AddBase_28); |
|
59 |
|
|
60 |
String basedirname = Zip.getRoot(zipFile); |
|
61 |
|
|
62 |
if (!Zip.hasEntries(zipFile, ".settings/", ".project")) { |
|
63 |
return null; |
|
64 |
} |
|
65 |
|
|
66 |
try { |
|
67 |
//System.out.println(NLS.bind(Messages.AddBase_29, zipFile, corporaDir)); |
|
68 |
Zip.decompress(zipFile, Toolbox.workspace.getLocation(), false, monitor); |
|
69 |
} catch (Exception e) { |
|
70 |
System.out.println(NLS.bind(TXMUIMessages.AddBase_31, e)); |
|
71 |
org.txm.rcp.utils.Logger.printStackTrace(e); |
|
72 |
return null; |
|
73 |
} |
|
74 |
if (monitor != null) monitor.worked(50); |
|
75 |
|
|
76 |
if (monitor != null) monitor.subTask(TXMUIMessages.AddBase_32); |
|
77 |
Project newProject = loadBinaryCorpusAsDirectory(new File(Toolbox.workspace.getLocation(), basedirname)); |
|
78 |
if (newProject == null) { |
|
79 |
System.out.println(TXMUIMessages.AddBase_4); |
|
80 |
return null; |
|
81 |
} |
|
82 |
|
|
83 |
return newProject; |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* load the content of the file if its a directory containing at least the sub folders : |
|
88 |
* txm, html, data and registry. |
|
89 |
* |
|
90 |
* @param binCorpusDirectory the basedir must not exists |
|
91 |
* @return the base |
|
92 |
* @throws Exception the exception |
|
93 |
*/ |
|
94 |
public static Project loadBinaryCorpusAsDirectory(File binCorpusDirectory) throws Exception { |
|
95 |
if (!(binCorpusDirectory.exists() && binCorpusDirectory.isDirectory())) { |
|
96 |
Log.severe(NLS.bind(TXMUIMessages.AddBase_24, binCorpusDirectory.getAbsolutePath())); |
|
97 |
System.out.println(NLS.bind(TXMUIMessages.AddBase_24, binCorpusDirectory.getAbsolutePath())); |
|
98 |
return null; |
|
99 |
} |
|
100 |
|
|
101 |
File txmcorpora = new File(Toolbox.getTxmHomePath(), "corpora"); //$NON-NLS-1$ |
|
102 |
txmcorpora.mkdir(); |
|
103 |
Project base = Toolbox.workspace.scanDirectory(binCorpusDirectory); |
|
104 |
if (base == null) { |
|
105 |
Log.severe(NLS.bind(TXMUIMessages.AddBase_2, binCorpusDirectory)); |
|
106 |
return null; |
|
107 |
} |
|
108 |
|
|
109 |
Toolbox.workspace.save(); |
|
110 |
return base; |
|
111 |
} |
|
112 |
} |
|
0 | 113 |
tmp/org.txm.rcp/plugin.xml (revision 1109) | ||
---|---|---|
2701 | 2701 |
id="org.txm.rcp.commands.workspace.RebuildCorpus" |
2702 | 2702 |
name="Reconstruire"> |
2703 | 2703 |
</command> |
2704 |
<command |
|
2705 |
categoryId="org.txm.rcp.category.txm" |
|
2706 |
defaultHandler="org.txm.rcp.commands.workspace.LoadBinaryCorpus" |
|
2707 |
id="org.txm.rcp.commands.workspace.LoadBinaryCorpus" |
|
2708 |
name="LoadBinaryCorpus"> |
|
2709 |
</command> |
|
2704 | 2710 |
</extension> |
2705 | 2711 |
<extension |
2706 | 2712 |
point="org.eclipse.core.expressions.definitions"> |
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 1109) | ||
---|---|---|
2018 | 2018 |
public void swapUserPersistableState() { |
2019 | 2019 |
this.setUserPersistable(!this.userPersistable); |
2020 | 2020 |
} |
2021 |
|
|
2022 |
public final Project getProject() { |
|
2023 |
return (Project) this.getFirstParent(Project.class); |
|
2024 |
} |
|
2021 | 2025 |
} |
tmp/org.txm.core/src/java/org/txm/objects/Text.java (revision 1109) | ||
---|---|---|
78 | 78 |
this.setVisible(false); |
79 | 79 |
this.persistable = true; |
80 | 80 |
} |
81 |
|
|
82 |
/** |
|
83 |
* Gets the base. |
|
84 |
* |
|
85 |
* @return the base |
|
86 |
*/ |
|
87 |
public Project getProject() { |
|
88 |
return (Project) getParent(); |
|
89 |
} |
|
90 | 81 |
|
91 | 82 |
/* |
92 | 83 |
* Retro compatiblity to load Editions from a XML Element |
tmp/org.txm.core/src/java/org/txm/objects/CorpusBuild.java (revision 1109) | ||
---|---|---|
158 | 158 |
super(uuid); |
159 | 159 |
this.persistable = true; |
160 | 160 |
} |
161 |
|
|
162 |
/** |
|
163 |
* Gets the project. |
|
164 |
* |
|
165 |
* @return the project |
|
166 |
*/ |
|
167 |
public final Project getProject() { |
|
168 |
return (Project) getFirstParent(Project.class); |
|
169 |
} |
|
170 | 161 |
|
171 | 162 |
public String getID() { |
172 | 163 |
return pID; |
tmp/org.txm.core/src/java/org/txm/objects/Workspace.java (revision 1109) | ||
---|---|---|
52 | 52 |
import org.txm.utils.DeleteDir; |
53 | 53 |
import org.txm.utils.io.FileCopy; |
54 | 54 |
import org.txm.utils.logger.Log; |
55 |
import org.txm.utils.xml.DomUtils; |
|
56 |
import org.w3c.dom.Document; |
|
55 | 57 |
import org.w3c.dom.Element; |
58 |
import org.w3c.dom.NodeList; |
|
56 | 59 |
|
57 | 60 |
/** |
58 | 61 |
* The Class Workspace: manages the TXM corpora in the $TXMHOME/corpora directory |
... | ... | |
216 | 219 |
//File TXMs = new File(binCorpusDir, "txm"); //$NON-NLS-1$ |
217 | 220 |
File DATAs = new File(binCorpusDir, "data"); //$NON-NLS-1$ |
218 | 221 |
File REGISTRY = new File(binCorpusDir, "registry"); //$NON-NLS-1$ |
219 |
File PARAMS = new File(binCorpusDir, ".project"); //$NON-NLS-1$ |
|
222 |
File PARAMS = new File(binCorpusDir, ".settings"); //$NON-NLS-1$ |
|
223 |
File PROJECT = new File(binCorpusDir, ".project"); //$NON-NLS-1$ |
|
220 | 224 |
|
221 | 225 |
if (HTMLs.exists() && DATAs.exists() |
226 |
&& REGISTRY.exists() && PARAMS.exists() && PROJECT.exists())// && correspfile.exists()) |
|
227 |
{// minimal base data |
|
228 |
|
|
229 |
Project p = getProject(binCorpusDir.getName()); |
|
230 |
if (p != null) { |
|
231 |
p.delete(); |
|
232 |
} |
|
233 |
|
|
234 |
//System.out.println(parameters.toString()); |
|
235 |
Project b = new Project(this, binCorpusDir.getName()); |
|
236 |
|
|
237 |
return b; |
|
238 |
} else { |
|
239 |
System.out.println(TXMCoreMessages.bind(TXMCoreMessages.Project_26, binCorpusDir)); |
|
240 |
System.out.println(TXMCoreMessages.Project_28+HTMLs+", "+DATAs+", "+REGISTRY+TXMCoreMessages.Project_31+PARAMS); //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-1$ |
|
241 |
} |
|
242 |
return null; |
|
243 |
} |
|
244 |
|
|
245 |
/** |
|
246 |
* Scan directory: |
|
247 |
* 1- check the binary corpus format |
|
248 |
* 2- register in the workspace |
|
249 |
* |
|
250 |
* @param binCorpusDir the base |
|
251 |
* @return the base |
|
252 |
* @throws Exception |
|
253 |
*/ |
|
254 |
public Project scanDirectory079(File binCorpusDir) throws Exception { |
|
255 |
|
|
256 |
//System.out.println(Messages.Project_5); |
|
257 |
File HTMLs = new File(binCorpusDir, "HTML"); //$NON-NLS-1$ |
|
258 |
//File TXMs = new File(binCorpusDir, "txm"); //$NON-NLS-1$ |
|
259 |
File DATAs = new File(binCorpusDir, "data"); //$NON-NLS-1$ |
|
260 |
File REGISTRY = new File(binCorpusDir, "registry"); //$NON-NLS-1$ |
|
261 |
File PARAMS = new File(binCorpusDir, "import.xml"); //$NON-NLS-1$ |
|
262 |
|
|
263 |
if (HTMLs.exists() && DATAs.exists() |
|
222 | 264 |
&& REGISTRY.exists() && PARAMS.exists())// && correspfile.exists()) |
223 | 265 |
{// minimal base data |
224 | 266 |
BaseOldParameters parameters = new BaseOldParameters(PARAMS); |
... | ... | |
263 | 305 |
continue; |
264 | 306 |
} |
265 | 307 |
} |
266 |
|
|
308 |
|
|
267 | 309 |
return b; |
268 | 310 |
} else { |
269 | 311 |
System.out.println(TXMCoreMessages.bind(TXMCoreMessages.Project_26, binCorpusDir)); |
... | ... | |
272 | 314 |
return null; |
273 | 315 |
} |
274 | 316 |
|
317 |
|
|
275 | 318 |
@Override |
276 | 319 |
public boolean saveParameters() throws Exception { |
277 | 320 |
return true; |
Formats disponibles : Unified diff