Révision 2983

tmp/org.txm.oriflamms.rcp/groovy/org/txm/macro/oriflamms/prepare/Project2XTZMacro.groovy (revision 2983)
93 93

  
94 94
for (File xmlFile : xmlFiles) {
95 95
	if (xmlFile.getName().endsWith("-w.xml")) {
96
		String name = xmlFile.getName().substring(0, xmlFile.getName().indexOf(".xml"))
96
		String name = xmlFile.getName().substring(0, xmlFile.getName().lastIndexOf(".xml"))
97 97
		wDirectory = new File(txmDirectory, name)
98 98
		wFile = xmlFile
99 99
	} else if (xmlFile.getName().endsWith("-c.xml")) {
100
		String name = xmlFile.getName().substring(0, xmlFile.getName().indexOf(".xml"))
100
		String name = xmlFile.getName().substring(0, xmlFile.getName().lastIndexOf(".xml"))
101 101
		cDirectory = new File(txmDirectory, name)
102 102
		cFile = xmlFile
103 103
	}
tmp/org.txm.oriflamms.rcp/groovy/org/txm/macro/oriflamms/prepare/CoordsProjection.groovy (revision 2983)
31 31
		this.wordTag = wordTag;
32 32

  
33 33
		textname = xmlFile.getName()
34
		int idx = textname.indexOf(".xml")
34
		int idx = textname.lastIndexOf(".xml")
35 35
		if (idx > 0) textname = textname.substring(0, idx)
36 36

  
37 37
		idx = textname.indexOf("-w")
tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/CoordsProjection.java (revision 2983)
37 37
		this.wordTag = wordTag;
38 38

  
39 39
		textname = xmlFile.getName();
40
		int idx = textname.indexOf(".xml");
40
		int idx = textname.lastIndexOf(".xml");
41 41
		if (idx > 0) textname = textname.substring(0, idx);
42 42

  
43 43
		idx = textname.indexOf("-w");
tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/Project2XTZ.java (revision 2983)
100 100

  
101 101
		for (File xmlFile : xmlFiles) {
102 102
			if (xmlFile.getName().endsWith("-w.xml")) {
103
				String name = xmlFile.getName().substring(0, xmlFile.getName().indexOf(".xml"));
103
				String name = xmlFile.getName().substring(0, xmlFile.getName().lastIndexOf(".xml"));
104 104
				wDirectory = new File(txmDirectory, name);
105 105
				wFile = xmlFile;
106 106
			} else if (xmlFile.getName().endsWith("-c.xml")) {
107
				String name = xmlFile.getName().substring(0, xmlFile.getName().indexOf(".xml"));
107
				String name = xmlFile.getName().substring(0, xmlFile.getName().lastIndexOf(".xml"));
108 108
				cDirectory = new File(txmDirectory, name);
109 109
				cFile = xmlFile;
110 110
			}
tmp/org.txm.treetagger.rcp/src/org/txm/treetagger/rcp/handlers/Apply.java (revision 2983)
93 93
			System.out.println("Model file name must ends with the '.par' extension");
94 94
			return;
95 95
		}
96
		lang = lang.substring(0, lang.indexOf(".par"));
96
		lang = lang.substring(0, lang.lastIndexOf(".par"));
97 97
		
98 98
		final HashMap<String, String> hash = new HashMap<String, String>();
99 99
		for (File txmFile : files) {
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/xml/XMLText2MetadataCSVMacro.groovy (revision 2983)
68 68
	if (!name.endsWith(".xml")) continue;
69 69
	
70 70
	println "Processing file $xmlFile..."
71
	name = name.substring(0, name.indexOf(".xml"))
71
	name = name.substring(0, name.lastIndexOf(".xml"))
72 72
	
73 73
	writer.print "$name"
74 74
	
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/xml/ForceWordIDsMacro.groovy (revision 2983)
34 34

  
35 35
// build text id
36 36
textid = inputFile.getName()
37
if (textid.indexOf(".xml") > 0) {
38
	textid = textid.substring(0, textid.indexOf(".xml"))
37
if (textid.lastIndexOf(".xml") > 0) {
38
	textid = textid.substring(0, textid.lastIndexOf(".xml"))
39 39
}
40 40

  
41 41
def parser = new StaxIdentityParser(inputFile) {
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/TRSToTEI.groovy (revision 2983)
58 58
	public TRSToTEI(File infile) {
59 59
		super(infile.toURI().toURL());
60 60
		textid = infile.getName()
61
		int idx = textid.indexOf(".trs")
61
		int idx = textid.lastIndexOf(".trs")
62 62
		if (idx > 0) textid = textid.substring(0, idx)
63 63
	}
64 64

  
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/importer.groovy (revision 2983)
123 123
		for (File infile : trsfiles) {
124 124
			cpb.tick()
125 125
			String textid = infile.getName()
126
			int idx = textid.indexOf(".trs")
126
			int idx = textid.lastIndexOf(".trs")
127 127
			if (idx > 0) textid = textid.substring(0, idx)
128 128
			File outfile = new File(txmDir, textid+".xml")
129 129
			TRSToTEI p = new TRSToTEI(infile);
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/transcriberLoader.groovy (revision 2983)
221 221
				println "Removing some speakers in "+txmDir.listFiles().length+" file(s)"
222 222
				for (File infile : txmDir.listFiles()) {
223 223
					String filename = infile.getName();
224
					int idx = filename.indexOf(".xml");
224
					int idx = filename.lastIndexOf(".xml");
225 225
					if (idx > 0)
226 226
						filename = filename.substring(0, idx);
227 227

  
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZPager.groovy (revision 2983)
490 490
			String pagename = f.getName();
491 491
			if (pagename.startsWith(textName+"_")) { // this is a page
492 492
				String firstWordID = getMetaContent(f);
493
				pagename = pagename.substring((textName+"_").length(), pagename.indexOf(".html")) // !!!!
493
				pagename = pagename.substring((textName+"_").length(), pagename.lastIndexOf(".html")) // !!!!
494 494
				edition.addPage(pagename, firstWordID)
495 495
			}
496 496
		}
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/doc/DocumentToTei.groovy (revision 2983)
51 51
			print "."
52 52
			String name = file.getName();
53 53
			if (file.getName().endsWith(".odt")) {
54
				name = name.substring(0, name.indexOf(".odt"));
54
				name = name.substring(0, name.lastIndexOf(".odt"));
55 55
				File teifile = new File(outdir, name+".xml");
56 56
				try {
57 57
					if (!new DocumentToTei().run(file, xslOdtTei, teifile)) {
......
61 61
					}
62 62
				} catch(Exception e) { println "ODT to TEI failed: $file: $e"; }
63 63
			} else if (file.getName().endsWith(".docx")) {
64
				name = name.substring(0, name.indexOf(".docx"));
64
				name = name.substring(0, name.lastIndexOf(".docx"));
65 65
				File teifile = new File(outdir, name+".xml");
66 66
				File odtFile = File.createTempFile("workflowdocx", "sfsdf.odt", outdir);
67 67
				
......
80 80
				}
81 81
				
82 82
			} else if (file.getName().endsWith(".doc")) {
83
				name = name.substring(0, name.indexOf(".doc"));
83
				name = name.substring(0, name.lastIndexOf(".doc"));
84 84
				File teifile = new File(outdir, name+".xml");
85 85
				File odtFile = File.createTempFile("workflowdoc", "sfsdf.odt", outdir);
86 86
				
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/LangSection.java (revision 2983)
88 88
			for (File model : files) {
89 89
				if (!model.getName().endsWith(".par")) continue;
90 90
				String lang = model.getName();
91
				lang = lang.substring(0, lang.indexOf(".par"));
91
				lang = lang.substring(0, lang.lastIndexOf(".par"));
92 92
				langcombo.add(lang);
93 93
				if (locale.equals(lang)) {
94 94
					langToSelectIndex = added;
tmp/org.txm.tigersearch.rcp/groovy/org/txm/scripts/importer/tigersearch/TSImporter.groovy (revision 2983)
129 129
		module.orderedFiles = new ArrayList<String>();
130 130
		for (def f : xmlFiles) {
131 131
			String id = f.getName()
132
			id = id.substring(0, id.indexOf(".xml"))
132
			id = id.substring(0, id.lastIndexOf(".xml"))
133 133
			module.orderedFiles.add(id)
134 134
		}
135 135
		isSuccessFul = outputDirectory.listFiles(IOUtils.HIDDENFILE_FILTER).size() > 0
tmp/org.txm.core/src/java/org/txm/objects/Project.java (revision 2983)
74 74
import org.w3c.dom.Element;
75 75
import org.xml.sax.SAXException;
76 76

  
77
import com.sun.org.apache.bcel.internal.generic.CPInstruction;
78

  
79 77
/**
80 78
 * The Class Project represent a Corpus project with its sources, corpus indexes, texts, editions, pages, etc.
81 79
 */
......
93 91
	 */
94 92
	protected boolean needToBuild;
95 93
	
96
	
97 94
	@Parameter(key = TBXPreferences.CLEAN)
98 95
	private boolean pCleanAfterBuild;
99 96
	
......
244 241
	public boolean open(IProgressMonitor monitor) {
245 242
		if (rcpProject != null && !rcpProject.isOpen()) {
246 243
			try {
247
				
248 244
				monitor.beginTask("Openning project", 100);
249 245
				
250
				
251 246
				rcpProject.open(monitor);
252 247
				
253 248
				initRCPStuffs(monitor);
......
326 321
				catch (MalformedURLException e) {
327 322
					e.printStackTrace();
328 323
				}
329
				
330 324
			}
331 325
		}
332 326
		return documentationPath;
......
480 474
		description.setLocation(folder.getLocation());
481 475
		description.setNatureIds(new String[] { TXMCORPUSNATURE });
482 476
		
483
		
484
		
485 477
		rcpProject.create(description, monitor);
486 478
		rcpProject.open(monitor);
487 479
		// TODO might fail if corpus source directory changed
......
951 943
	
952 944
	public ArrayList<Alignement> getLinksFrom(String from) {
953 945
		ArrayList<Alignement> rez = new ArrayList<>();
954
		for (String key : links.keySet())
955
			if (key.startsWith("#" + from + " ")) //$NON-NLS-1$ //$NON-NLS-2$
946
		for (String key : links.keySet()) {
947
			if (key.startsWith("#" + from + " ")) {//$NON-NLS-1$ //$NON-NLS-2$
956 948
				rez.add(links.get(key));
949
			}
950
		}
957 951
		return rez;
958 952
	}
959 953
	
960 954
	public ArrayList<Alignement> getLinksTo(String to) {
961 955
		ArrayList<Alignement> rez = new ArrayList<>();
962
		for (String key : links.keySet())
963
			if (key.endsWith(" #" + to)) //$NON-NLS-1$
956
		for (String key : links.keySet()) {
957
			if (key.endsWith(" #" + to)) { //$NON-NLS-1$
964 958
				rez.add(links.get(key));
959
			}
960
		}
965 961
		return rez;
966 962
	}
967 963
	
......
1047 1043
				rcpProject.delete(true, true, new LogMonitor("Cleaning " + this));
1048 1044
				
1049 1045
				// Toolbox.getEngineManager(EngineType.SEARCH).getEngine("CQP").start(null); //$NON-NLS-1$
1050
				
1051 1046
			}
1052 1047
			catch (Exception e) {
1053 1048
				// TODO Auto-generated catch block
......
1402 1397
			try {
1403 1398
				
1404 1399
				// Log.finest("Toolbox.initialize(): checking result type linked to node path " + parametersNodePath);
1405
				
1406 1400
				Preferences node = TXMPreferences.preferencesRootNode.node(parametersNodePath);
1407 1401
				String className = node.get("class", ""); //$NON-NLS-1$
1408 1402
				
tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/PluginMessagesManager.java (revision 2983)
208 208
				if (!name.endsWith(".properties")) continue;
209 209
				// messages.properties
210 210
				// messages_xx.properties
211
				String lang = name.substring(8, name.indexOf(".properties"));
211
				String lang = name.substring(8, name.lastIndexOf(".properties"));
212 212
				langs.put(propFile, new HashMap<String, String>());
213 213
				file2lang.put(propFile, lang);
214 214
				

Formats disponibles : Unified diff