Revision 2287

tmp/org.txm.core/src/java/org/txm/importer/xtz/ImportModule.java (revision 2287)
120 120
			} else {
121 121
				System.out.println("XML-TXM files already produced in "+new File(binaryDirectory, "txm/"+corpusName));
122 122
			}
123
			
124
			//System.out.println("GET FILES ORDER");
125
			final List<String> orderedTextIDs = getTXMFilesOrder();
123 126

  
124
			//declare the new texts produced in the "txm" directory
127
			//declare in the right order the new texts produced in the "txm" directory
125 128
			for (File build : new File(binaryDirectory, "txm").listFiles()) {
126 129
				if (!build.isDirectory()) continue;
127 130
				
128
				for (File xmltxmFile : build.listFiles()) {
131
				for (String name : orderedTextIDs) {
132
					File xmltxmFile = new File(build, name+".xml");
129 133
					if (xmltxmFile.isDirectory()) continue;
130 134
					if (xmltxmFile.isHidden()) continue;
131 135

  
132
					String name = xmltxmFile.getName();
133
					name = name.substring(0, name.indexOf(".xml"));
134

  
135
					Text t = new Text(project);
136
					t.setName(name);
137
					t.setTXMFile(xmltxmFile);
138
					t.setDirty();
136
					if (project.getText(name) != null) {
137
						Text t = new Text(project);
138
						t.setName(name);
139
						t.setTXMFile(xmltxmFile);
140
						t.setDirty();
141
					}
139 142
				}
140 143
			}
141 144

  
......
152 155
			} else {
153 156
				//System.out.println("XML-TXM files already annotated.");
154 157
			}
155
		} else {
158
		} else { // updating the corpus
156 159
			System.out.println(TXMCoreMessages.updatingCorpus);
157 160
			// fixing Text XML-TXM configurations
158 161
			for (Text text : project.getTexts()) {
159 162
				File f = text.getXMLTXMFile();
160
				if (f == null || !f.exists()) {
163
				if (f == null || !f.exists()) { // ensure the XML-TXM file path is set
161 164
					f = new File(project.getProjectDirectory(), "txm/"+project.getName()+"/"+text.getName()+".xml");
162 165
					text.setTXMFile(f);
163 166
				}
164 167
			}
165 168
		}
166 169

  
167
		//System.out.println("GET FILES ORDER");
170
		// XML-TXM files are ready to be compiled
168 171
		final List<String> orderedTextIDs = getTXMFilesOrder();
169

  
170 172
		Thread Tcompiler = new Thread("XTZ Compiler - "+project.getSrcdir().getName()) {
171 173
			public void run() {
172 174
				if (compiler != null) {
......
189 191
			public void run() {
190 192

  
191 193
				if (pager != null) {
192
					if (monitor != null) monitor.subTask("-- EDITION - Building edition");
194
					if (monitor != null) monitor.subTask("-- EDITION - Building editions");
193 195
					
194
					System.out.println("-- EDITION - Building edition");
196
					System.out.println("-- EDITION - Building editions");
195 197
					pager.process(orderedTextIDs);
196 198
					isSuccessful = isSuccessful & pager.isSuccessFul();
197 199
					if (!isSuccessful) {
......
213 215
		}
214 216

  
215 217
		Tpager.start();
216
		if (multithread) Tcompiler.join(); // wait for both thread to end
218
		if (multithread) Tcompiler.join(); // wait for both threads to end
217 219
		Tpager.join();
218 220

  
219 221
		if (isSuccessful) { // all done TODO remove this code when Text._compute() will be implemented

Also available in: Unified diff