Révision 1615

tmp/org.txm.statsengine.r.rcp/src/org/txm/statsengine/r/rcp/views/RVariablesView.java (revision 1615)
119 119
	public void _reload() {
120 120
		tv.setContentProvider(new RVariablesTreeProvider());
121 121
		tv.setLabelProvider(new RVariablesLabelProvider());
122
		List<MainCorpus> corpora;
122
		Collection<MainCorpus> corpora;
123 123
		try {
124
			corpora = CorpusManager.getCorpusManager().getCorpora();
124
			corpora = CorpusManager.getCorpusManager().getCorpora().values();
125 125
			if (corpora != null)
126 126
			{
127 127
				buildTreeContent(corpora);
128 128
				tv.refresh();
129 129
			}
130
		} catch (CqiClientException e) { }
130
		} catch (Exception e) { }
131 131
	}
132 132
	
133 133
	/**
......
135 135
	 *
136 136
	 * @param corpora the corpora
137 137
	 */
138
	protected void buildTreeContent(List<MainCorpus> corpora)
138
	protected void buildTreeContent(Collection<MainCorpus> corpora)
139 139
	{
140 140
		ArrayList<TXMResult> notempty = new ArrayList<TXMResult>(corpora);
141 141
		for(TXMResult container : corpora)
tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/commands/SaveAnnotations.java (revision 1615)
44 44
			return null;
45 45
		MainCorpus corpus = (MainCorpus) s;
46 46
		try {
47
			save(corpus);
47
			JobHandler job = save(corpus);
48
			if (job == null) {
49
				return null;
50
			}
48 51
		} catch (Exception e) {
49 52
			// TODO Auto-generated catch block
50 53
			e.printStackTrace();
tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/views/knowledgerepositories/KRView.java (revision 1615)
164 164
			public void widgetSelected(SelectionEvent arg0) {
165 165
				// force loading KR of all corpora
166 166
				try {
167
					for (MainCorpus corpus : CorpusManager.getCorpusManager().getCorpora()) {
167
					for (MainCorpus corpus : CorpusManager.getCorpusManager().getCorpora().values()) {
168 168
						for (KnowledgeRepository kr : InitializeKnowledgeRepository.get(corpus.getMainCorpus())) {
169 169
							kr.checkConnection();
170 170
						}
171 171
					}
172
				} catch (CqiClientException e) {
172
				} catch (Exception e) {
173 173
					e.printStackTrace();
174 174
					return;
175 175
				}
tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/SimpleKRAnnotation.java (revision 1615)
657 657
			if (am != null && am.hasChanges()) {
658 658
				// && MessageDialog.openConfirm(e.display.getActiveShell(), "Confirm annotation save", "Saving annotation will close this editor. Are you sure you want to save annotations right now ?")
659 659
				JobHandler saveJob = SaveAnnotations.save(corpus.getMainCorpus());
660
				if (saveJob.getResult() == Status.CANCEL_STATUS) {
660
				if (saveJob == null || saveJob.getResult() == Status.CANCEL_STATUS) {
661 661
					// update editor corpus
662 662
					System.out.println("Fail to save annotations of the corpus."); //$NON-NLS-1$
663
					return false;
663 664
				}
665
			} else {
666
				return false;
664 667
			}
665 668
		} catch(Exception ex) {
666 669
			ex.printStackTrace();
tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/KRAnnotation.java (revision 1615)
541 541
						// && MessageDialog.openConfirm(e.display.getActiveShell(), "Confirm annotation save", "Saving annotation will close this editor. Are you sure you want to save annotations right now ?")
542 542
						JobHandler saveJob = SaveAnnotations.save(corpus.getMainCorpus());
543 543
						
544
						if (saveJob.getResult() == Status.CANCEL_STATUS) {
544
						if (saveJob == null || saveJob.getResult() == Status.CANCEL_STATUS) {
545 545
							// update editor corpus
546 546
							System.out.println("Fail to save annotations of the corpus."); //$NON-NLS-1$
547 547
						}
......
868 868
			if (am != null && am.hasChanges()) {
869 869
				// && MessageDialog.openConfirm(e.display.getActiveShell(), "Confirm annotation save", "Saving annotation will close this editor. Are you sure you want to save annotations right now ?")
870 870
				JobHandler saveJob = SaveAnnotations.save(corpus.getMainCorpus());
871
				if (saveJob.getResult() == Status.CANCEL_STATUS) {
871
				if (saveJob == null || saveJob.getResult() == Status.CANCEL_STATUS) {
872 872
					// update editor corpus
873 873
					System.out.println("Fail to save annotations of the corpus."); //$NON-NLS-1$
874
					return false;
874 875
				}
876
			} else {
877
				return false;
875 878
			}
876 879
		} catch(Exception ex) {
877 880
			ex.printStackTrace();
tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/WordAnnotationToolbar.java (revision 1615)
648 648
			if (am != null && am.hasChanges()) {
649 649
				// && MessageDialog.openConfirm(e.display.getActiveShell(), "Confirm annotation save", "Saving annotation will close this editor. Are you sure you want to save annotations right now ?")
650 650
				JobHandler saveJob = SaveAnnotations.save(WordAnnotationToolbar.this.corpus.getMainCorpus());
651
				if (saveJob.getResult() == Status.CANCEL_STATUS) {
651
				if (saveJob == null || saveJob.getResult() == Status.CANCEL_STATUS) {
652 652
					// update editor corpus
653 653
					System.out.println("Fail to save annotations of the corpus."); //$NON-NLS-1$
654
					return false;
654 655
				}
656
			} else {
657
				return false;
655 658
			}
656 659
		} catch(Exception ex) {
657 660
			ex.printStackTrace();
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZCompiler.groovy (revision 1615)
60 60
		corpus.setID(corpusname);
61 61
		corpus.setName(corpusname);
62 62
		corpus.setDescription("Built with the XTZ import module");
63
		if (!corpus.compute(false)) {
64
			isSuccessFul = false;
65
			return;
66
		}
63 67
		
64 68
		if (module.getProject().getCleanAfterBuild()) {
65 69
			new File(module.getBinaryDirectory(), "cqp").deleteDir()
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xmltxm/compiler.groovy (revision 1615)
361 361
		corpus = new MainCorpus(project);
362 362
		corpus.setID(project.getName());
363 363
		corpus.setName(project.getName());
364
		corpus.setDescription("Built with the TXT+CSV import module");
364
		corpus.setDescription("Built with the XML-TXM import module");
365
		if (!corpus.compute(false)) {corpus.delete();
366
			return false;
367
		}
365 368
		
366 369
		File cqpFile = new File(binDir,"cqp/"+corpusname+".cqp");
367 370
cqpFile.delete()
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/discours/compiler.groovy (revision 1615)
185 185
		corpus = new MainCorpus(project);
186 186
		corpus.setID(project.getName());
187 187
		corpus.setName(project.getName());
188
		corpus.setDescription("Built with the TXT+CSV import module");
188
		corpus.setDescription("Built with the CNR+CSV import module");
189
		if (!corpus.compute(false)) {corpus.delete();
190
			return false;
191
		}
189 192
		
190 193
		File cqpFile = new File(binDir,"cqp/"+corpusname+".cqp");
191 194
cqpFile.delete()
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xml/compiler.groovy (revision 1615)
460 460
		corpus.setID(project.getName());
461 461
		corpus.setName(project.getName());
462 462
		corpus.setDescription("Built with the XML/w import module");
463
		if (!corpus.compute(false)) {corpus.delete();
464
			return false;
465
		}
463 466
		
464 467
		File cqpFile = new File(binDir,"cqp/"+corpusname+".cqp");
465 468
cqpFile.delete()
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/bfm/compiler.groovy (revision 1615)
762 762
		corpus = new MainCorpus(project);
763 763
		corpus.setID(project.getName());
764 764
		corpus.setName(project.getName());
765
		corpus.setDescription("Built with the TXT+CSV import module");
765
		corpus.setDescription("Built with the BFM import module");
766
		if (!corpus.compute(false)) {corpus.delete();
767
			return false;
768
		}
766 769
		
767 770
		File cqpFile = new File(binDir,"cqp/"+corpusname+".cqp");
768 771
cqpFile.delete()
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/tmx/compiler.groovy (revision 1615)
488 488
			corpus.setID(cqpName);
489 489
			corpus.setName(cqpName);
490 490
			corpus.setDescription("Built with the TMX import module");
491
			if (!corpus.compute(false)) {
492
				return false;
493
			}
491 494
			
492 495
			File cqpFile = new File(binDir,"cqp/"+cqpName+".cqp");
493 496
			
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/compiler.groovy (revision 1615)
141 141
		corpus = new MainCorpus(project);
142 142
		corpus.setID(project.getName());
143 143
		corpus.setName(project.getName());
144
		corpus.setDescription("Built with the TXT+CSV import module");
144
		corpus.setDescription("Built with the XML-TRS import module");
145
		if (!corpus.compute(false)) {corpus.delete();
146
			return false;
147
		}
145 148
		
146 149
		cqpFile = new File(binDir,"cqp/"+corpusname+".cqp");
147 150
		new File(binDir,"cqp").mkdirs()
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/txt/compiler.groovy (revision 1615)
192 192
		corpus.setID(project.getName());
193 193
		corpus.setName(project.getName());
194 194
		corpus.setDescription("Built with the TXT+CSV import module");
195
		if (!corpus.compute(false)) {
196
			return false;
197
		}
195 198
		
196 199
		File cqpFile = new File(binDir,"cqp/"+corpusname+".cqp");
197 200
cqpFile.delete()
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/alceste/compiler.groovy (revision 1615)
185 185
		corpus = new MainCorpus(project);
186 186
		corpus.setID(project.getName());
187 187
		corpus.setName(project.getName());
188
		corpus.setDescription("Build the alceste import module");
189
		
188
		corpus.setDescription("Build the Alceste import module");
189
		if (!corpus.compute(false)) {corpus.delete();
190
			return false;
191
		}
190 192
		File cqpFile = new File(binDir,"cqp/"+corpusname+".cqp");
191 193
cqpFile.delete()
192 194
		new File(binDir,"cqp").mkdirs()
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/hyperbase/compiler.groovy (revision 1615)
197 197
		corpus = new MainCorpus(project);
198 198
		corpus.setID(project.getName());
199 199
		corpus.setName(project.getName());
200
		corpus.setDescription("Built with the TXT+CSV import module");
200
		corpus.setDescription("Built with the Hyperbase import module");
201
		if (!corpus.compute(false)) {corpus.delete();
202
			return false;
203
		}
201 204
		
202 205
		File cqpFile = new File(binDir,"cqp/"+corpusname+".cqp");
203 206
cqpFile.delete()
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/cqp/compiler.groovy (revision 1615)
98 98
		corpus = new MainCorpus(project);
99 99
		corpus.setID(project.getName());
100 100
		corpus.setName(project.getName());
101
		corpus.setDescription("Built with the TXT+CSV import module");
101
		corpus.setDescription("Built with the CQP import module");
102
		if (!corpus.compute(false)) {corpus.delete();
103
			return false;
104
		}
102 105
		
103 106
		File cqpFile = new File(binDir,"cqp/"+corpusname+".cqp");
104 107
cqpFile.delete()
tmp/org.txm.groovy.core/src/java/org/txm/groovy/core/GroovyScriptedImportEngine.java (revision 1615)
59 59
					Log.severe(GroovyMessages.errorTreeTaggerAnnotationEngineIsNotReady);
60 60
					return Status.CANCEL_STATUS;
61 61
				}
62
				
63 62
			}
64 63
			
65 64
			if (project.getDoUpdate()) {
......
131 130
				Boolean readyToLoad = (Boolean)ready;
132 131
				//System.out.println("TRY TO LOAD THE BINARY CORPUS CREATED: "+basedir);
133 132
				if (readyToLoad) {
134
//					base = LoadBinaryCorpus.loadBinaryCorpusAsDirectory(basedir);
135
//					if (base == null) {
136
//						System.out.println(TXMUIMessages.ExecuteScriptImport_8);
137
//						if (basedir.exists()) basedir.renameTo(errorBinDirectory);
138
//						if (tempBinDirectory.exists()) tempBinDirectory.renameTo(basedir);
139
//						return Status.CANCEL_STATUS;
140
//					}
141
//					this.acquireSemaphore();
142
//					Log.info("Save workspace"); //$NON-NLS-1$
143
//					Toolbox.workspace.save();
144

  
133
//					
145 134
					Log.info(GroovyMessages.restartingToolboxSearchengines);
146
					//Toolbox.restartWorkspace(null);
147 135
					Toolbox.getEngineManager(EngineType.SEARCH).restartEngines();
148 136
					Log.info(TXMCoreMessages.common_done);
149 137
					
150
//					DeleteDir.deleteDirectory(tempBinDirectory);
151

  
152
					//							IWorkspace workspace = ResourcesPlugin.getWorkspace();
153
					//							IProject newProject = workspace.getRoot().getProject(base.getName());
154
					//							newProject.create(monitor);
155
					//							newProject.open(monitor);
156
					//							IFolder srcFolder = newProject.getFolder("src");
157
					//							IPath path = new Path(params.rootDir);
158
					//							srcFolder.createLink(path, IResource.ALLOW_MISSING_LOCAL, monitor);
159 138
				} else {
160 139
					Log.fine(GroovyMessages.errorImportNotCorrectlyEndedSeeConsoleMessages);
140
					
141
					if (!project.getDoUpdate()) { // clear all
142
						Log.fine("Delete all project children.");
143
						for (TXMResult c : project.getChildren()) {
144
							c.delete();
145
						}
146
					} else {
147
						Log.fine("Delete all project CorpusBuild&Edition children.");
148
						for (TXMResult c : project.getChildren(CorpusBuild.class)) {
149
							c.delete();
150
						}
151
						for (TXMResult c : project.getChildren(Edition.class)) {
152
							c.delete();
153
						}
154
					}
155
					
161 156
//					if (basedir.exists()) basedir.renameTo(errorBinDirectory);
162 157
//					if (tempBinDirectory.exists()) tempBinDirectory.renameTo(basedir);
163 158
					return new Status(Status.ERROR, "org.txm.groovy.core", GroovyMessages.errorImportNotCorrectlyEndedSeeConsoleMessages);
tmp/org.txm.groovy.core/src/java/org/txm/groovy/core/GroovyImportEngine.java (revision 1615)
28 28
		if (!importsPackageDirectory.exists()) {
29 29
			return false;
30 30
		}
31
		for (File dir : importsPackageDirectory.listFiles(IOUtils.FILTER_HIDDEN)) {
31
		for (File dir : importsPackageDirectory.listFiles(IOUtils.HIDDENFILE_FILTER)) {
32 32
			if (!dir.isDirectory()) continue;
33 33
			
34 34
			String name = dir.getName();
tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Line.java (revision 1615)
209 209
	
210 210

  
211 211
	/**
212
	 * Gets the left context size.
212
	 * Gets the Line left context size.
213 213
	 * 
214 214
	 * @return the left context size
215 215
	 */
216 216
	public int getLeftContextSize() {
217
//		if (leftCtxViewPropertiesValues.values().size() == 0) return 0;
217
		if (leftCtxViewPropertiesValues.values().size() == 0) return 0;
218 218
		return leftCtxViewPropertiesValues.values().iterator().next().size();
219 219
	}
220 220

  
221 221
	/**
222
	 * Gets the keywords size.
222
	 * Gets the Line keywords size.
223 223
	 * 
224 224
	 * @return the keywords size
225 225
	 */
226 226
	public int getKeywordsSize() {
227
//		if (keywordsViewValues.values().size() == 0) return 0;
227
		if (keywordsViewValues.values().size() == 0) return 0;
228 228
		return keywordsViewValues.values().iterator().next().size();
229 229
	}
230 230

  
231 231
	/**
232
	 * Gets the right context size.
232
	 * Gets the Line right context size.
233 233
	 * 
234 234
	 * @return the right context size
235 235
	 */
236 236
	public int getRightContextSize() {
237
//		if (rightCtxViewValues.values().size() == 0) return 0;
237
		if (rightCtxViewValues.values().size() == 0) return 0;
238 238
		return rightCtxViewValues.values().iterator().next().size();
239 239
	}
240 240

  
......
272 272
	 */
273 273
	public String leftContextToString(String propertySeparator,
274 274
			String wordSeparator, int limit, LineDecorator decorator) {
275
		
276
		if (getLeftContextSize() == 0) return "";
277
		
275 278
		int currentPos = keywordpos - getLeftContextSize();
276 279
		
277 280
		List<String> words = new ArrayList<String>();
......
377 380
	 */
378 381
	public String rightContextToString(String propertySeparator,
379 382
			String wordSeparator, int limit, LineDecorator decorator) {
383
		int s = getKeywordsSize();
384
		if (s == 0) return "";
385
		
380 386
		List<String> words = new ArrayList<String>();
381 387
		Map<Property, List<String>> values = getRightCtxViewProperties();
382 388
		int max = (limit == -1) ? (values.get(concordance.getRightViewProperties().get(0)).size()) : (limit);
383 389
		
384
		int s = getKeywordsSize();
385 390
		int currentPos = keywordpos + s;
386 391
		//System.out.println("Line "+keywordToString()+" right context, currentpos="+currentPos+" keywordpos="+keywordpos+" keywordlength="+s);
387 392
		for (int i = 0; i < max; i++) {
tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ImportGlozzCorpus.java (revision 1615)
182 182
						}
183 183
						Corpus analecCorpus = URSCorpora.getCorpus(corpus);
184 184
						analecCorpus.clearAll(); // remove all : annotations, structure
185
						File[] ecFiles = ecDir.listFiles(IOUtils.FILTER_HIDDEN);
185
						File[] ecFiles = ecDir.listFiles(IOUtils.HIDDENFILE_FILTER);
186 186
						Arrays.sort(ecFiles);
187 187
						for (File ecFile : ecFiles) {
188 188
							FichiersJava.concatener(ecFile, analecCorpus);
tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java (revision 1615)
1209 1209
		});
1210 1210

  
1211 1211
		queryArea.layout();
1212

  
1213

  
1214 1212
	}
1215 1213

  
1216 1214
	/**
tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/TEI2Project.java (revision 1615)
203 203
				return false;
204 204
			}
205 205

  
206
			if (imagesDirectory.exists() && imagesDirectory.listFiles(IOUtils.FILTER_HIDDEN).length > 0) {
206
			if (imagesDirectory.exists() && imagesDirectory.listFiles(IOUtils.HIDDENFILE_FILTER).length > 0) {
207 207
				System.out.println("Copying images files from "+imagesDirectory+" to "+imgDirectory+"...");
208 208
				FileCopy.copyFiles(imagesDirectory, imgDirectory);
209
				File[] files = imgDirectory.listFiles(IOUtils.FILTER_HIDDEN);
209
				File[] files = imgDirectory.listFiles(IOUtils.HIDDENFILE_FILTER);
210 210
				if (files != null) System.out.println(""+files.length+" images copied.");
211 211
			}
212 212

  
tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/Project2XTZ.java (revision 1615)
95 95
		File wFile = null;
96 96
		File cFile = null;
97 97

  
98
		File[] xmlFiles = textDirectory.listFiles(IOUtils.FILTER_HIDDEN);
98
		File[] xmlFiles = textDirectory.listFiles(IOUtils.HIDDENFILE_FILTER);
99 99
		if (xmlFiles == null) return false;
100 100

  
101 101
		for (File xmlFile : xmlFiles) {
......
140 140
		}
141 141
		// INJECT ontologies 
142 142
		System.out.println("Injecting ontologies...");
143
		for (File f : cDirectory.listFiles(IOUtils.FILTER_HIDDEN)) {
143
		for (File f : cDirectory.listFiles(IOUtils.HIDDENFILE_FILTER)) {
144 144
			if (f.getName().startsWith(cDirectory.getName())) {
145 145
				OntologiesProjection cp = new OntologiesProjection(f, projectDirectory);
146 146
				File outputFile = new File(cDirectory, "temp.xml");
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/LoadBinaryCorporaDirectory.java (revision 1615)
132 132
				}
133 133
				this.releaseSemaphore();
134 134

  
135
				for (Project newProject2 : newProjects) {
136
					try {
137
						newProject2.compute(true);
138
					} catch (Exception e) {
139
						e.printStackTrace();
140
					}
141
				}
142
				System.out.println(NLS.bind(TXMUIMessages.P0CorpusLoaded, newProjects.size()));
143
				
135 144
				this.syncExec(new Runnable() {
136 145
					@Override
137 146
					public void run() {
138
						
139
						for (Project newProject2 : newProjects) {
140
							newProject2.compute();
141
						}
142
						System.out.println(NLS.bind(TXMUIMessages.P0CorpusLoaded, newProjects.size()));
143 147
						RestartTXM.reloadViews();
144 148
						System.err.println(TXMUIMessages.info_txmIsReady);
145 149
						StatusLine.setMessage(TXMUIMessages.info_txmIsReady);
......
179 183
			job.releaseSemaphore();
180 184

  
181 185
			monitor.subTask(TXMUIMessages.loadingTheCorpusInThePlatform);
182
			for (File corpusDirectory : corporaDirectory.listFiles(IOUtils.FILTER_HIDDEN)) {
186
			for (File corpusDirectory : corporaDirectory.listFiles(IOUtils.HIDDENFILE_FILTER)) {
187
				if (corpusDirectory.isHidden()) {
188
					continue;
189
				}
183 190
				
184 191
				Project project = Toolbox.workspace.getProject(corpusDirectory.getName().toUpperCase());
185 192
				if (project != null) {
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/Load079BinaryCorpus.java (revision 1615)
51 51
		String basedirname = Zip.getRoot(zipFile);
52 52
		return Zip.hasEntries(zipFile, basedirname+"/import.xml", basedirname+"/data/", basedirname+"/txm/", basedirname+"/HTML/", basedirname+"/registry/");
53 53
	}
54
	
54

  
55 55
	/**
56 56
	 * Load a 0.7.9 binary corpus archive: 
57 57
	 * 
......
66 66

  
67 67
		final File corporaDir = Toolbox.workspace.getLocation(); //$NON-NLS-1$
68 68
		corporaDir.mkdir();
69
		
69

  
70 70
		String basedirname = Zip.getRoot(zipFile);
71
		
71

  
72 72
		Project p = Toolbox.workspace.getProject(basedirname.toUpperCase());
73 73
		if (p != null) {
74 74
			System.out.println(NLS.bind(TXMUIMessages.abortingLoadingOfPOACorpusWithTheSameNameAlreadyExists, zipFile));
75 75
			return null;
76 76
		}
77 77
		
78
		File corpusDirectory = new File(corporaDir, basedirname);
79
		if (corpusDirectory.exists()) {
80
			System.out.println("Aborting loading of "+zipFile+". A directory with the same name already exists: "+corpusDirectory);
81
			return null;
82
		}
83

  
78 84
		if (!canLoad(zipFile)) {
79 85
			System.out.println(TXMUIMessages.binaryCorpusIsNotATXM079CorpusNoImportXmlFile);	
80 86
			return null;
81 87
		}
82 88

  
83 89
		System.out.println(NLS.bind(TXMUIMessages.loadingTheP0BinaryCorpusAsATXM079Corpus, zipFile.getName()));
84
		
90

  
85 91
		//ZIPPED FILE
86 92
		monitor.beginTask(TXMUIMessages.loadingBinaryCorpus, 100);
87 93
		monitor.subTask(TXMUIMessages.extractingBinaryCorpus);
......
127 133
			Log.severe(NLS.bind(TXMUIMessages.failedToLoadCorpusFromDirectoryColonP0WeCannotFindTheNecessaryComponents, binCorpusDirectory)); 
128 134
			return null;
129 135
		}
130
		
136

  
131 137
		MainCorpus c = new MainCorpus(project);
132 138
		BaseOldParameters params = new BaseOldParameters(new File(binCorpusDirectory, "import.xml"));
133 139
		params.load();
134 140
		c._load(params.getCorpusElement());
135
		
136
		project.saveParameters(true);
137

  
138
		//Toolbox.workspace.save();
139
		return project;
141
		if (c.compute(false)) {
142
			project.saveParameters(true);
143
			return project;
144
		} else {
145
			project.delete();
146
			return null;
147
		}
140 148
	}
141 149
}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/LoadBinaryCorpus.java (revision 1615)
118 118

  
119 119
				zipFile = new File(path, filename);
120 120
				LastOpened.set(ID, zipFile);
121
			} else {
122
				return null;
121 123
			}
122 124
		}
123 125

  
124

  
125 126
		return loadBinaryCorpusArchive(zipFile);
126 127
	}
127 128

  
......
268 269

  
269 270
			//CHECK ZIPPED FILE
270 271
			if (Load080BinaryCorpus.canLoad(zipFile)) {
271
				project = Load080BinaryCorpus.loadBinaryCorpus(zipFile, monitor);
272
				project = Load080BinaryCorpus.loadBinaryCorpusArchive(zipFile, monitor);
272 273
			} else if (Load079BinaryCorpus.canLoad(zipFile)) {
273 274
				project = Load079BinaryCorpus.loadBinaryCorpusArchive(zipFile, monitor);
274 275
			} else {
......
276 277
				return null;
277 278
			}
278 279
			if (project == null) {
279
				System.out.println(NLS.bind("Error: could not load {0} corpus.", zipFile));
280
				System.out.println(NLS.bind("Error: could not load the {0} corpus.", zipFile));
280 281
				return null; 
281 282
			}
282 283

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/Load080BinaryCorpus.java (revision 1615)
32 32
import org.eclipse.core.runtime.IProgressMonitor;
33 33
import org.eclipse.osgi.util.NLS;
34 34
import org.txm.Toolbox;
35
import org.txm.core.results.TXMResult;
36
import org.txm.objects.BaseOldParameters;
35 37
import org.txm.objects.Project;
36 38
import org.txm.rcp.messages.TXMUIMessages;
39
import org.txm.searchengine.cqp.corpus.MainCorpus;
37 40
import org.txm.utils.DeleteDir;
38 41
import org.txm.utils.logger.Log;
39 42
import org.txm.utils.zip.Zip;
......
58 61
	 * @return the base
59 62
	 * @throws Exception the exception
60 63
	 */
61
	public static Project loadBinaryCorpus(File zipFile, IProgressMonitor monitor) throws Exception {
64
	public static Project loadBinaryCorpusArchive(File zipFile, IProgressMonitor monitor) throws Exception {
62 65
		//ZIPPED FILE
63 66
		if (monitor != null) monitor.beginTask(TXMUIMessages.loadingBinaryCorpus, 100);
64 67
		if (monitor != null) monitor.subTask(TXMUIMessages.extractingBinaryCorpus);
......
70 73
			System.out.println("Aborting loading of "+zipFile+". A corpus with the same name already exists.");
71 74
			return null;
72 75
		}
76
		
77
		File corpusDirectory = new File(Toolbox.workspace.getLocation(), basedirname);
78
		if (corpusDirectory.exists()) {
79
			System.out.println("Aborting loading of "+zipFile+". A directory with the same name already exists: "+corpusDirectory);
80
			return null;
81
		}
73 82

  
74 83
		if (!canLoad(zipFile)) {
75 84
			Log.severe(NLS.bind(TXMUIMessages.binaryCorpusIsNotATXM080CorpusNoSettingsNorProjectFile, zipFile.getName()));
......
89 98
		if (monitor != null) monitor.worked(50);
90 99

  
91 100
		if (monitor != null) monitor.subTask(TXMUIMessages.loadingTheCorpusInThePlatform);
92
		File corpusDirectory = new File(Toolbox.workspace.getLocation(), basedirname);
101
		
93 102

  
94 103
		// test with CQP MainCorpus name
95 104
		File dataDirectory = new File(corpusDirectory, "data");
......
136 145
			return null;
137 146
		}
138 147

  
139
		Toolbox.workspace.saveParameters();
140
		return project;
148
		boolean ok = true;
149
		for (TXMResult r : project.getChildren(MainCorpus.class)) {
150
			MainCorpus c = (MainCorpus)r;
151
			ok = ok && c.compute(false);
152
		}
153
		if (ok) {
154
			project.saveParameters();
155
			return project;
156
		} else {
157
			project.delete();
158
			return null;
159
		}
141 160
	}
142 161
}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/UpdateCorpus.java (revision 1615)
12 12
import org.eclipse.ui.handlers.HandlerUtil;
13 13
import org.txm.objects.Project;
14 14
import org.txm.rcp.commands.CloseEditorsUsing;
15
import org.txm.rcp.commands.RestartTXM;
15 16
import org.txm.rcp.handlers.scripts.ExecuteImportScript;
16 17
import org.txm.rcp.utils.JobHandler;
18
import org.txm.rcp.views.corpora.CorporaView;
17 19
import org.txm.searchengine.cqp.corpus.MainCorpus;
18 20

  
19 21
public class UpdateCorpus extends AbstractHandler {
......
62 64
			@Override
63 65
			protected IStatus run(IProgressMonitor monitor) {
64 66
				if (project.compute(monitor)) {
67
					
68
					this.syncExec(new Runnable() {
69
						
70
						@Override
71
						public void run() {
72
							RestartTXM.reloadViews();
73
						}
74
					});
65 75
					return Status.OK_STATUS;
66 76
				} else {
67 77
					return Status.CANCEL_STATUS;
tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchAdvisor.java (revision 1615)
781 781

  
782 782
		corporaDir = new File(txmhomedir, "corpora"); //$NON-NLS-1$
783 783

  
784
		File[] corporaDirFiles = corporaDir.listFiles(IOUtils.FILTER_HIDDEN);
784
		File[] corporaDirFiles = corporaDir.listFiles(IOUtils.HIDDENFILE_FILTER);
785 785
		if (corporaDir.exists() && corporaDirFiles != null && corporaDirFiles.length > 0) { // if the txmhomedir is not empty, try to restore its content
786 786
			Display.getDefault().syncExec(new Runnable() {
787 787
				@Override
......
807 807
					DeleteDir.deleteDirectory(oldbackup); // ]8)
808 808
				}
809 809

  
810
				File[] corpDirs = corporaDir.listFiles(IOUtils.FILTER_HIDDEN);
810
				File[] corpDirs = corporaDir.listFiles(IOUtils.HIDDENFILE_FILTER);
811 811
				ArrayList<String> moved = new ArrayList<String>();
812 812
				ArrayList<String> failed = new ArrayList<String>();
813 813

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/AdapterFactory.java (revision 1615)
46 46
import org.txm.searchengine.cqp.corpus.CorpusManager;
47 47
import org.txm.searchengine.cqp.corpus.MainCorpus;
48 48

  
49
// TODO: Auto-generated Javadoc
50 49
/**
51 50
 * A factory for creating Adapter objects.
52 51
 * 
......
58 57

  
59 58
	private HashMap<Class, IWorkbenchAdapter> externalAdapters = new HashMap<Class, IWorkbenchAdapter>();
60 59

  
61
	/** The corpus manager adapter. */
62
	private IWorkbenchAdapter corpusManagerAdapter = new IWorkbenchAdapter() {
63

  
64
		@Override
65
		public Object[] getChildren(Object corpusManager) {
66
			Object[] children = null;
67
			try {
68
				List<MainCorpus> corpora = new ArrayList<MainCorpus>(CorpusManager.getCorpusManager().getCorpora());
69
				Collections.sort(corpora, new Comparator<MainCorpus>() {
70
					@Override
71
					public int compare(MainCorpus o1, MainCorpus o2) {
72
						return o1.getName().compareTo(o2.getName());
73
					}
74
				});
75

  
76
				// check if each corpus has a Base
77
				if (firstCorpusDiag) {	
78
					firstCorpusDiag = false;
79
					for (MainCorpus corpus : corpora) {
80
						if (corpus.getProject() == null) {
81
							System.out.println(NLS.bind(TXMUIMessages.warningColonTheCorpusP0IsCorruptedSomeCommandsWontWorkCorrectly, corpus));
82
						}
83
					}
84
				}
85
				children = corpora.toArray();
86

  
87
			} catch (CqiClientException e) {
88
				return new Object[0];
89
			}
90
			return children;
91
		}
92

  
93
		@Override
94
		public ImageDescriptor getImageDescriptor(Object corpusManager) {
95
			// TODO Auto-generated method stub
96
			return null;
97
		}
98

  
99
		@Override
100
		public String getLabel(Object corpusManager) {
101
			// TODO Auto-generated method stub
102
			return null;
103
		}
104

  
105
		@Override
106
		public Object getParent(Object corpusManager) {
107
			return null;
108
		}
109
	};
110

  
111 60
//	/** The corpus adapter. */
112 61
//	private IWorkbenchAdapter corpusAdapter = new IWorkbenchAdapter() {
113 62
//
......
202 151
	 */
203 152
	@Override
204 153
	public Object getAdapter(Object adaptableObject, Class adapterType) {
205
		if (adapterType == IWorkbenchAdapter.class && adaptableObject instanceof CorpusManager) {
206
			return corpusManagerAdapter;
207
		}
154
//		if (adapterType == IWorkbenchAdapter.class && adaptableObject instanceof CorpusManager) {
155
//			return corpusManagerAdapter;
156
//		}
208 157
//		if (adapterType == IWorkbenchAdapter.class && adaptableObject instanceof Corpus) {
209 158
//			return corpusAdapter;
210 159
//		}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/QueriesView.java (revision 1615)
134 134
		tv.setLabelProvider(new TxmObjectLabelProvider());
135 135
		if (Toolbox.workspace != null) {
136 136
			try {
137
				Collection<MainCorpus> input = CorpusManager.getCorpusManager().getCorpora();
137
				Collection<MainCorpus> input = CorpusManager.getCorpusManager().getCorpora().values();
138 138
				tv.setInput(input);
139 139
				refresh();
140
			} catch (CqiClientException e) {
141
				// TODO Auto-generated catch block
140
			} catch (Exception e) {
142 141
				org.txm.utils.logger.Log.printStackTrace(e);
143 142
			}
144 143
		}
......
182 181
				try {
183 182
					FileWriter writer = new FileWriter(output);
184 183
					writer.write(TXMUIMessages.queriesColon);
185
					for (MainCorpus b : CorpusManager.getCorpusManager().getCorpora()) {
184
					for (MainCorpus b : CorpusManager.getCorpusManager().getCorpora().values()) {
186 185
						writer.write(" " + b.getID() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
187 186
						for (SavedQuery q : b.getQueriesLog()) {
188 187
							writer.write("  " + q + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
......
194 193
					refresh();
195 194
				} catch (IOException e) {
196 195
					Log.severe("Error while exporting queries: "+e.getLocalizedMessage());
197
				} catch (CqiClientException e) {
196
				} catch (Exception e) {
198 197
					// TODO Auto-generated catch block
199 198
					org.txm.utils.logger.Log.printStackTrace(e);
200 199
				}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/SummaryView.java (revision 1615)
168 168
		//init combo
169 169
		try {
170 170
			corpusCombo.removeAll();
171
			for (MainCorpus p : CorpusManager.getCorpusManager().getCorpora()) {
171
			for (MainCorpus p : CorpusManager.getCorpusManager().getCorpora().values()) {
172 172
				corpusCombo.add(p.getName());
173 173
			}
174
		} catch (CqiClientException e2) {
174
		} catch (Exception e2) {
175 175
			// TODO Auto-generated catch block
176 176
			org.txm.utils.logger.Log.printStackTrace(e2);
177 177
		}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 1615)
103 103
	 */
104 104
	public final static String TOP_TOOLBAR_ID = "TXMEditorTopToolBar"; //$NON-NLS-1$
105 105
	public final static String BOTTOM_TOOLBAR_ID = "TXMEditorBottomToolBar"; //$NON-NLS-1$
106
	
106

  
107 107
	//FIXME: SJ: bad idea to use the ID as title, need to change the system
108 108
	public final static String COMPUTING_PARAMETERS_GROUP_ID = TXMUIMessages.parameters;
109 109

  
......
218 218
	public TXMEditor(TXMResultEditorInput<TXMResult> editorInput) {
219 219
		this.setInput(editorInput); // FIXME: SJ: the input is defined twice, on time here and one time in init(), need to see if we still need the assignment here in the constructor		
220 220
	}
221
	
222 221

  
222

  
223 223
	@Override
224 224
	public void init(IEditorSite site, IEditorInput input) throws PartInitException {
225 225
		this.setSite(site);
......
260 260
							public void run() throws Exception {
261 261
								@SuppressWarnings("unchecked")
262 262
								TXMEditorExtension<T> ext = ((TXMEditorExtension<T>) o);
263
								
263

  
264 264
								if (getResult() == null) return;
265
								
265

  
266 266
								if (ext.getTXMResultValidClasses() == null || ext.getTXMResultValidClasses().contains(getResult().getClass())) {
267 267
									Log.finest("Installing TXMEditorExtension: "+ext.getName()); //$NON-NLS-1$
268 268
									ext.setEditor(TXMEditor.this);
......
287 287
				//				}
288 288

  
289 289
				if (partRef.getId().equals(TXMEditor.this.getClass().getName())) { // called after this.doSave()
290
					
290

  
291 291
					//System.out.println("EVENT partClosed");
292 292
					for (TXMEditorExtension<T> extension : extensions) {
293 293
						try {
......
369 369
			this.parent = parent;
370 370

  
371 371
			//this.getContainer().setRedraw(false);
372
			
372

  
373 373
			// to hide and display the extended parameters composite
374 374
			this.initParentLayout(parent, 1);
375 375

  
......
431 431

  
432 432
			this.firstLineComposite.pack();
433 433
			this.extendedParametersGroup.pack();
434
			
435
			
434

  
435

  
436 436
			// remove empty toolbar
437 437
			//TODO SJ: Hack? MD: yeah -> need to find a way to not display the bottom toolbar on Windows instead
438 438
			if (this.bottomToolBar.getItems().length == 0) {
......
452 452

  
453 453
			// FIXME: SJ: this code doesn't work even if we call removeComputeButton()
454 454
			// remove empty first line composite
455
//			if(this.mainParametersComposite.getChildren().length == 0 && this.topToolBar.isDisposed())	{
456
//				this.firstLineComposite.dispose();
457
//			}
458
			
455
			//			if(this.mainParametersComposite.getChildren().length == 0 && this.topToolBar.isDisposed())	{
456
			//				this.firstLineComposite.dispose();
457
			//			}
459 458

  
459

  
460 460
			if (this.getResult().isLocked()) {
461 461
				this.setLocked(true);
462 462
			}
463 463

  
464 464
			// disable the compute button, it will be re-enable or not later when the UI will check if the editor is dirty or not
465
//			ToolItem computeButton = this.topToolBar.getItemByContributionId(TOP_TOOLBAR_COMPUTE_BUTTON_ID);
466
//			if (computeButton != null) {
467
//				computeButton.setEnabled(false);
468
//			}
469
			
465
			//			ToolItem computeButton = this.topToolBar.getItemByContributionId(TOP_TOOLBAR_COMPUTE_BUTTON_ID);
466
			//			if (computeButton != null) {
467
			//				computeButton.setEnabled(false);
468
			//			}
469

  
470 470
		} catch(Throwable e) {
471 471
			Log.severe(TXMCoreMessages.bind("TXMEditor.createPartControl(): can not create the editor for result {0}.", this.getResult())); //$NON-NLS-1$
472 472
			e.printStackTrace();
473 473
			createPartControlDoneSucessfully = false;
474 474
		}
475
		
475

  
476 476
		this.setDirty(false);
477
		
477

  
478 478
		//this.getContainer().setRedraw(true);
479 479
	}
480 480

  
......
482 482
		this.locked = b;
483 483
		this.firstLineComposite.setEnabled(!b);
484 484
	}
485
	
485

  
486 486
	public boolean isLocked() {
487 487
		return locked;
488 488
	}
......
654 654

  
655 655
		// FIXME: SJ: future version that enable the button ONLY if the result can compute
656 656
		// need to check all canCompute() result methods before enabling it
657
//		try {
658
//			// enable/disable the compute button according to dirty state of the editor
659
//			if (this.computeButton != null && !this.computeButton.isDisposed()) {
660
//				this.computeButton.setEnabled(this.getResult().canCompute() && dirty && !this.getResult().isLocked());
661
//			}
662
//		}
663
//		catch (Exception e) {
664
//			// TODO Auto-generated catch block
665
//			e.printStackTrace();
666
//		}
657
		//		try {
658
		//			// enable/disable the compute button according to dirty state of the editor
659
		//			if (this.computeButton != null && !this.computeButton.isDisposed()) {
660
		//				this.computeButton.setEnabled(this.getResult().canCompute() && dirty && !this.getResult().isLocked());
661
		//			}
662
		//		}
663
		//		catch (Exception e) {
664
		//			// TODO Auto-generated catch block
665
		//			e.printStackTrace();
666
		//		}
667 667

  
668 668
		// FIXME: old version
669 669
		// enable/disable the compute button according to dirty state of the editor
......
693 693
	@Override
694 694
	public boolean isSaveOnCloseNeeded() {
695 695
		boolean needed = false;
696
		
696

  
697 697
		for (TXMEditorExtension<T> extension : this.extensions) {
698 698
			try {
699 699
				needed = needed || (extension.isSaveOnCloseNeeded() && extension.isDirty());
......
702 702
			}
703 703
		}
704 704
		return needed;
705
		
705

  
706 706
	}
707
	
708 707

  
709
	
708

  
709

  
710 710
	@Override
711 711
	public void setFocus() {
712
	//	this.resultArea.setFocus();
712
		//	this.resultArea.setFocus();
713 713
		// FIXME SJ: this code leads to a bug, the focus must not be regiven to the main parameter after each computing
714 714
		//		if (mainParametersComposite != null && !mainParametersComposite.isDisposed()) {
715 715
		//			mainParametersComposite.setFocus();
......
717 717
		CorporaView.focus(this.getResult());
718 718
	}
719 719

  
720
	
720

  
721 721
	@SuppressWarnings("unchecked")
722 722
	@Override
723 723
	public TXMResultEditorInput<T> getEditorInput() {
......
800 800
	 */
801 801
	public JobHandler compute(final boolean update)	{
802 802

  
803
		
804 803
		StatusLine.setMessage(TXMCoreMessages.bind(TXMUIMessages.computing, this.getResult().getName()));
805 804

  
806

  
807 805
		JobHandler job = new JobHandler(TXMCoreMessages.bind(TXMUIMessages.computing, this.getResult().getName())) {
808 806

  
809 807
			@Override
......
814 812
				if (isLocked()) {
815 813
					return Status.CANCEL_STATUS;
816 814
				}
817
				
815

  
818 816
				try {
819 817
					JobsTimer.start();
820
					
818

  
821 819
					// FIXME: SJ: tests
822 820
					//showBusy(true);
823
					
821

  
824 822
					this.syncExec(new Runnable() {
825 823
						@Override
826 824
						public void run() {
825

  
827 826
							if(update)	{
828 827

  
829 828
								// popup alert to inform user that the result has been manually edited
830 829
								if (TXMEditor.this.getResult().isAltered()
831
									&& !MessageDialog.openQuestion(getShell(), TXMCoreMessages.common_warning, TXMCoreMessages.bind(TXMUIMessages.warning_popup_theP0HasBeenEditedItsChangesWillBeLost, TXMEditor.this.getResult().getResultType()))) {
832
										setCanceled(true);
830
										&& !MessageDialog.openQuestion(getShell(), TXMCoreMessages.common_warning, TXMCoreMessages.bind(TXMUIMessages.warning_popup_theP0HasBeenEditedItsChangesWillBeLost, TXMEditor.this.getResult().getResultType()))) {
831
									setCanceled(true);
833 832
								}
834 833
								// popup alert to inform user that children results will be recomputed
835 834
								if(!TBXPreferences.getInstance().getBoolean(TBXPreferences.EXPERT_USER)
836 835
										&& TXMEditor.this.getResult().hasVisibleChild() && !MessageDialog.openQuestion(getShell(), TXMCoreMessages.common_warning, TXMUIMessages.warning_popup_allDescendantResultsWillBeUpdated))	{
837 836
									setCanceled(true);
838 837
								}
839
								
840 838

  
841
								
839

  
840

  
842 841
								// subclasses manual result updating from editor fields
843 842
								Log.finer("TXMEditor.compute(): " + TXMEditor.this.getClass().getSimpleName() + ": manually updating result from editor."); //$NON-NLS-1$
844 843
								updateResultFromEditor();
......
846 845
								// auto updating result from Parameter annotations in result <=> editor
847 846
								Log.finer("TXMEditor.compute(): " + TXMEditor.this.getClass().getSimpleName() + ": auto updating result from editor."); //$NON-NLS-1$
848 847
								autoUpdateResultFromEditorParameters();
849
	
850 848

  
851
								
849

  
850

  
852 851
								// FIXME: SJ: useless at this time?
853 852
								// Stores the last parameters before the computing to later auto-update the Widgets only if some parameters have changed 
854 853
								//setLastComputingParameters(TXMEditor.this.getResult().getLastParametersFromHistory());
855 854
							}
856 855
							// FIXME: SJ: there is a bug when deleting LT lines for example, the popup alert to inform user that children results will be recomputed is not triggered
857 856
							// problem here is the DeleteLines commands, etc. call TXMEditor.compute(false) at this moment, they should call TXMEditor.compute(true) but the LT Editor is not ready to manage that
858
//							else if(TXMEditor.this.getResult().hasBeenComputedOnce())	 {
859
//								// popup alert to inform user that children results will be recomputed
860
//								if(!TBXPreferences.getInstance().getBoolean(TBXPreferences.EXPERT_USER)
861
//										&& TXMEditor.this.getResult().hasVisibleChild() && !MessageDialog.openQuestion(getShell(), TXMCoreMessages.common_warning, TXMUIMessages.warning_popup_allDescendantResultsWillBeUpdated))	{
862
//									setCanceled(true);
863
//								}
864
//
865
//							}
857
							//							else if(TXMEditor.this.getResult().hasBeenComputedOnce())	 {
858
							//								// popup alert to inform user that children results will be recomputed
859
							//								if(!TBXPreferences.getInstance().getBoolean(TBXPreferences.EXPERT_USER)
860
							//										&& TXMEditor.this.getResult().hasVisibleChild() && !MessageDialog.openQuestion(getShell(), TXMCoreMessages.common_warning, TXMUIMessages.warning_popup_allDescendantResultsWillBeUpdated))	{
861
							//									setCanceled(true);
862
							//								}
863
							//
864
							//							}
866 865
						}
867 866
					});
868 867

  
......
960 959
			else {
961 960
				return null;
962 961
			}
963
			
962

  
964 963
			// computing the result only if the editor wasn't already opened
965 964
			if (!wasAlreadyOpened)	{
966 965
				editor.compute(false);
......
983 982
	 * @throws Exception 
984 983
	 */
985 984
	public final void refresh(boolean update) throws Exception {
986
		
985

  
987 986
		// skip refresh if the part creation has failed
988 987
		if (!createPartControlDoneSucessfully) {
989 988
			return;
990 989
		}
991
		
990

  
992 991
		this.notifyExtensions("notifyStartOfRefresh"); //$NON-NLS-1$
993 992

  
994 993
		TXMResult result = this.getResult();
......
1033 1032
		List<TXMResult> results = this.getResult().getDeepChildren();
1034 1033
		//results.add(this.getResult());
1035 1034

  
1036
		
1035

  
1037 1036
		for (int i = 0; i < results.size(); i++) {
1038 1037
			ArrayList<TXMEditor> editors = SWTEditorsUtils.getEditors(results.get(i)) ;
1039 1038
			for (int j = 0; j < editors.size(); j++) {
......
1042 1041
						//&& txmEditor.isDirty()
1043 1042
						)	{
1044 1043
					//txmEditor.synchronizeResultFromEditor();
1045
					
1044

  
1046 1045
					// FIXME: SJ: need to prove/test this code
1047 1046
					// recreate all if the parent result is altered 
1048 1047
					//txmEditor.refresh(!this.getResult().isAltered());
......
1050 1049
				}
1051 1050
			}
1052 1051
		}
1053
		
1052

  
1054 1053
		this.notifyExtensions("notifyEndOfRefresh"); //$NON-NLS-1$
1055 1054
	}
1056 1055

  
......
1062 1061
	public abstract void updateResultFromEditor();
1063 1062

  
1064 1063
	// FIXME: became useless?
1065
//	/**
1066
//	 * UI safe
1067
//	 * 
1068
//	 * Synchronizes the editor with the result. 
1069
//	 * Dedicated to dynamically change the editor components from the stored result.
1070
//	 * <p>
1071
//	 * Use this method if you need to save parameter with Type not managed by the autoUpdateEditorFieldsFromResult method
1072
//	 * @throws Exception 
1073
//	 */
1074
//	public final void updateFromResult(final boolean update) throws Exception {
1075
//		if (this.parent != null && !this.parent.isDisposed()) {
1076
//			this.parent.getDisplay().syncExec(new Runnable() {
1077
//
1078
//				@Override
1079
//				public void run() {
1080
//					try {
1081
//						refresh(update);
1082
//					} catch (Exception e) {
1083
//						// TODO Auto-generated catch block
1084
//						e.printStackTrace();
1085
//					}
1086
//				}
1087
//			});
1088
//		}
1089
//	}
1064
	//	/**
1065
	//	 * UI safe
1066
	//	 * 
1067
	//	 * Synchronizes the editor with the result. 
1068
	//	 * Dedicated to dynamically change the editor components from the stored result.
1069
	//	 * <p>
1070
	//	 * Use this method if you need to save parameter with Type not managed by the autoUpdateEditorFieldsFromResult method
1071
	//	 * @throws Exception 
1072
	//	 */
1073
	//	public final void updateFromResult(final boolean update) throws Exception {
1074
	//		if (this.parent != null && !this.parent.isDisposed()) {
1075
	//			this.parent.getDisplay().syncExec(new Runnable() {
1076
	//
1077
	//				@Override
1078
	//				public void run() {
1079
	//					try {
1080
	//						refresh(update);
1081
	//					} catch (Exception e) {
1082
	//						// TODO Auto-generated catch block
1083
	//						e.printStackTrace();
1084
	//					}
1085
	//				}
1086
	//			});
1087
	//		}
1088
	//	}
1090 1089

  
1091 1090
	/**
1092 1091
	 * Synchronizes the editor widgets with the result parameters. 
......
1142 1141
			try {
1143 1142
				f.setAccessible(true);
1144 1143
				object = f.get(this);
1145
//				if (object == null) {
1146
//					continue; // widget not set
1147
//				}
1144
				//				if (object == null) {
1145
				//					continue; // widget not set
1146
				//				}
1148 1147
				value = this.getResult().getParameter(parameter.key(), true); // propagate to all parents
1149 1148

  
1150 1149
				if (value == null) {
......
1155 1154
					((ToolItem)object).setSelection((Boolean) value); 
1156 1155
				}
1157 1156
				else if(object instanceof FloatSpinner)	{
1158
					
1157

  
1159 1158
					((FloatSpinner)object).setData(BaseAbstractComputeListener.IGNORE_EVENT, true);
1160
					
1159

  
1161 1160
					if(value instanceof Double) {
1162 1161
						((FloatSpinner)object).setSelection((Double) value);	
1163 1162
					}
1164 1163
					else {
1165 1164
						((FloatSpinner)object).setSelection((Float) value);
1166 1165
					}
1167
					
1166

  
1168 1167
					((FloatSpinner)object).setData(BaseAbstractComputeListener.IGNORE_EVENT, false);
1169 1168
				}
1170 1169
				else if(object instanceof Spinner)	{
......
1705 1704
	 */
1706 1705
	protected void removeComputeButton()	{
1707 1706
		if (this.computeButton != null && !this.computeButton.isDisposed()) {
1708
			
1707

  
1709 1708
			// FIXME: SJ: the contribution should be released before the dispose but this code doesn't seem to work. And without the release the code in createPartControl() that disposes the first line composite  if empty doesn't work
1710
//			IMenuService menuService = (IMenuService) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(IMenuService.class);
1711
//			menuService.releaseContributions((ContributionManager) ((HandledContributionItem) this.computeButton.getData()).getParent());
1712
			
1709
			//			IMenuService menuService = (IMenuService) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(IMenuService.class);
1710
			//			menuService.releaseContributions((ContributionManager) ((HandledContributionItem) this.computeButton.getData()).getParent());
1711

  
1713 1712
			this.computeButton.dispose();
1714 1713
		}
1715 1714
	}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/LangSection.java (revision 1615)
83 83
		int langToSelectIndex = -1;
84 84
		int added = 0;
85 85
		String modelsDir = TreeTaggerPreferences.getInstance().getString(TreeTaggerPreferences.MODELS_PATH);
86
		File files[] = new File(modelsDir).listFiles(IOUtils.FILTER_HIDDEN);
86
		File files[] = new File(modelsDir).listFiles(IOUtils.HIDDENFILE_FILTER);
87 87
		if (files != null && files.length > 0) {
88 88
			for (File model : files) {
89 89
				if (!model.getName().endsWith(".par")) continue;
tmp/org.txm.core.tests/src/org/txm/core/tests/junit/PluginMessages.java (revision 1615)
55 55
		}
56 56

  
57 57
		// test content
58
		File[] files = messagesPackageDirectory.listFiles(IOUtils.FILTER_HIDDEN);
58
		File[] files = messagesPackageDirectory.listFiles(IOUtils.HIDDENFILE_FILTER);
59 59
		if (files == null) {
60 60
			error("No messages class file.");
61 61
			return;
tmp/org.txm.core.tests/src/org/txm/core/tests/junit/PluginExtPoints.java (revision 1615)
36 36
	private void testDeclaredExtPoints(File projectDirectory) throws IOException {
37 37
		File schemaDirectory = new File(projectDirectory, "schema");
38 38
		if (schemaDirectory.exists()) {
39
			for (File schemaXML : schemaDirectory.listFiles(IOUtils.FILTER_HIDDEN)) {
39
			for (File schemaXML : schemaDirectory.listFiles(IOUtils.HIDDENFILE_FILTER)) {
40 40
				if (schemaXML.isDirectory()) continue;
41 41
				ArrayList<String> ids = IOUtils.findWithGroup(schemaXML, "<meta.schema plugin=\"[^\"]+\" id=\"([^\"]+)\" name=\"[^\"]+\"/>", true);
42 42
				ArrayList<String> classes = IOUtils.findWithGroup(schemaXML, "<meta.attribute kind=\"java\" basedOn=\"([^:]+):\"/>", true);
......
88 88

  
89 89
				File schemaDirectory = new File(projectDirectory, "schema");
90 90
				if (schemaDirectory.exists()) {
91
					for (File schemaXML : schemaDirectory.listFiles(IOUtils.FILTER_HIDDEN)) {
91
					for (File schemaXML : schemaDirectory.listFiles(IOUtils.HIDDENFILE_FILTER)) {
92 92
						if (!schemaXML.isFile()) continue;
93 93
						if (!schemaXML.getName().endsWith(".exsd")) continue;
94 94
						ArrayList<String> ids = IOUtils.findWithGroup(schemaXML, "<meta.schema plugin=\"[^\"]+\" id=\"([^\"]+)\" name=\"[^\"]+\"/>", true);
tmp/org.txm.core.tests/src/org/txm/core/tests/junit/PluginPreferences.java (revision 1615)
22 22
		}
23 23
		
24 24
		// test content
25
		File[] files = preferencePackageDirectory.listFiles(IOUtils.FILTER_HIDDEN);
25
		File[] files = preferencePackageDirectory.listFiles(IOUtils.HIDDENFILE_FILTER);
26 26
		if (files == null) {
27 27
			error("No preference class file.");
28 28
			return;
tmp/org.txm.utils/src/org/txm/utils/LangDetector.java (revision 1615)
58 58
	{
59 59
		//println "process $dir"
60 60
		if(dir.isDirectory()) {
61
			for (File file : dir.listFiles(IOUtils.FILTER_HIDDEN))
61
			for (File file : dir.listFiles(IOUtils.HIDDENFILE_FILTER))
62 62
				if (file.isFile())
63 63
					processFile(file);
64 64
		} else {
......
104 104

  
105 105
	public static void configFromModels(File dir)
106 106
	{
107
		File[] files = dir.listFiles(IOUtils.FILTER_HIDDEN);
107
		File[] files = dir.listFiles(IOUtils.HIDDENFILE_FILTER);
108 108
		Arrays.sort(files);
109 109
		for(File f : files)
110 110
			if(f.getName().contains(".lm") && !f.getName().contains("-"))
tmp/org.txm.utils/src/org/txm/utils/CharsetDetector.java (revision 1615)
28 28
	
29 29
	private void processDirectory(File dir)
30 30
	{
31
		for (File file : dir.listFiles(IOUtils.FILTER_HIDDEN)) {
31
		for (File file : dir.listFiles(IOUtils.HIDDENFILE_FILTER)) {
32 32
			if (file.isFile()) {
33 33
				try {
34 34
					processFile(file);
tmp/org.txm.utils/src/org/txm/utils/io/IOUtils.java (revision 1615)
44 44
	/**
45 45
	 * select only files not hidden
46 46
	 */
47
	public static final FileFilter FILTER_HIDDEN = new FileFilter() {
47
	public static final FileFilter HIDDENFILE_FILTER = new FileFilter() {
48 48
		@Override
49 49
		public boolean accept(File file) {
50
			return !file.isHidden();
50
			return !file.isHidden() && !file.getName().startsWith(".") && !file.getName().endsWith("~");
51 51
		}
52 52
	};
53 53
	
......
56 56
	 * @return a list containing the files not hidden
57 57
	 */
58 58
	public List<File> listFiles(File dir) {
59
		File[] files = dir.listFiles(FILTER_HIDDEN);
59
		File[] files = dir.listFiles(HIDDENFILE_FILTER);
60 60
		if (files == null) return new ArrayList<File>();
61 61
		
62 62
		return Arrays.asList(files);
tmp/org.txm.utils/src/org/txm/utils/logger/Log.java (revision 1615)
219 219
	public static void severe(String message) {
220 220
		if (Level.SEVERE.intValue() >= txm.getLevel().intValue()) {
221 221
			System.out.println(message);
222
			System.out.println("STACKTRACE:");
223
			int n = 1;
224
			for (StackTraceElement t : Thread.currentThread().getStackTrace()) {
225
				if (t.getClassName().startsWith("org.txm.") && !t.getClassName().startsWith(Log.class.getName())) {
226
					System.out.println(String.format("[%2d]\t",n++)+t);
227
					//System.out.println(""+(n++)+"\t"+t);
228
				}
229
			}
222 230
		}
231
		
223 232
		txm.severe(message);
224 233
	}
225 234

  
......
241 250
	public static void warning(String message) {
242 251
		if (Level.WARNING.intValue() >= txm.getLevel().intValue()) {
243 252
			System.out.println(message);
253
			System.out.print("AT: ");
254
			int n = 1;
255
			for (StackTraceElement t : Thread.currentThread().getStackTrace()) {
256
				if (t.getClassName().startsWith("org.txm.") && !t.getClassName().startsWith(Log.class.getName())) {
257
					System.out.println(t);
258
					break;
259
				}
260
			}
244 261
		}
245 262
		txm.warning(message);
246 263
	}
tmp/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/PatchCwbRegistry.java (revision 1615)
282 282
			System.out.println("rename "+oldname+".* files to "+newname+".*"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
283 283
			File datadir = new File(datapath);
284 284
			if (datadir.exists()) {
285
				for (File f : datadir.listFiles(IOUtils.FILTER_HIDDEN))
285
				for (File f : datadir.listFiles(IOUtils.HIDDENFILE_FILTER))
286 286
					if (f.getName().startsWith(oldname+".")) //$NON-NLS-1$
... Ce différentiel a été tronqué car il excède la taille maximale pouvant être affichée.

Formats disponibles : Unified diff