Révision 3589
TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/prototypes/RenameFilesMacro.groovy (revision 3589) | ||
---|---|---|
1 |
// STANDARD DECLARATIONS |
|
2 |
package org.txm.macroproto |
|
3 |
|
|
4 |
import org.kohsuke.args4j.* |
|
5 |
import groovy.transform.Field |
|
6 |
import org.txm.rcp.swt.widget.parameters.* |
|
7 |
|
|
8 |
// BEGINNING OF PARAMETERS |
|
9 |
|
|
10 |
@Field @Option(name="inputDirectory", usage="TXT directory", widget="Folder", required=false, def="txt") |
|
11 |
File inputDirectory; |
|
12 |
|
|
13 |
// **change this parameter** |
|
14 |
@Field @Option(name="extension", usage="Regexp de l'extension des fichiers à modifier", widget="String", required=true, def='\\.txt') |
|
15 |
def extension = "\\.trs" |
|
16 |
|
|
17 |
// **change this parameter** |
|
18 |
@Field @Option(name="find", usage="Expression régulière", widget="String", required=true, def='’') |
|
19 |
def find = "Bobine" |
|
20 |
|
|
21 |
// **change this parameter** |
|
22 |
@Field @Option(name="replaceWith", usage="Chaîne de remplacement", widget="String", required=false, def='\'') |
|
23 |
def replaceWith = "" |
|
24 |
|
|
25 |
|
|
26 |
// Open the parameters input dialog box |
|
27 |
if (!ParametersDialog.open(this)) return; |
|
28 |
|
|
29 |
// END OF PARAMETERS |
|
30 |
|
|
31 |
println "In $inputDirectory..." |
|
32 |
inputDirectory.eachFileMatch(~/.*$extension/) { file -> // for each file matching extension |
|
33 |
println " renaming: "+file.getName() |
|
34 |
String name = file.getName() |
|
35 |
name = name.replaceAll(find, replaceWith) |
|
36 |
file.renameTo(new File(file.getParentFile(), name)) |
|
37 |
} |
TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/misc/RenameFilesMacro.groovy (revision 3589) | ||
---|---|---|
1 |
// STANDARD DECLARATIONS |
|
2 |
package org.txm.macro.misc |
|
3 |
|
|
4 |
import org.kohsuke.args4j.* |
|
5 |
import groovy.transform.Field |
|
6 |
import org.txm.rcp.swt.widget.parameters.* |
|
7 |
|
|
8 |
// BEGINNING OF PARAMETERS |
|
9 |
|
|
10 |
@Field @Option(name="inputDirectory",usage="TXT directory", widget="Folder", required=false, def="txt") |
|
11 |
File inputDirectory; |
|
12 |
|
|
13 |
// **change this parameter** |
|
14 |
@Field @Option(name="extension",usage="Regexp de l'extension des fichiers à modifier", widget="String", required=true, def='\\.txt') |
|
15 |
def extension = "\\.trs" |
|
16 |
|
|
17 |
// **change this parameter** |
|
18 |
@Field @Option(name="find",usage="Expression régulière", widget="String", required=true, def='’') |
|
19 |
def find = "Bobine" |
|
20 |
|
|
21 |
// **change this parameter** |
|
22 |
@Field @Option(name="replaceWith",usage="Chaîne de remplacement", widget="String", required=false, def='\'') |
|
23 |
def replaceWith = "" |
|
24 |
|
|
25 |
// Open the parameters input dialog box |
|
26 |
if (!ParametersDialog.open(this)) return; |
|
27 |
|
|
28 |
// END OF PARAMETERS |
|
29 |
|
|
30 |
println "In $inputDirectory..." |
|
31 |
inputDirectory.eachFileMatch(~/.*$extension/) { file -> // for each file matching extension |
|
32 |
println " renaming: "+file.getName() |
|
33 |
String name = file.getName() |
|
34 |
name = name.replaceAll(find, replaceWith) |
|
35 |
file.renameTo(new File(file.getParentFile(), name)) |
|
36 |
} |
TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/files/RenameFilesMacro.groovy (revision 3589) | ||
---|---|---|
1 |
// STANDARD DECLARATIONS |
|
2 |
package org.txm.macro.files |
|
3 |
|
|
4 |
import org.kohsuke.args4j.* |
|
5 |
import groovy.transform.Field |
|
6 |
import org.txm.rcp.swt.widget.parameters.* |
|
7 |
|
|
8 |
// BEGINNING OF PARAMETERS |
|
9 |
|
|
10 |
@Field @Option(name="inputDirectory", usage="TXT directory", widget="Folder", required=false, def="txt") |
|
11 |
File inputDirectory |
|
12 |
|
|
13 |
// **change this parameter** |
|
14 |
@Field @Option(name="extension", usage="Regexp de l'extension des fichiers à modifier", widget="String", required=true, def='\\.txt') |
|
15 |
def extension |
|
16 |
|
|
17 |
// **change this parameter** |
|
18 |
@Field @Option(name="find", usage="Expression régulière", widget="String", required=true, def='’') |
|
19 |
def find |
|
20 |
|
|
21 |
// **change this parameter** |
|
22 |
@Field @Option(name="replaceWith", usage="Chaîne de remplacement", widget="String", required=false, def='\'') |
|
23 |
def replaceWith = "" |
|
24 |
|
|
25 |
|
|
26 |
// Open the parameters input dialog box |
|
27 |
if (!ParametersDialog.open(this)) return; |
|
28 |
|
|
29 |
// END OF PARAMETERS |
|
30 |
|
|
31 |
println "In $inputDirectory..." |
|
32 |
inputDirectory.eachFileMatch(~/.*$extension/) { file -> // for each file matching extension |
|
33 |
println " renaming: "+file.getName() |
|
34 |
String name = file.getName() |
|
35 |
name = name.replaceAll(find, replaceWith) |
|
36 |
file.renameTo(new File(file.getParentFile(), name)) |
|
37 |
} |
TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZImporter.groovy (revision 3589) | ||
---|---|---|
4 | 4 |
|
5 | 5 |
import java.io.File; |
6 | 6 |
|
7 |
import net.sf.saxon.style.XSLParam; |
|
8 |
|
|
9 | 7 |
import org.txm.core.preferences.TBXPreferences; |
10 | 8 |
import org.txm.importer.ApplyXsl2 |
11 | 9 |
import org.txm.scripts.importer.CleanFile |
... | ... | |
110 | 108 |
this.doTokenizeStep = project.getDoTokenizerStep() |
111 | 109 |
|
112 | 110 |
//prepare metadata if any |
113 |
File allMetadataFile = Metadatas.findMetadataFile(sourceDirectory); |
|
111 |
File allMetadataFile = Metadatas.findMetadataFile(module.sourceDirectory);
|
|
114 | 112 |
if (allMetadataFile != null && allMetadataFile.exists()) { |
115 | 113 |
File copy = new File(binDir, allMetadataFile.getName()) |
116 | 114 |
if (!FileCopy.copy(allMetadataFile, copy)) { |
TXM/trunk/org.txm.groovy.core/src/java/org/txm/groovy/core/InstallGroovyFiles.java (revision 3589) | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.io.File; |
4 | 4 |
import java.io.IOException; |
5 |
import java.util.Date; |
|
5 | 6 |
|
6 |
import org.osgi.framework.Version;
|
|
7 |
import org.eclipse.osgi.util.NLS;
|
|
7 | 8 |
import org.txm.PostTXMHOMEInstallationStep; |
8 | 9 |
import org.txm.Toolbox; |
9 | 10 |
import org.txm.objects.Workspace; |
10 | 11 |
import org.txm.utils.BundleUtils; |
12 |
import org.txm.utils.DeleteDir; |
|
11 | 13 |
import org.txm.utils.io.FileCopy; |
12 | 14 |
import org.txm.utils.logger.Log; |
13 | 15 |
|
... | ... | |
82 | 84 |
// BundleUtils.copyFiles(bundle_id, "src/", "groovy/org/txm", "sw/", samplesDirectory); |
83 | 85 |
// BundleUtils.copyFiles(bundle_id, "src/", "groovy/org/txm", "tal/", samplesDirectory); |
84 | 86 |
|
87 |
|
|
85 | 88 |
String bundle_id = "org.txm.groovy.core"; //$NON-NLS-1$ |
89 |
|
|
90 |
// copy modified files in the backup directory |
|
91 |
backupFiles(userDirectory, userDirectory.getParentFile(), bundle_id); |
|
92 |
|
|
86 | 93 |
BundleUtils.copyFiles(bundle_id, "", "src/groovy", "", userDirectory, true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
94 |
BundleUtils.copyFiles(bundle_id, "", "src/groovy", "", systemDirectory, true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
|
87 | 95 |
|
88 | 96 |
bundle_id = "org.txm.core"; //$NON-NLS-1$ |
89 | 97 |
|
... | ... | |
91 | 99 |
scriptsPackageDirectory.mkdirs(); |
92 | 100 |
BundleUtils.copyFiles(bundle_id, "src/java/", "org/txm/scripts/importer", "", scriptsPackageDirectory, true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
93 | 101 |
|
102 |
return scriptsDirectory.exists(); |
|
103 |
} |
|
104 |
|
|
105 |
public static void backupFiles(File directorytoBackUp, File parentFiletoUse, String bundle_id) { |
|
94 | 106 |
|
107 |
File backUserDirectory = new File(parentFiletoUse, directorytoBackUp.getName()+"-"+Toolbox.dateformat.format(new Date())); |
|
108 |
int nBackupedFiles = 0; |
|
109 |
long updateTime = BundleUtils.getDate(bundle_id); |
|
110 |
for (File f : DeleteDir.scanDirectory(directorytoBackUp, true, true)) { |
|
111 |
long t = f.lastModified(); |
|
112 |
|
|
113 |
if (f.isFile() && f.getName().endsWith(".groovy") && t > updateTime) { |
|
114 |
|
|
115 |
String path = f.getAbsolutePath(); |
|
116 |
path = path.substring(directorytoBackUp.getAbsolutePath().length()); |
|
117 |
File backGroovy = new File(backUserDirectory, path); |
|
118 |
|
|
119 |
try { |
|
120 |
Log.fine(NLS.bind("Backing {0} -> {1}", f, backGroovy)); |
|
121 |
backGroovy.getParentFile().mkdirs(); |
|
122 |
FileCopy.copy(f, backGroovy); |
|
123 |
nBackupedFiles++; |
|
124 |
} |
|
125 |
catch (IOException e) { |
|
126 |
// TODO Auto-generated catch block |
|
127 |
e.printStackTrace(); |
|
128 |
} |
|
129 |
} |
|
130 |
} |
|
131 |
if (nBackupedFiles > 0) { |
|
132 |
Log.info(NLS.bind("Modified Groovy files saved in {0} ({1})", backUserDirectory, nBackupedFiles)); |
|
133 |
} |
|
95 | 134 |
|
96 |
return scriptsDirectory.exists(); |
|
97 | 135 |
} |
98 |
|
|
136 |
|
|
99 | 137 |
@Override |
100 | 138 |
public String getName() { |
101 | 139 |
return "Groovy (org.txm.groovy.core)"; //$NON-NLS-1$ |
TXM/trunk/org.txm.groovy.core/build.properties (revision 3589) | ||
---|---|---|
14 | 14 |
#qualifier=svn |
15 | 15 |
sourceFileExtensions=*.java, *.groovy |
16 | 16 |
compilerAdapter=org.codehaus.groovy.eclipse.ant.GroovyCompilerAdapter |
17 |
compilerAdapter.useLog=true # this ensures that exceptions are logged to the proper log file. |
|
17 |
compilerAdapter.useLog=true # this ensures that exceptions are logged to the proper log file. |
TXM/trunk/org.txm.core/src/java/org/txm/PostTXMHOMEInstallationStep.java (revision 3589) | ||
---|---|---|
36 | 36 |
Log.fine(TXMCoreMessages.bind("{0} installed version: {1}.", getName(), extinstalledVersion)); |
37 | 37 |
//System.out.println("Toolbox.startWorkspace(): workspace location = " + location); |
38 | 38 |
boolean extDoUpdateworkspace = extcurrentVersion.compareTo(extinstalledVersion) > 0; |
39 |
if (needsReinstall(workspace) || extDoUpdateworkspace) { |
|
39 |
if (needsReinstall(workspace) || extDoUpdateworkspace || "org.txm.groovy.core".equals(bundle_id)) {
|
|
40 | 40 |
Log.finer("Installing extension "+getName()+" reasons: workspace or extDoUpdateworkspace="+extDoUpdateworkspace); |
41 | 41 |
if (do_install(workspace)) { |
42 | 42 |
Toolbox.setPreference(getName(), extcurrentVersion.toString()); // SAVE the installed version |
TXM/trunk/org.txm.core/src/java/org/txm/utils/BundleUtils.java (revision 3589) | ||
---|---|---|
150 | 150 |
return copyFiles(bundle_id, source_relative_directory, file_path, file_name, outputDirectory, true); |
151 | 151 |
} |
152 | 152 |
|
153 |
public static long getDate(String bundle_id) { |
|
154 |
|
|
155 |
File bundleDir = getBundleFile(bundle_id); |
|
156 |
long l1 = bundleDir.lastModified(); |
|
157 |
|
|
158 |
Bundle bundle = Platform.getBundle(bundle_id); |
|
159 |
long l2 = bundle.getLastModified(); |
|
160 |
return Math.max(l1, l2); |
|
161 |
} |
|
162 |
|
|
153 | 163 |
/** |
154 | 164 |
* Copy a file from the bundle directory or Jar to @outputDirectory |
155 | 165 |
* |
TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/InstallURSFiles.java (revision 3589) | ||
---|---|---|
9 | 9 |
import org.txm.PostTXMHOMEInstallationStep; |
10 | 10 |
import org.txm.Toolbox; |
11 | 11 |
import org.txm.annotation.urs.preferences.URSPreferences; |
12 |
import org.txm.groovy.core.InstallGroovyFiles; |
|
12 | 13 |
import org.txm.objects.Workspace; |
13 | 14 |
import org.txm.utils.BundleUtils; |
14 | 15 |
import org.txm.utils.DeleteDir; |
... | ... | |
50 | 51 |
File macroDirectory = new File(userDirectory, "org/txm/macro"); |
51 | 52 |
File URSMacroDirectory = new File(macroDirectory, "urs"); |
52 | 53 |
|
54 |
String bundle_id = "org.txm.annotation.urs.rcp"; |
|
55 |
|
|
53 | 56 |
if (URSMacroDirectory.exists()) { |
54 |
long time = URSMacroDirectory.lastModified(); |
|
55 |
File backDirectory = new File(macroDirectory, "urs-"+Toolbox.dateformat.format(new Date(time))); |
|
56 |
Log.warning(NLS.bind("Making a copy of the {0} previous URS macros directory to {1}.", URSMacroDirectory, backDirectory)); |
|
57 |
// long time = URSMacroDirectory.lastModified(); |
|
58 |
// File backDirectory = new File(macroDirectory, "urs-"+Toolbox.dateformat.format(new Date(time))); |
|
59 |
// Log.info(NLS.bind("Making a copy of the {0} previous URS macros directory to {1}.", URSMacroDirectory, backDirectory)); |
|
60 |
// |
|
61 |
// URSMacroDirectory.renameTo(backDirectory); |
|
57 | 62 |
|
58 |
URSMacroDirectory.renameTo(backDirectory); |
|
63 |
InstallGroovyFiles.backupFiles(URSMacroDirectory, userDirectory.getParentFile(), bundle_id); |
|
64 |
|
|
59 | 65 |
DeleteDir.deleteDirectory(URSMacroDirectory); |
60 | 66 |
} |
61 | 67 |
|
62 |
String bundle_id = "org.txm.annotation.urs.rcp"; |
|
68 |
|
|
63 | 69 |
BundleUtils.copyFiles(bundle_id, "src/", "org/txm/macro", "urs", macroDirectory, true); |
64 | 70 |
|
65 | 71 |
// saving current version |
TXM/trunk/org.txm.libs.saxon/.classpath (revision 3589) | ||
---|---|---|
1 | 1 |
<?xml version="1.0" encoding="UTF-8"?> |
2 | 2 |
<classpath> |
3 |
<classpathentry kind="src" path="src"/> |
|
4 |
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> |
|
5 |
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> |
|
6 |
<classpathentry exported="true" kind="lib" path="saxon9he.jar"/> |
|
7 |
<classpathentry kind="output" path="bin"/> |
|
8 |
</classpath> |
|
3 |
<classpathentry kind="src" path="src"/> |
|
4 |
<classpathentry exported="true" kind="lib" path="lib/jline-2.14.6.jar"/> |
|
5 |
<classpathentry exported="true" kind="lib" path="lib/saxon-he-11.3.jar"/> |
|
6 |
<classpathentry exported="true" kind="lib" path="lib/xmlresolver-4.2.0-data.jar"/> |
|
7 |
<classpathentry exported="true" kind="lib" path="lib/xmlresolver-4.2.0.jar"/> |
|
8 |
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> |
|
9 |
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> |
|
10 |
<classpathentry kind="output" path="bin"/> |
|
11 |
</classpath> |
TXM/trunk/org.txm.libs.saxon/META-INF/MANIFEST.MF (revision 3589) | ||
---|---|---|
1 | 1 |
Manifest-Version: 1.0 |
2 | 2 |
Bundle-SymbolicName: org.txm.libs.saxon |
3 |
Export-Package: javax.xml.xquery,net.sf.saxon,net.sf.saxon.dom,net.sf. |
|
4 |
saxon.event,net.sf.saxon.evpull,net.sf.saxon.expr,net.sf.saxon.expr.f |
|
5 |
lwor,net.sf.saxon.expr.instruct,net.sf.saxon.expr.number,net.sf.saxon |
|
6 |
.expr.parser,net.sf.saxon.expr.sort,net.sf.saxon.functions,net.sf.sax |
|
7 |
on.functions.regex,net.sf.saxon.java,net.sf.saxon.lib,net.sf.saxon.om |
|
8 |
,net.sf.saxon.pattern,net.sf.saxon.pull,net.sf.saxon.query,net.sf.sax |
|
9 |
on.s9api,net.sf.saxon.serialize,net.sf.saxon.serialize.charcode,net.s |
|
10 |
f.saxon.serialize.codenorm,net.sf.saxon.style,net.sf.saxon.sxpath,net |
|
11 |
.sf.saxon.trace,net.sf.saxon.trans,net.sf.saxon.tree,net.sf.saxon.tre |
|
12 |
e.iter,net.sf.saxon.tree.linked,net.sf.saxon.tree.tiny,net.sf.saxon.t |
|
13 |
ree.util,net.sf.saxon.tree.wrapper,net.sf.saxon.type,net.sf.saxon.val |
|
14 |
ue,net.sf.saxon.xpath,net.sf.saxon.xqj |
|
3 |
Export-Package: net.sf.saxon, |
|
4 |
net.sf.saxon.data, |
|
5 |
net.sf.saxon.data.sef, |
|
6 |
net.sf.saxon.dom, |
|
7 |
net.sf.saxon.event, |
|
8 |
net.sf.saxon.expr, |
|
9 |
net.sf.saxon.expr.accum, |
|
10 |
net.sf.saxon.expr.compat, |
|
11 |
net.sf.saxon.expr.flwor, |
|
12 |
net.sf.saxon.expr.instruct, |
|
13 |
net.sf.saxon.expr.number, |
|
14 |
net.sf.saxon.expr.oper, |
|
15 |
net.sf.saxon.expr.parser, |
|
16 |
net.sf.saxon.expr.sort, |
|
17 |
net.sf.saxon.functions, |
|
18 |
net.sf.saxon.functions.hof, |
|
19 |
net.sf.saxon.functions.registry, |
|
20 |
net.sf.saxon.gizmo, |
|
21 |
net.sf.saxon.java, |
|
22 |
net.sf.saxon.jaxp, |
|
23 |
net.sf.saxon.lib, |
|
24 |
net.sf.saxon.ma, |
|
25 |
net.sf.saxon.ma.arrays, |
|
26 |
net.sf.saxon.ma.json, |
|
27 |
net.sf.saxon.ma.map, |
|
28 |
net.sf.saxon.ma.parray, |
|
29 |
net.sf.saxon.ma.trie, |
|
30 |
net.sf.saxon.ma.zeno, |
|
31 |
net.sf.saxon.om, |
|
32 |
net.sf.saxon.pattern, |
|
33 |
net.sf.saxon.pull, |
|
34 |
net.sf.saxon.query, |
|
35 |
net.sf.saxon.regex, |
|
36 |
net.sf.saxon.regex.charclass, |
|
37 |
net.sf.saxon.resource, |
|
38 |
net.sf.saxon.s9api, |
|
39 |
net.sf.saxon.s9api.push, |
|
40 |
net.sf.saxon.s9api.streams, |
|
41 |
net.sf.saxon.sapling, |
|
42 |
net.sf.saxon.serialize, |
|
43 |
net.sf.saxon.serialize.charcode, |
|
44 |
net.sf.saxon.stax, |
|
45 |
net.sf.saxon.str, |
|
46 |
net.sf.saxon.style, |
|
47 |
net.sf.saxon.sxpath, |
|
48 |
net.sf.saxon.trace, |
|
49 |
net.sf.saxon.trans, |
|
50 |
net.sf.saxon.trans.packages, |
|
51 |
net.sf.saxon.trans.rules, |
|
52 |
net.sf.saxon.transpile, |
|
53 |
net.sf.saxon.tree, |
|
54 |
net.sf.saxon.tree.iter, |
|
55 |
net.sf.saxon.tree.jiter, |
|
56 |
net.sf.saxon.tree.linked, |
|
57 |
net.sf.saxon.tree.tiny, |
|
58 |
net.sf.saxon.tree.util, |
|
59 |
net.sf.saxon.tree.wrapper, |
|
60 |
net.sf.saxon.type, |
|
61 |
net.sf.saxon.value, |
|
62 |
net.sf.saxon.xpath, |
|
63 |
net.sf.saxon.z |
|
15 | 64 |
Bundle-Name: Saxon |
16 |
Bundle-Version: 9 |
|
17 |
Bundle-ClassPath: .,saxon9he.jar |
|
65 |
Bundle-Version: 11 |
|
66 |
Bundle-ClassPath: ., |
|
67 |
lib/jline-2.14.6.jar, |
|
68 |
lib/saxon-he-11.3.jar, |
|
69 |
lib/xmlresolver-4.2.0-data.jar, |
|
70 |
lib/xmlresolver-4.2.0.jar |
|
18 | 71 |
Bundle-ManifestVersion: 2 |
19 | 72 |
Bundle-RequiredExecutionEnvironment: JavaSE-1.8 |
20 | 73 |
Bundle-Vendor: http://saxon.sourceforge.net/ |
TXM/trunk/org.txm.libs.saxon/build.properties (revision 3589) | ||
---|---|---|
2 | 2 |
output.. = bin/ |
3 | 3 |
bin.includes = META-INF/,\ |
4 | 4 |
.,\ |
5 |
saxon9he.jar,\ |
|
6 |
OSGI-INF/ |
|
5 |
OSGI-INF/,\ |
|
6 |
lib/jline-2.14.6.jar,\ |
|
7 |
lib/saxon-he-11.3.jar,\ |
|
8 |
lib/xmlresolver-4.2.0-data.jar,\ |
|
9 |
lib/xmlresolver-4.2.0.jar |
TXM/trunk/org.txm.utils/src/org/txm/utils/saxon/SaxonNodeSet.java (revision 3589) | ||
---|---|---|
9 | 9 |
import net.sf.saxon.expr.XPathContext; |
10 | 10 |
import net.sf.saxon.lib.ExtensionFunctionCall; |
11 | 11 |
import net.sf.saxon.lib.ExtensionFunctionDefinition; |
12 |
import net.sf.saxon.om.SequenceIterator;
|
|
12 |
import net.sf.saxon.om.Sequence; |
|
13 | 13 |
import net.sf.saxon.om.StructuredQName; |
14 | 14 |
import net.sf.saxon.trans.XPathException; |
15 | 15 |
import net.sf.saxon.value.SequenceType; |
... | ... | |
39 | 39 |
@Override |
40 | 40 |
public ExtensionFunctionCall makeCallExpression() { |
41 | 41 |
return new ExtensionFunctionCall() { |
42 |
// @Override |
|
43 |
// public SequenceIterator call(final SequenceIterator[] arguments, final XPathContext context) throws XPathException { |
|
44 |
// return arguments[0]; |
|
45 |
// } |
|
46 |
|
|
42 | 47 |
@Override |
43 |
public SequenceIterator call(final SequenceIterator[] arguments, final XPathContext context) throws XPathException {
|
|
44 |
return arguments[0];
|
|
48 |
public Sequence call(XPathContext arg0, Sequence[] arg1) throws XPathException {
|
|
49 |
return arg1[0];
|
|
45 | 50 |
} |
46 | 51 |
}; |
47 | 52 |
} |
TXM/trunk/org.txm.utils/src/org/txm/utils/logger/Log.java (revision 3589) | ||
---|---|---|
38 | 38 |
import java.util.logging.Level; |
39 | 39 |
import java.util.logging.SimpleFormatter; |
40 | 40 |
|
41 |
import org.apache.commons.lang.StringUtils; |
|
41 | 42 |
import org.txm.utils.messages.UtilsCoreMessages; |
42 | 43 |
|
43 | 44 |
/** |
... | ... | |
59 | 60 |
protected static FileHandler fh; |
60 | 61 |
|
61 | 62 |
public static int MAX_LINE_LENGTH = 1000; |
63 |
|
|
64 |
public static int MAX_NEWLINES = 10; |
|
62 | 65 |
|
63 | 66 |
/** |
64 | 67 |
* The CONSOLE flags indicates if messages with level < INFO are printed in |
... | ... | |
228 | 231 |
if (message.length()> MAX_LINE_LENGTH) { // cut if too long |
229 | 232 |
message = message.substring(0, MAX_LINE_LENGTH) + "[...]"; |
230 | 233 |
} |
231 |
message = message.replace("\n", "⏎"); |
|
234 |
if (StringUtils.countMatches(message, "\n") > MAX_NEWLINES) { |
|
235 |
message = message.replace("\n", "⏎"); |
|
236 |
} |
|
232 | 237 |
|
233 |
|
|
234 | 238 |
if (Level.SEVERE.intValue() >= txm.getLevel().intValue()) { |
235 | 239 |
System.out.println(message); |
236 | 240 |
|
TXM/trunk/org.txm.conllu.core/groovy/org/txm/scripts/importer/conllu/CoNLLUImporter.groovy (revision 3589) | ||
---|---|---|
47 | 47 |
return; |
48 | 48 |
} |
49 | 49 |
} |
50 |
File metadataFile = Metadatas.findMetadataFile(sourceDirectory) |
|
50 |
File metadataFile = Metadatas.findMetadataFile(module.sourceDirectory)
|
|
51 | 51 |
File srcDirectory = new File(outputDirectory.getParentFile().getParentFile(), "conllu2tei") |
52 | 52 |
srcDirectory.deleteDir(); |
53 | 53 |
srcDirectory.mkdirs(); |
TXM/trunk/org.txm.tigersearch.rcp/src/org/txm/tigersearch/rcp/InstallGroovyTIGERFiles.java (revision 3589) | ||
---|---|---|
5 | 5 |
|
6 | 6 |
import org.txm.PostTXMHOMEInstallationStep; |
7 | 7 |
import org.txm.Toolbox; |
8 |
import org.txm.groovy.core.InstallGroovyFiles; |
|
8 | 9 |
import org.txm.objects.Workspace; |
9 | 10 |
import org.txm.utils.BundleUtils; |
10 | 11 |
import org.txm.utils.DeleteDir; |
12 |
import org.txm.utils.logger.Log; |
|
11 | 13 |
|
12 | 14 |
public class InstallGroovyTIGERFiles extends PostTXMHOMEInstallationStep { |
13 | 15 |
|
... | ... | |
34 | 36 |
File tigerDirectory = new File(scriptsPackageDirectory, "tigersearch"); |
35 | 37 |
if (tigerDirectory.exists()) { |
36 | 38 |
File backDirectory = new File(tigerDirectory.getParentFile(), "tigersearch-"+Toolbox.dateformat.format(Calendar.getInstance().getTime())); |
37 |
System.out.println("Making a copy of previous TIGER import scripts directory: "+tigerDirectory+" to "+backDirectory); |
|
39 |
//System.out.println("Making a copy of previous TIGER import scripts directory: "+tigerDirectory+" to "+backDirectory);
|
|
38 | 40 |
tigerDirectory.renameTo(backDirectory); |
39 | 41 |
DeleteDir.deleteDirectory(tigerDirectory); |
40 | 42 |
} |
... | ... | |
45 | 47 |
BundleUtils.copyFiles(bundle_id, "groovy", "org/txm/scripts/importer", "", scriptsPackageDirectory2, true); |
46 | 48 |
|
47 | 49 |
// MACROS |
48 |
scriptsPackageDirectory = new File(userDirectory, "org/txm/macro/tiger");
|
|
49 |
scriptsPackageDirectory2 = new File(systemDirectory, "org/txm/macro/tiger");
|
|
50 |
File macrosPackageDirectory = new File(userDirectory, "org/txm/macro/tiger");
|
|
51 |
File macrosPackageDirectory2 = new File(systemDirectory, "org/txm/macro/tiger");
|
|
50 | 52 |
|
51 |
if (scriptsPackageDirectory.exists()) { |
|
52 |
File backDirectory = new File(scriptsPackageDirectory.getParentFile(), "tiger-"+Toolbox.dateformat.format(Calendar.getInstance().getTime())); |
|
53 |
System.out.println("Making a copy of previous TIGER import scripts directory: "+tigerDirectory+" to "+backDirectory); |
|
54 |
scriptsPackageDirectory.renameTo(backDirectory); |
|
55 |
DeleteDir.deleteDirectory(scriptsPackageDirectory); |
|
53 |
if (macrosPackageDirectory.exists()) { |
|
54 |
// File backDirectory = new File(scriptsPackageDirectory.getParentFile(), "tiger-"+Toolbox.dateformat.format(Calendar.getInstance().getTime())); |
|
55 |
// Log.info("Making a copy of previous TIGER import scripts directory: "+tigerDirectory+" to "+backDirectory); |
|
56 |
// scriptsPackageDirectory.renameTo(backDirectory); |
|
57 |
|
|
58 |
InstallGroovyFiles.backupFiles(macrosPackageDirectory, userDirectory.getParentFile(), bundle_id); |
|
59 |
|
|
60 |
DeleteDir.deleteDirectory(macrosPackageDirectory); |
|
56 | 61 |
} |
57 | 62 |
|
58 |
scriptsPackageDirectory.mkdirs();
|
|
59 |
scriptsPackageDirectory2.mkdirs();
|
|
60 |
BundleUtils.copyFiles(bundle_id, "groovy", "org/txm/macro/tiger", "", scriptsPackageDirectory, true);
|
|
61 |
BundleUtils.copyFiles(bundle_id, "groovy", "org/txm/macro/tiger", "", scriptsPackageDirectory2, true);
|
|
63 |
macrosPackageDirectory.mkdirs();
|
|
64 |
macrosPackageDirectory2.mkdirs();
|
|
65 |
BundleUtils.copyFiles(bundle_id, "groovy", "org/txm/macro/tiger", "", macrosPackageDirectory, true);
|
|
66 |
BundleUtils.copyFiles(bundle_id, "groovy", "org/txm/macro/tiger", "", macrosPackageDirectory2, true);
|
|
62 | 67 |
|
63 |
return scriptsPackageDirectory.exists();
|
|
68 |
return macrosPackageDirectory.exists();
|
|
64 | 69 |
} |
65 | 70 |
|
66 | 71 |
@Override |
Formats disponibles : Unified diff