Révision 2708

tmp/org.txm.core/src/java/org/txm/importer/xtz/ImportModule.java (revision 2708)
135 135
			else {
136 136
				System.out.println("XML-TXM files already produced in " + new File(binaryDirectory, "txm/" + corpusName));
137 137
			}
138
		}
139
		
140
		// update existing Text file pointers
141
		for (Text text : project.getTexts()) {
142
			File f = new File(project.getProjectDirectory(), "txm/" + project.getName() + "/" + text.getName() + ".xml");
143
			text.setTXMFile(f);
144
		}
145
		
146
		// declare in the right order the new texts produced in the "txm" directory
147
		for (File build : new File(binaryDirectory, "txm").listFiles()) {
148
			if (!build.isDirectory()) continue;
138 149
			
139
			// System.out.println("GET FILES ORDER");
140
			final List<String> orderedTextIDs = getTXMFilesOrder();
141
			
142
			// declare in the right order the new texts produced in the "txm" directory
143
			for (File build : new File(binaryDirectory, "txm").listFiles()) {
144
				if (!build.isDirectory()) continue;
150
			for (File xmltxmFile : build.listFiles()) {
151
				// File xmltxmFile = new File(build, name + ".xml");
152
				if (xmltxmFile.isDirectory()) continue;
153
				if (xmltxmFile.isHidden()) continue;
154
				if (!xmltxmFile.getName().endsWith(".xml")) continue;
145 155
				
146
				for (String name : orderedTextIDs) {
147
					File xmltxmFile = new File(build, name + ".xml");
148
					if (xmltxmFile.isDirectory()) continue;
149
					if (xmltxmFile.isHidden()) continue;
150
					
151
					if (project.getText(name) == null) { // if text does not exists create it
152
						Text t = new Text(project);
153
						t.setName(name);
154
						t.setTXMFile(xmltxmFile);
155
						t.setDirty();
156
					}
156
				String name = xmltxmFile.getName();
157
				name = name.substring(0, name.length() - 4);
158
				
159
				if (project.getText(name) == null) { // if text does not exists create it
160
					Text t = new Text(project);
161
					t.setName(name);
162
					t.setTXMFile(xmltxmFile);
163
					t.setDirty();
157 164
				}
158 165
			}
159
			
166
		}
167
		
168
		// remove Texts without xml-txm files
169
		for (Text text : project.getTexts()) {
170
			if (!text.getXMLTXMFile().exists()) {
171
				text.delete();
172
			}
173
		}
174
		
175
		// XML-TXM files are ready to be compiled for the right order
176
		final List<String> orderedTextIDs = getTXMFilesOrder();
177
		
178
		// set Texts order for further uses in TXM
179
		for (Text text : project.getTexts()) {
180
			String name = text.getName();
181
		}
182
		
183
		
184
		if (!updateCorpus) { // create XML-TXM files and annotate
160 185
			boolean annotate = project.getAnnotate();
161 186
			if (annotate && annotater != null) {
162 187
				if (monitor != null) monitor.subTask("-- ANNOTATE - Running NLP tools");
......
172 197
				// System.out.println("XML-TXM files already annotated.");
173 198
			}
174 199
		}
175
		else { // updating the corpus
176
			System.out.println(TXMCoreMessages.updatingCorpus);
177
			// fixing Text XML-TXM configurations
178
			for (Text text : project.getTexts()) {
179
				File f = text.getXMLTXMFile();
180
				if (f == null || !f.exists()) { // ensure the XML-TXM file path is set
181
					f = new File(project.getProjectDirectory(), "txm/" + project.getName() + "/" + text.getName() + ".xml");
182
					text.setTXMFile(f);
183
				}
184
			}
185
		}
186 200
		
187
		// XML-TXM files are ready to be compiled
188
		final List<String> orderedTextIDs = getTXMFilesOrder();
201
		
202
		
189 203
		Thread Tcompiler = new Thread("XTZ Compiler - " + project.getSrcdir().getName()) {
190 204
			
191 205
			@Override

Formats disponibles : Unified diff