Révision 2437

tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/messages/messages_fr.properties (revision 2437)
1
#TXM messages generated by the PluginMessagesManager class
2
#Tue Dec 18 10:24:08 CET 2018
3
error_lineXDoesNotHaveXXolumns=La ligne {0} n''a pas {1} colonne(s).
4
error_marginIsHigherThanThePartitionSize=** Erreur \: les marges sont plus grandes que la somme des parties.
5
error_notEnoughColumns=Pas assez de colonnes ({0}) \: le minimum est deux.
6
info_buildingLexicalTableWith=Construction de la table lexicale avec {0}.
7
RESULT_TYPE=Table lexicale
1
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
2
#TXM messages generated by the PluginMessagesManager class
3
#Tue Dec 18 10:24:08 CET 2018
4

  
5
RESULT_TYPE = Table lexicale
6

  
7
error_lineXDoesNotHaveXXolumns           = La ligne {0} n''a pas {1} colonne(s).
8
error_marginIsHigherThanThePartitionSize = ** Erreur : les marges sont plus grandes que la somme des parties.
9
error_notEnoughColumns                   = Pas assez de colonnes ({0}) : le minimum est deux.
10

  
11
info_buildingLexicalTableWith                                = Calcul de la table lexicale avec {0}.
12
info_creatingLexicalTableWithTheP0PartitionCommaPropertiesP1 = Calcul de la table lexicale avec la partition {0}, propriété [{1}]...
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/messages/LexicalTableCoreMessages.java (revision 2437)
17 17
	
18 18
	public static String info_buildingLexicalTableWith;
19 19
	
20
	public static String info_creatingLexicalTableWithTheP0PartitionCommaPropertiesP1;
21
	
20 22
	public static String error_marginIsHigherThanThePartitionSize;
21 23
	
22 24
	public static String error_notEnoughColumns;
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/messages/messages.properties (revision 2437)
1
#TXM messages generated by the PluginMessagesManager class
2
#Tue Dec 18 10:24:08 CET 2018
3
error_lineXDoesNotHaveXXolumns=Line {0} does not have {1} column(s).
4
error_marginIsHigherThanThePartitionSize=** Error\: margins are larger than the sum of the parts.
5
error_notEnoughColumns=Not enough columns ({0})\: minimum is two.
6
info_buildingLexicalTableWith=Building lexical table with {0}.
7
RESULT_TYPE=Lexical table
1
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
2
#TXM messages generated by the PluginMessagesManager class
3
#Tue Dec 18 10:24:08 CET 2018
4

  
5
RESULT_TYPE = Lexical table
6

  
7
error_lineXDoesNotHaveXXolumns           = Line {0} does not have {1} column(s).
8
error_marginIsHigherThanThePartitionSize = ** Error: margins are larger than the sum of the parts.
9
error_notEnoughColumns                   = Not enough columns ({0}): minimum is two.
10

  
11
info_buildingLexicalTableWith                                = Computing lexical table with {0}.
12
info_creatingLexicalTableWithTheP0PartitionCommaPropertiesP1 = Computing lexical table with the {0} partition, property [{1}]...
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/functions/LexicalTable.java (revision 2437)
185 185
	protected LexicalTableImpl _computeFromPartition(Partition partition) throws Exception {
186 186
		
187 187
		// parts lexicons
188
		List<CQPLexicon> partsLexicons = new ArrayList<CQPLexicon>();
188
		List<CQPLexicon> partsLexicons = new ArrayList<>();
189 189
		for (int i = 0; i < partition.getPartsCount(); i++) {
190 190
			partsLexicons.add(CQPLexicon.getLexicon(partition.getParts().get(i), this.property, this.monitor, false));
191 191
		}
......
193 193
		// Corpus global lexicon
194 194
		CQPLexicon corpusLexicon = CQPLexicon.getLexicon(partition.getParent(), this.property, this.monitor, false);
195 195
		
196
		ArrayList<String> filteredForms = new ArrayList<String>();
196
		ArrayList<String> filteredForms = new ArrayList<>();
197 197
		// create a copy and filter line with Fmin;
198 198
		for (int i = 0; i < corpusLexicon.getFreq().length; i++) {
199 199
			if (corpusLexicon.getFreq()[i] >= this.fMinFilter) {
200 200
				filteredForms.add(corpusLexicon.getForms()[i]);
201 201
			}
202 202
		}
203
		Map<String, Integer> entries2index = new HashMap<String, Integer>();
203
		Map<String, Integer> entries2index = new HashMap<>();
204 204
		for (int i = 0; i < filteredForms.size(); i++) {
205 205
			entries2index.put(filteredForms.get(i), i);
206 206
		}
......
255 255
		
256 256
		this.property = partIndex.getProperties().get(0);
257 257
		
258
		HashMap<String, Line> alllines = new HashMap<String, Line>();
258
		HashMap<String, Line> alllines = new HashMap<>();
259 259
		// merge lines of all indexes
260 260
		for (PartitionIndex voc : indexes) {
261 261
			for (Line l : voc.getAllLines()) {
......
277 277
		List<String> colnames = partIndex.getPartNames();
278 278
		
279 279
		Collection<Line> lines = alllines.values();
280
		List<String> rownames = new ArrayList<String>(lines.size());
280
		List<String> rownames = new ArrayList<>(lines.size());
281 281
		for (Line l : lines) {
282 282
			rownames.add(l.toString());
283 283
		}
......
531 531
		return "";
532 532
	}
533 533
	
534
	
535
	@Override
536
	public String getComputingStartMessage() {
537
		return NLS.bind(LexicalTableCoreMessages.info_creatingLexicalTableWithTheP0PartitionCommaPropertiesP1, this.getPartition().getSimpleName(), this.property);
538
	}
539
	
534 540
	/**
535 541
	 * Gets the columns count.
536 542
	 * 
......
675 681
	// return true;
676 682
	// }
677 683
	
684
	@Override
678 685
	public boolean toTxt(File outfile, String encoding, String colseparator, String txtseparator) {
679 686
		return statsData.toTxt(outfile, encoding, colseparator, txtseparator);
680 687
	}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/CorporaView.java (revision 2437)
85 85
import org.txm.searchengine.cqp.corpus.Partition;
86 86
import org.txm.searchengine.cqp.corpus.Subcorpus;
87 87
import org.txm.utils.logger.Log;
88

  
88 89
//import org.txm.functions.queryindex.QueryIndex;
89 90
//import org.txm.rcp.editors.input.QueryIndexEditorInput;
90 91
//import org.txm.rcp.editors.queryindex.QueryIndexEditor;
......
103 104
 * <p>
104 105
 */
105 106
public class CorporaView extends ViewPart {
106

  
107
	
107 108
	/** The ID. */
108 109
	static public String ID = CorporaView.class.getName();
109

  
110
	
110 111
	/** The tree viewer. */
111 112
	public TreeViewer treeViewer;
112

  
113
	
113 114
	/** The self. */
114 115
	private static CorporaView self;
115

  
116
	
116 117
	/**
117 118
	 * stores the class that are managed by a Doubleclick handler
118 119
	 */
119
	//private static HashMap<Class, Class> managedDoubleClickClasses = new HashMap<Class, Class>();
120

  
121

  
122
	public static HashMap<String, String> doubleClickInstalledCommands = new HashMap<String, String>();
123

  
124

  
125
	//	public static HashMap<Class, Class> getManagedDoubleClickClasses() {
126
	//		return managedDoubleClickClasses;
127
	//	}
128

  
129

  
120
	// private static HashMap<Class, Class> managedDoubleClickClasses = new HashMap<Class, Class>();
121
	
122
	
123
	public static HashMap<String, String> doubleClickInstalledCommands = new HashMap<>();
124
	
125
	
126
	// public static HashMap<Class, Class> getManagedDoubleClickClasses() {
127
	// return managedDoubleClickClasses;
128
	// }
129
	
130
	
130 131
	/**
131 132
	 * Gets the single instance of CorporaView.
132 133
	 *
133 134
	 * @return single instance of CorporaView
134 135
	 */
135
	public static CorporaView getInstance()
136
	{
136
	public static CorporaView getInstance() {
137 137
		if (self == null) {
138 138
			IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
139 139
			if (window == null) return null;
......
144 144
		}
145 145
		return self;
146 146
	}
147

  
147
	
148 148
	public TreeViewer getTreeViewer() {
149 149
		return treeViewer;
150 150
	}
151

  
152

  
151
	
152
	
153 153
	/**
154 154
	 * Reload.
155 155
	 */
156 156
	public static void reload() {
157
		//System.out.println("Reload corpora view");
157
		// System.out.println("Reload corpora view");
158 158
		CorporaView corporaView = getInstance();
159 159
		if (corporaView != null)
160 160
			corporaView._reload();
161 161
	}
162

  
162
	
163 163
	/**
164 164
	 * _reload.
165 165
	 */
166 166
	public void _reload() {
167 167
		if (Toolbox.isInitialized()) {
168

  
168
			
169 169
			treeViewer.setContentProvider(new CorpusViewContentProvider(this));
170 170
			treeViewer.setLabelProvider(new DecoratingLabelProvider(new WorkbenchLabelProvider(), PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()) {
171
				
171 172
				@Override
172 173
				public String getText(Object element) { // cut label if too long
173 174
					String txt = super.getText(element);
174 175
					if (txt != null && txt.length() > TXMEditor.MAX_NAME_LENGTH) {
175
						txt = txt.substring(0, TXMEditor.MAX_NAME_LENGTH-1)+"...";
176
						txt = txt.substring(0, TXMEditor.MAX_NAME_LENGTH - 1) + "...";
176 177
					}
177 178
					return txt;
178 179
				}
179 180
			});
180

  
181
			
181 182
			Workspace w = Toolbox.workspace;
182 183
			if (w == null) {
183 184
				return;
......
186 187
			treeViewer.refresh();
187 188
		}
188 189
	}
189

  
190
	
190 191
	/**
191 192
	 * This is a callback that will allow us to create the viewer and initialize
192 193
	 * it.
......
198 199
		treeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
199 200
		PlatformUI.getWorkbench().getHelpSystem().setHelp(treeViewer.getControl(), TXMUIMessages.corpus);
200 201
		getSite().setSelectionProvider(treeViewer);
201
		treeViewer.setColumnProperties(new String[]{"name"}); // mandatory to enable edit mode -> used to identify columns
202

  
203

  
204
		//		ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(treeViewer) {
205
		//			protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) {
206
		//				System.out.println("activated");
207
		//				return event.keyCode == SWT.F2;
208
		//			}
209
		//		};
210
		//		int f = ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR | 
211
		//			    ColumnViewerEditor.TABBING_VERTICAL |
212
		//			    ColumnViewerEditor.KEYBOARD_ACTIVATION;
213
		//		
214
		//		TreeViewerEditor.create(treeViewer, actSupport, f);
202
		treeViewer.setColumnProperties(new String[] { "name" }); // mandatory to enable edit mode -> used to identify columns
203
		
204
		
205
		// ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(treeViewer) {
206
		// protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) {
207
		// System.out.println("activated");
208
		// return event.keyCode == SWT.F2;
209
		// }
210
		// };
211
		// int f = ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR |
212
		// ColumnViewerEditor.TABBING_VERTICAL |
213
		// ColumnViewerEditor.KEYBOARD_ACTIVATION;
215 214
		//
216
		//		treeViewer.setCellEditors(new CellEditor[]{new TextCellEditor(treeViewer.getTree())});
217
		//		treeViewer.setCellModifier(new ICellModifier() {
215
		// TreeViewerEditor.create(treeViewer, actSupport, f);
218 216
		//
219
		//			@Override
220
		//			public void modify(Object element, String property, Object value) {
221
		//				System.out.println("modify: "+element+" "+property+" "+value);
222
		//				if (element instanceof TreeItem)
223
		//				{
224
		//					//update element and tree model
225
		//					TreeItem treeItem = (TreeItem)element;
226
		//					TXMResult data = (TXMResult)treeItem.getData();
227
		//					data.setUserName(value.toString());
228
		//					treeItem.setText(value.toString());
229
		//				}
230
		//			}
217
		// treeViewer.setCellEditors(new CellEditor[]{new TextCellEditor(treeViewer.getTree())});
218
		// treeViewer.setCellModifier(new ICellModifier() {
231 219
		//
232
		//			@Override
233
		//			public Object getValue(Object element, String property) {
234
		//				if (element instanceof TXMResult) {
235
		//					return ((TXMResult)element).getUserName();
236
		//				}
237
		//				return element.toString();
238
		//			}
220
		// @Override
221
		// public void modify(Object element, String property, Object value) {
222
		// System.out.println("modify: "+element+" "+property+" "+value);
223
		// if (element instanceof TreeItem)
224
		// {
225
		// //update element and tree model
226
		// TreeItem treeItem = (TreeItem)element;
227
		// TXMResult data = (TXMResult)treeItem.getData();
228
		// data.setUserName(value.toString());
229
		// treeItem.setText(value.toString());
230
		// }
231
		// }
239 232
		//
240
		//			@Override
241
		//			public boolean canModify(Object element, String property) {
242
		//				return element instanceof TXMResult;
243
		//			}
244
		//		});
245

  
246
		//		treeViewer.addFilter(new ViewerFilter() {
247
		//			@Override
248
		//			public boolean select(Viewer viewer, Object parentElement, Object element) {
249
		//				if (element instanceof Text) return false;
250
		//				if (element instanceof SavedQuery) return false;
251
		//				return true;
252
		//			}
253
		//		});
233
		// @Override
234
		// public Object getValue(Object element, String property) {
235
		// if (element instanceof TXMResult) {
236
		// return ((TXMResult)element).getUserName();
237
		// }
238
		// return element.toString();
239
		// }
240
		//
241
		// @Override
242
		// public boolean canModify(Object element, String property) {
243
		// return element instanceof TXMResult;
244
		// }
245
		// });
246
		
247
		// treeViewer.addFilter(new ViewerFilter() {
248
		// @Override
249
		// public boolean select(Viewer viewer, Object parentElement, Object element) {
250
		// if (element instanceof Text) return false;
251
		// if (element instanceof SavedQuery) return false;
252
		// return true;
253
		// }
254
		// });
254 255
		treeViewer.setContentProvider(new CorpusViewContentProvider(this));
255 256
		treeViewer.setLabelProvider(new DecoratingLabelProvider(new WorkbenchLabelProvider(), PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()));
256

  
257
		
257 258
		// for now the sorter is used to sort the Corpus, Subcorpus and partition objects
258 259
		treeViewer.setSorter(new ViewerSorter() {
260
			
261
			@Override
259 262
			public int category(Object element) {
260 263
				if (element instanceof Subcorpus) return 2; // must do it before the Corpus test
261 264
				else if (element instanceof CQPCorpus) return 0;
262 265
				else if (element instanceof Partition) return 1;
263 266
				else return 3;
264 267
			}
265

  
268
			
269
			@Override
266 270
			public int compare(Viewer viewer, Object e1, Object e2) {
267

  
271
				
268 272
				int cat1 = category(e1);
269 273
				int cat2 = category(e2);
270

  
274
				
271 275
				if (cat1 != cat2) {
272 276
					return cat1 - cat2;
273 277
				}
274

  
278
				
275 279
				if (e1 instanceof TXMResult && e2 instanceof TXMResult) {
276
					return ((TXMResult)e1).compareTo((TXMResult)e2);
277
				} else {
280
					return ((TXMResult) e1).compareTo((TXMResult) e2);
281
				}
282
				else {
278 283
					return super.compare(viewer, e1, e2);
279 284
				}
280 285
			}
281 286
		});
282

  
287
		
283 288
		if (Toolbox.isInitialized()) {
284 289
			Workspace w = null;
285 290
			while (w == null) {
286 291
				try {
287 292
					Thread.sleep(100);
288
				} catch (InterruptedException e1) {
293
				}
294
				catch (InterruptedException e1) {
289 295
					// TODO Auto-generated catch block
290 296
					org.txm.utils.logger.Log.printStackTrace(e1);
291 297
				}
292 298
				w = Toolbox.workspace;
293
				if (w == null) continue; else break;//return;
299
				if (w == null) continue;
300
				else break;// return;
294 301
			}
295 302
			Project p = w.getProject("default"); //$NON-NLS-1$
296 303
			if (p == null) return;
297 304
			treeViewer.setInput(p);
298 305
		}
299 306
		// FIXME: SJ: to remove?
300
		//PlatformUI.getWorkbench().getHelpSystem().setHelp(treeViewer.getTree(), "org.txm.rcp.corporaView" //$NON-NLS-1$);
301

  
307
		// PlatformUI.getWorkbench().getHelpSystem().setHelp(treeViewer.getTree(), "org.txm.rcp.corporaView" //$NON-NLS-1$);
308
		
302 309
		treeViewer.getTree().addSelectionListener(new SelectionListener() {
303

  
310
			
304 311
			@Override
305 312
			public void widgetSelected(SelectionEvent e) {
306 313
				TreeItem[] sel = treeViewer.getTree().getSelection();
307 314
				if (sel.length == 0)
308 315
					return;
309

  
316
				
310 317
				CorporaView.this.setFocus(); // force focus on the corpora view -> ensure the active selection is the corpora view selection
311 318
				
312 319
				ISelection tsel = treeViewer.getSelection();
313 320
				if (!(tsel instanceof TreeSelection)) return;
314

  
321
				
315 322
				TreeSelection selection = (TreeSelection) treeViewer.getSelection();
316 323
				Object selectedItem = selection.getFirstElement();
317

  
324
				
318 325
				// FIXME : MD tests
319
				//				if (selectedItem instanceof TXMResult) {
320
				//					TXMResult r = ((TXMResult)selectedItem);
321
				//					if (r.compute()) {
322
				//						String mess = r.getSimpleDetails();
323
				//						if (mess == null) mess = selectedItem.toString();
324
				//						StatusLine.setMessage(mess);
325
				//					}
326
				//				}
327

  
326
				// if (selectedItem instanceof TXMResult) {
327
				// TXMResult r = ((TXMResult)selectedItem);
328
				// if (r.compute()) {
329
				// String mess = r.getSimpleDetails();
330
				// if (mess == null) mess = selectedItem.toString();
331
				// StatusLine.setMessage(mess);
332
				// }
333
				// }
334
				
328 335
				// FIXME: SJ tests, define here what to display
329 336
				if (selectedItem instanceof TXMResult) {
330
					//					TXMResult result = ((TXMResult)selectedItem);
331
					//					String mess = result.getSimpleDetails();
332
					//					if (mess == null) {
333
					//						mess = result.getCurrentName();
334
					//					}
335
					//					StatusLine.setMessage(mess);
336
					StatusLine.setMessage(((TXMResult)selectedItem).getComputingDoneMessage());
337
					// TXMResult result = ((TXMResult)selectedItem);
338
					// String mess = result.getSimpleDetails();
339
					// if (mess == null) {
340
					// mess = result.getCurrentName();
341
					// }
342
					// StatusLine.setMessage(mess);
343
					// StatusLine.setMessage(((TXMResult)selectedItem).getComputingDoneMessage());
344
					StatusLine.setMessage(((TXMResult) selectedItem).getDetails());
337 345
				}
338

  
346
				
339 347
			}
340

  
348
			
341 349
			@Override
342 350
			public void widgetDefaultSelected(SelectionEvent e) {
343 351
				// TODO Auto-generated method stub
344 352
			}
345 353
		});
346

  
347

  
348
		// double click listener installation from commands 
354
		
355
		
356
		// double click listener installation from commands
349 357
		IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
350
		ICommandService cmdService = (ICommandService)window.getService(ICommandService.class);
358
		ICommandService cmdService = window.getService(ICommandService.class);
351 359
		Command[] cmds = cmdService.getDefinedCommands();
352 360
		for (int i = 0; i < cmds.length; i++) {
353 361
			try {
354
				if(cmds[i].getReturnType() != null)	{ // RCP hack using the command return type to associate the selection class with the command
362
				if (cmds[i].getReturnType() != null) { // RCP hack using the command return type to associate the selection class with the command
355 363
					Log.fine("CorporaView.createPartControl(): registering command " + cmds[i].getId() + " for TXMResult of type " + cmds[i].getReturnType().getId() + ".");
356 364
					doubleClickInstalledCommands.put(cmds[i].getReturnType().getId(), cmds[i].getId());
357 365
				}
......
361 369
				e1.printStackTrace();
362 370
			}
363 371
		}
364

  
372
		
365 373
		treeViewer.addDoubleClickListener(new IDoubleClickListener() {
374
			
366 375
			@Override
367 376
			public void doubleClick(DoubleClickEvent event) {
368 377
				TreeSelection selection = (TreeSelection) treeViewer.getSelection();
......
371 380
					String commandId = doubleClickInstalledCommands.get(selectedItem.getClass().getName());
372 381
					if (commandId != null) {
373 382
						BaseAbstractHandler.executeCommand(commandId);
374
					} else if (selectedItem instanceof IProject) {
375
						OpenCorpus.open((IProject)selectedItem );
376
					}	else {
383
					}
384
					else if (selectedItem instanceof IProject) {
385
						OpenCorpus.open((IProject) selectedItem);
386
					}
387
					else {
377 388
						if (treeViewer.getExpandedState(selectedItem)) {
378 389
							treeViewer.collapseToLevel(selectedItem, 99);
379
						} else {
390
						}
391
						else {
380 392
							treeViewer.expandToLevel(selectedItem, 99);
381 393
						}
382 394
					}
383 395
				}
384 396
			}
385 397
		});
386

  
398
		
387 399
		treeViewer.getTree().addKeyListener(new KeyAdapter() {
400
			
388 401
			@Override
389 402
			public void keyPressed(KeyEvent arg0) {
390 403
				if (arg0.keyCode == SWT.DEL) {
391 404
					final ISelection sel = treeViewer.getSelection();
392 405
					if (sel instanceof IStructuredSelection) {
393

  
394
						if (!DeleteObject.askContinueToDelete((IStructuredSelection)sel)) return;
395

  
406
						
407
						if (!DeleteObject.askContinueToDelete((IStructuredSelection) sel)) return;
408
						
396 409
						JobHandler job = new JobHandler("Deleting", true) {
397

  
410
							
398 411
							@Override
399 412
							protected IStatus run(IProgressMonitor monitor) {
400 413
								DeleteObject.delete(sel);
401 414
								this.syncExec(new Runnable() {
415
									
402 416
									@Override
403 417
									public void run() {
404 418
										refresh();
......
410 424
						job.schedule();
411 425
						try {
412 426
							job.join();
413
						} catch (InterruptedException e) {
427
						}
428
						catch (InterruptedException e) {
414 429
							e.printStackTrace();
415 430
						}
416 431
					}
417 432
				}
418
				//				else if (arg0.keyCode == SWT.CR || arg0.keyCode == SWT.KEYPAD_CR) {
433
				// else if (arg0.keyCode == SWT.CR || arg0.keyCode == SWT.KEYPAD_CR) {
419 434
				//
420
				//					ISelection isel = treeViewer.getSelection();
421
				//					if (isel instanceof StructuredSelection) {
422
				//						System.out.println("EDIT! "+((StructuredSelection)isel).getFirstElement());
423
				//						treeViewer.editElement(((StructuredSelection)isel).getFirstElement(), 10);
424
				//					}
435
				// ISelection isel = treeViewer.getSelection();
436
				// if (isel instanceof StructuredSelection) {
437
				// System.out.println("EDIT! "+((StructuredSelection)isel).getFirstElement());
438
				// treeViewer.editElement(((StructuredSelection)isel).getFirstElement(), 10);
439
				// }
425 440
				//
426
				//				}
441
				// }
427 442
			}
428 443
		});
429

  
444
		
430 445
		final int IMAGE_MARGIN = 2;
431 446
		final Image icon = IImageKeys.getImage("icons/decorators/bullet_green.png");
432 447
		final Image icon_lock = IImageKeys.getImage("icons/decorators/lock.png");
433

  
448
		
434 449
		// FIXME: test to show icon for results that are user persistable
435
		//		    final Image icon = AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.gef","platform:/plugin/org.eclipse.gef/org/eclipse/gef/internal/icons/pinned.gif").createImage();
436
		//		    final Image icon = AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.team.svn.help","platform:/plugin/org.eclipse.team.svn.help/images/lock.gif").createImage();
437

  
438

  
439

  
440
		//		 	treeViewer.getTree().addListener(SWT.MeasureItem, new Listener() {
441
		//		 	   public void handleEvent(Event event) {
442
		//		 	      TreeItem item = (TreeItem)event.item;
443
		//		 	      Image trailingImage = (Image)item.getImage();
444
		//		 	      if (trailingImage != null) {
445
		//		 	         event.width += trailingImage.getBounds().width + IMAGE_MARGIN;
446
		//		 	      }
447
		//		 	   }
448
		//		 	});
450
		// final Image icon = AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.gef","platform:/plugin/org.eclipse.gef/org/eclipse/gef/internal/icons/pinned.gif").createImage();
451
		// final Image icon = AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.team.svn.help","platform:/plugin/org.eclipse.team.svn.help/images/lock.gif").createImage();
452
		
453
		
454
		
455
		// treeViewer.getTree().addListener(SWT.MeasureItem, new Listener() {
456
		// public void handleEvent(Event event) {
457
		// TreeItem item = (TreeItem)event.item;
458
		// Image trailingImage = (Image)item.getImage();
459
		// if (trailingImage != null) {
460
		// event.width += trailingImage.getBounds().width + IMAGE_MARGIN;
461
		// }
462
		// }
463
		// });
449 464
		treeViewer.getTree().addListener(SWT.PaintItem, new Listener() {
465
			
466
			@Override
450 467
			public void handleEvent(Event event) {
451
				if (event.item.getData() instanceof TXMResult && ((TXMResult)event.item.getData()).isLocked())	{
452
					TreeItem item = (TreeItem)event.item;
453
					Image trailingImage = (Image)item.getImage();
468
				if (event.item.getData() instanceof TXMResult && ((TXMResult) event.item.getData()).isLocked()) {
469
					TreeItem item = (TreeItem) event.item;
470
					Image trailingImage = item.getImage();
454 471
					if (trailingImage != null) {
455 472
						int x = 3 + event.x + event.width;
456 473
						int itemHeight = treeViewer.getTree().getItemHeight();
457 474
						int imageHeight = trailingImage.getBounds().height;
458
						int y = 2+event.y + (itemHeight - imageHeight) / 2;
459

  
460
						event.gc.drawImage(icon_lock, x, y); 
475
						int y = 2 + event.y + (itemHeight - imageHeight) / 2;
476
						
477
						event.gc.drawImage(icon_lock, x, y);
461 478
					}
462 479
				}
463 480
			}
464 481
		});
465

  
482
		
466 483
		MenuManager menuManager = new MenuManager();
467 484
		Menu menu = menuManager.createContextMenu(treeViewer.getTree());
468

  
485
		
469 486
		// Set the MenuManager
470 487
		treeViewer.getTree().setMenu(menu);
471 488
		getSite().registerContextMenu(menuManager, treeViewer);
472 489
		// Make the selection available
473 490
		getSite().setSelectionProvider(treeViewer);
474

  
475
		IContextService contextService = (IContextService)getSite().getService(IContextService.class);
491
		
492
		IContextService contextService = getSite().getService(IContextService.class);
476 493
		contextService.activateContext(ID);
477 494
	}
478

  
479

  
495
	
496
	
480 497
	/**
481 498
	 * Passing the focus request to the viewer's control.
482 499
	 */
......
484 501
	public void setFocus() {
485 502
		treeViewer.getControl().setFocus();
486 503
	}
487

  
504
	
488 505
	/**
489 506
	 * Gets the first selected object in the tree.
507
	 * 
490 508
	 * @return
491 509
	 */
492 510
	public static Object getFirstSelectedObject() {
......
495 513
			try {
496 514
				ISelection selection = corporaView.treeViewer.getSelection();
497 515
				if (selection != null & selection instanceof IStructuredSelection) {
498
					return ((IStructuredSelection)selection).getFirstElement();
516
					return ((IStructuredSelection) selection).getFirstElement();
499 517
				}
500
			} catch (SWTException e) {}
518
			}
519
			catch (SWTException e) {
520
			}
501 521
		}
502 522
		return null;
503 523
	}
504

  
524
	
505 525
	/**
506 526
	 * Gets the selected objects in the tree.
527
	 * 
507 528
	 * @return
508 529
	 */
509 530
	public static List<?> getSelectedObjects() {
......
512 533
			try {
513 534
				ISelection selection = corporaView.treeViewer.getSelection();
514 535
				if (selection != null & selection instanceof IStructuredSelection) {
515
					return ((IStructuredSelection)selection).toList();
536
					return ((IStructuredSelection) selection).toList();
516 537
				}
517
			} catch (SWTException e) {}
538
			}
539
			catch (SWTException e) {
540
			}
518 541
		}
519 542
		return null;
520 543
	}
521

  
544
	
522 545
	/**
523 546
	 * Selects some items.
547
	 * 
524 548
	 * @param arrayList
525 549
	 */
526 550
	public static void select(List<?> arrayList) {
......
531 555
			corporaView.getTreeViewer().reveal(arrayList); // to be sure
532 556
		}
533 557
	}
534

  
558
	
535 559
	/**
536 560
	 * Opens the Corpora view if not already opened.
561
	 * 
537 562
	 * @return the corpora view if opened
538 563
	 */
539 564
	public static CorporaView openView() {
......
548 573
				System.out.println("Error Unite view not found: " + CorporaView.ID);
549 574
			}
550 575
			return view;
551
		} catch (PartInitException e) {
576
		}
577
		catch (PartInitException e) {
552 578
			e.printStackTrace();
553 579
		}
554 580
		return null;
555 581
	}
556

  
557

  
582
	
583
	
558 584
	/**
559 585
	 * Refresh the tree view.
560 586
	 */
......
563 589
		if (corporaView != null) {
564 590
			corporaView.treeViewer.refresh();
565 591
			corporaView.treeViewer.getTree().redraw();
566
			//corporaView.treeViewer.expandAll(); // FIXME
592
			// corporaView.treeViewer.expandAll(); // FIXME
567 593
		}
568 594
	}
569

  
595
	
570 596
	/**
571 597
	 * Refreshes the view and the tree.
572 598
	 *
......
575 601
	public static void refresh(CorporaView corporaView) {
576 602
		corporaView.treeViewer.refresh();
577 603
	}
578

  
579

  
580

  
604
	
605
	
606
	
581 607
	/**
582 608
	 * Refreshes the specified result node in the tree view.
609
	 * 
583 610
	 * @param result
584 611
	 */
585 612
	public static void refreshObject(final TXMResult result) {
586 613
		Display.getDefault().syncExec(new Runnable() {
614
			
587 615
			@Override
588 616
			public void run() {
589

  
590
				//FIXME: Debug
591
				//				System.err.println("CorporaView.refreshObject(...).new Runnable() {...}.run(): refreshing node " + result);
592
				//				System.err.println("CorporaView.refreshObject(...).new Runnable() {...}.run(): direct parent " + result.getParent());
593
				//				System.err.println("CorporaView.refreshObject(...).new Runnable() {...}.run(): path " + result.getFullPathSimpleName());
594

  
617
				
618
				// FIXME: Debug
619
				// System.err.println("CorporaView.refreshObject(...).new Runnable() {...}.run(): refreshing node " + result);
620
				// System.err.println("CorporaView.refreshObject(...).new Runnable() {...}.run(): direct parent " + result.getParent());
621
				// System.err.println("CorporaView.refreshObject(...).new Runnable() {...}.run(): path " + result.getFullPathSimpleName());
622
				
595 623
				CorporaView corporaView = getInstance();
596
				corporaView.treeViewer.refresh(); // FIXME: without that the refresh sometimes doesn't work, need to investigate (after some test it may occurs when a hierarchy of more than one result is created. Need to refresh all the hierarchy result one by one?)
597

  
624
				corporaView.treeViewer.refresh(); // FIXME: without that the refresh sometimes doesn't work, need to investigate (after some test it may occurs when a hierarchy of more than one result
625
													 // is created. Need to refresh all the hierarchy result one by one?)
626
				
598 627
				corporaView.treeViewer.refresh(result);
599

  
628
				
600 629
				try {
601 630
					CorporaView.expand(result.getParent());
602 631
				}
603
				catch(NullPointerException e) {
632
				catch (NullPointerException e) {
604 633
				}
605 634
			}
606 635
		});
607 636
	}
608

  
637
	
609 638
	/**
610 639
	 * Refreshes the specified result node in the tree view, also synchronizes the TXMResult and the TXMEditor (as the editor part name from the result name, for example).
640
	 * 
611 641
	 * @param editor
612 642
	 */
613 643
	public static void refreshObject(TXMEditor editor) {
614 644
		refreshObject(editor.getResult());
615 645
	}
616

  
646
	
617 647
	/**
618 648
	 * Expands the specified tree node.
649
	 * 
619 650
	 * @param obj
620 651
	 */
621
	public static void expand(Object obj)	{
652
	public static void expand(Object obj) {
622 653
		final CorporaView corporaView = getInstance();
623 654
		if (obj != null) {
624 655
			corporaView.treeViewer.expandToLevel(obj, 1);
625 656
		}
626 657
	}
627

  
658
	
628 659
	public static void focus(TXMResult obj) {
629 660
		final CorporaView corporaView = getInstance();
630 661
		if (obj != null && corporaView != null) {
631 662
			corporaView.treeViewer.reveal(obj);
632 663
		}
633 664
	}
634

  
665
	
635 666
	public static boolean isFocused() {
636 667
		IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
637 668
		if (window == null) return false;
638 669
		IWorkbenchPage page = window.getActivePage();
639 670
		if (page == null) return false;
640

  
671
		
641 672
		IWorkbenchPart part = page.getActivePart();
642 673
		return part.getSite().getId().equals(CorporaView.ID);
643 674
	}
644
}
675
}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/debug/TXMResultDebugView.java (revision 2437)
117 117
		buffer.append("Dirty: " + this.currentResult.isDirty() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
118 118
		buffer.append("Altered: " + this.currentResult.isAltered() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
119 119
		buffer.append("Has been computed once: " + this.currentResult.hasBeenComputedOnce() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
120
		buffer.append("Must be sync with parent: " + this.currentResult.mustBeSynchronizedWithParent() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
120 121
//		if (this.currentResult instanceof ChartResult) 	{
121 122
//			buffer.append("Chart dirty: " + ((ChartResult)this.currentResult).isChartDirty() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
122 123
//		}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/cmdparameters/ParametersComposite.java (revision 2437)
27 27
import org.txm.rcp.swt.GLComposite;
28 28

  
29 29
public class ParametersComposite extends GLComposite {
30

  
30
	
31 31
	private TreeViewer tv;
32
	
32 33
	private TreeViewerColumn nameColumn;
34
	
33 35
	private TreeViewerColumn valueColumn;
36
	
34 37
	private TextCellEditor cellEditor;
35 38
	
36 39
	public static String DEFAULT_REFS = "class,user_name";
40
	
37 41
	private String[] references = DEFAULT_REFS.split(",");
38 42
	
39 43
	public ParametersComposite(Composite parent, int style) {
......
44 48
		tv.getTree().setHeaderVisible(true);
45 49
		tv.getTree().setLinesVisible(true);
46 50
		tv.setContentProvider(new ITreeContentProvider() {
47

  
51
			
48 52
			@Override
49 53
			public Object[] getElements(Object inputElement) {
50 54
				if (inputElement instanceof String) {
51 55
					String npath = inputElement.toString();
52 56
					Object[] children = getChildren(TXMPreferences.preferencesRootNode.node(npath));
53 57
					return children;
54
				} else if (inputElement instanceof Project) {
55
					Project project = (Project)inputElement;
56
					IEclipsePreferences prefs = project.getPreferencesScope().getNode("/project/"+project.getName());
58
				}
59
				else if (inputElement instanceof Project) {
60
					Project project = (Project) inputElement;
61
					IEclipsePreferences prefs = project.getPreferencesScope().getNode("/project/" + project.getName());
57 62
					return getChildren(prefs);
58
				} else if (inputElement instanceof TXMResult) {
59
					TXMResult result = (TXMResult)inputElement;
60
					//return new Object[] {TXMPreferences.preferencesRootNode.node(result.getParametersNodePath())};
63
				}
64
				else if (inputElement instanceof TXMResult) {
65
					TXMResult result = (TXMResult) inputElement;
66
					// return new Object[] {TXMPreferences.preferencesRootNode.node(result.getParametersNodePath())};
61 67
					return getChildren(TXMPreferences.preferencesRootNode.node(result.getParametersNodePath()));
62
				}  else if (inputElement instanceof IProject) {
68
				}
69
				else if (inputElement instanceof IProject) {
63 70
					IProject project = (IProject) inputElement;
64
					return getChildren(TXMPreferences.preferencesRootNode.node("/"+project.getName()));
71
					return getChildren(TXMPreferences.preferencesRootNode.node("/" + project.getName()));
65 72
				}
66 73
				
67 74
				return new Object[0];
68 75
			}
69

  
76
			
70 77
			@Override
71 78
			public Object[] getChildren(Object parentElement) {
72 79
				if (parentElement instanceof Preferences) {
73
					Preferences prefs = (Preferences)parentElement;
80
					Preferences prefs = (Preferences) parentElement;
74 81
					try {
75
						ArrayList<Object> children = new ArrayList<Object>();
82
						ArrayList<Object> children = new ArrayList<>();
76 83
						String[] nodes = prefs.childrenNames();
77 84
						Arrays.sort(nodes);
78 85
						for (String n : nodes) {
......
80 87
						}
81 88
						
82 89
						String[] attributes = null;
83
						if (RCPPreferences.getInstance().getBoolean(RCPPreferences.EXPERT_USER)) {
84
							
85
						} else {
86
							attributes = prefs.keys();
87
						}
90
						// FIXME: SJ => MD, I commented this atm
91
						// if (RCPPreferences.getInstance().getBoolean(RCPPreferences.EXPERT_USER)) {
92
						//
93
						// } else {
94
						attributes = prefs.keys();
95
						// }
88 96
						Arrays.sort(attributes);
89 97
						for (String name : attributes) {
90
							children.add(new Object[] {prefs, name});
98
							children.add(new Object[] { prefs, name });
91 99
						}
92 100
						return children.toArray();
93
					} catch (BackingStoreException e) {
101
					}
102
					catch (BackingStoreException e) {
94 103
						e.printStackTrace();
95 104
					}
96 105
				}
97 106
				return null;
98 107
			}
99

  
108
			
100 109
			@Override
101 110
			public Object getParent(Object element) {
102 111
				if (element instanceof Preferences) {
103
					Preferences prefs = (Preferences)element;
112
					Preferences prefs = (Preferences) element;
104 113
					return prefs.parent();
105 114
				}
106 115
				return null;
107 116
			}
108

  
117
			
109 118
			@Override
110 119
			public boolean hasChildren(Object element) {
111 120
				if (element instanceof Preferences) {
112
					Preferences prefs = (Preferences)element;
121
					Preferences prefs = (Preferences) element;
113 122
					try {
114 123
						return prefs.childrenNames().length > 0 || prefs.keys().length > 0;
115
					} catch (BackingStoreException e) {
124
					}
125
					catch (BackingStoreException e) {
116 126
						// TODO Auto-generated catch block
117 127
						e.printStackTrace();
118 128
					}
......
126 136
		nameColumn.getColumn().setText("node");
127 137
		nameColumn.getColumn().pack();
128 138
		nameColumn.setLabelProvider(new CellLabelProvider() {
129

  
139
			
130 140
			@Override
131 141
			public void update(ViewerCell cell) {
132 142
				Object element = cell.getElement();
133

  
143
				
134 144
				if (element instanceof Preferences) {
135
					Preferences c = (Preferences)element;
145
					Preferences c = (Preferences) element;
136 146
					if (references != null && references.length > 0) {
137
						ArrayList<String> values = new ArrayList<String>();
147
						ArrayList<String> values = new ArrayList<>();
138 148
						for (String k : references) {
139 149
							if (c.get(k, null) != null) {
140 150
								values.add(c.get(k, null));
......
143 153
						
144 154
						if (values.size() == 0) values.add(c.name());
145 155
						cell.setText(StringUtils.join(values, ", "));
146
					} else {
156
					}
157
					else {
147 158
						cell.setText(c.name());
148 159
					}
149
				} else if (element instanceof Object[]) {
150
					Object[] c = (Object[])element;
160
				}
161
				else if (element instanceof Object[]) {
162
					Object[] c = (Object[]) element;
151 163
					
152 164
					cell.setText(c[1].toString());
153
				} else {
165
				}
166
				else {
154 167
					cell.setText(element.toString());
155 168
				}
156 169
			}
......
160 173
		valueColumn.getColumn().setText("value");
161 174
		valueColumn.getColumn().pack();
162 175
		valueColumn.setLabelProvider(new CellLabelProvider() {
163

  
176
			
164 177
			@Override
165 178
			public void update(ViewerCell cell) {
166 179
				Object element = cell.getElement();
167

  
180
				
168 181
				if (element instanceof Preferences) {
169
					Preferences c = (Preferences)element;
182
					Preferences c = (Preferences) element;
170 183
					cell.setText("");
171
				} else if (element instanceof Object[]) {
172
					Object[] c = (Object[])element;
184
				}
185
				else if (element instanceof Object[]) {
186
					Object[] c = (Object[]) element;
173 187
					Preferences p = (Preferences) c[0];
174 188
					cell.setText(p.get(c[1].toString(), ""));
175
				} else {
189
				}
190
				else {
176 191
					cell.setText(element.toString());
177 192
				}
178 193
			}
......
180 195
		
181 196
		cellEditor = new TextCellEditor(tv.getTree());
182 197
		valueColumn.setEditingSupport(new EditingSupport(tv) {
183

  
184
	        @Override
185
	        protected void setValue(Object element, Object value) {
186
	        	if (element instanceof Object[]) {
187
	            	Object[] data = (Object[]) element;
188
	            	Preferences prefs = (Preferences) data[0];
189
	            	String key = data[1].toString();
190
	            	prefs.put(key, value.toString());
191
	            	tv.refresh(element);
192
	            	
193
	            }
194
	        	return;
195
	        }
196

  
197
	        @Override
198
	        protected Object getValue(Object element) {
199
	        	if (element instanceof Object[]) {
200
	            	Object[] data = (Object[]) element;
201
	            	Preferences prefs = (Preferences) data[0];
202
	            	String key = data[1].toString();
203
	            	return prefs.get(key, "");
204
	            }
205
	        	return null;
206
	        }
207

  
208
	        @Override
209
	        protected TextCellEditor getCellEditor(Object element) {
210
	            return cellEditor;
211
	        }
212

  
213
	        @Override
214
	        protected boolean canEdit(Object element) {
215
	            return element instanceof Object[];
216
	        }
217
	    });
198
			
199
			@Override
200
			protected void setValue(Object element, Object value) {
201
				if (element instanceof Object[]) {
202
					Object[] data = (Object[]) element;
203
					Preferences prefs = (Preferences) data[0];
204
					String key = data[1].toString();
205
					prefs.put(key, value.toString());
206
					tv.refresh(element);
207
					
208
				}
209
				return;
210
			}
211
			
212
			@Override
213
			protected Object getValue(Object element) {
214
				if (element instanceof Object[]) {
215
					Object[] data = (Object[]) element;
216
					Preferences prefs = (Preferences) data[0];
217
					String key = data[1].toString();
218
					return prefs.get(key, "");
219
				}
220
				return null;
221
			}
222
			
223
			@Override
224
			protected TextCellEditor getCellEditor(Object element) {
225
				return cellEditor;
226
			}
227
			
228
			@Override
229
			protected boolean canEdit(Object element) {
230
				return element instanceof Object[];
231
			}
232
		});
218 233
	}
219 234
	
220 235
	
221

  
236
	
222 237
	public void updateEditorParameters(Object input) {
223 238
		tv.setInput(input);
224 239
		nameColumn.getColumn().pack();
225 240
		valueColumn.getColumn().pack();
226 241
	}
227

  
228

  
229

  
242
	
243
	
244
	
230 245
	public void refresh() {
231 246
		tv.refresh();
232 247
	}
233

  
248
	
234 249
	public void setReferences(String[] split) {
235 250
		references = split;
236 251
	}
237

  
252
	
238 253
	public Object getInput() {
239 254
		return tv.getInput();
240 255
	}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/utils/SWTEditorsUtils.java (revision 2437)
7 7
import java.util.HashSet;
8 8

  
9 9
import org.eclipse.core.commands.ExecutionEvent;
10
import org.eclipse.e4.ui.internal.workbench.E4Workbench;
11
import org.eclipse.e4.ui.model.application.MApplication;
10 12
import org.eclipse.e4.ui.model.application.ui.MUIElement;
11 13
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
12 14
import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainerElement;
13 15
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
14 16
import org.eclipse.e4.ui.model.application.ui.basic.MStackElement;
15 17
import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicFactoryImpl;
16
import org.eclipse.e4.ui.model.application.ui.basic.impl.PartSashContainerImpl;
17 18
import org.eclipse.e4.ui.workbench.modeling.EModelService;
19
import org.eclipse.swt.custom.CTabFolder;
18 20
import org.eclipse.ui.IEditorInput;
19 21
import org.eclipse.ui.IEditorPart;
20 22
import org.eclipse.ui.IEditorReference;
......
26 28
import org.txm.core.results.TXMResult;
27 29
import org.txm.rcp.editors.ITXMResultEditor;
28 30
import org.txm.rcp.editors.TXMMultiPageEditor;
29
import org.txm.rcp.editors.TXMResultEditorInput;
31
import org.txm.rcp.views.corpora.CorporaView;
30 32

  
31 33
/**
32 34
 * Utility class to manage EditorPart.
......
238 240
		EModelService service = window.getService(EModelService.class);
239 241
		
240 242
		MUIElement parent = parentPart.getParent();
243
		
244
		
241 245
		while (!(parent instanceof MPartSashContainerElement)) {
242 246
			parent = parent.getParent();
243 247
		}
248
		
249
		// FIXME: SJ: tests to open an editor in a View, to see if it's possible to use a View for the multipage editor (eg. for CA)
250
		// parent = service.getContainer(CorporaView.getInstance().getSite().getService(MPart.class));
251
		// parent.getParent().getChildren().add(partToAdd);
252
		// CTabFolder widget = (CTabFolder) parent.getWidget();
253
		// System.out.println("SWTEditorsUtils.addPart(): widget of Corpora view = " + widget);
254
		
255
		
244 256
		MPartSashContainerElement sashContainer = (MPartSashContainerElement) parent;
245 257
		
246 258
		MPartStack stackToInsert = createPartStack(partToAdd);
247 259
		
248 260
		// TODO find out why the insert method always create a new sash
249 261
		service.insert(stackToInsert, sashContainer, position, percent);
262
		
263
		
250 264
	}
251 265
	
252 266
	/**
......
256 270
	 * @return
257 271
	 */
258 272
	private static MPartStack createPartStack(MPart part) {
273
		
274
		// FIXME: SJ: tests to try to add some editor to view or parent shash container
275
		// IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
276
		// EModelService service = window.getService(EModelService.class);
277
		// // MPerspective p = service.getActivePerspective(window);
278
		//
279
		// MPerspective p = service.getContainer(CorporaView.getInstance().getSite().getService(MPart.class));
280
		//
281
		// // part = CorporaView.getInstance().getSite().getService(MPart.class);
282
		
283
		
259 284
		MStackElement stackElement = part;
260 285
		
261 286
		MPartStack stack = BasicFactoryImpl.eINSTANCE.createPartStack();
tmp/org.txm.rcp/src/main/java/org/txm/rcp/actions/CreateSubcorpusDialog.java (revision 2437)
52 52
import org.txm.searchengine.cqp.corpus.CQPCorpus;
53 53
import org.txm.searchengine.cqp.corpus.StructuralUnit;
54 54
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
55
import org.txm.utils.logger.Log;
55 56

  
56 57
/**
57 58
 * Allow the user to create a Sub-corpus 2 mode : Simple : he can choose a
......
240 241
		if (name.getText().length() == 0) {
241 242
			String generated = "subcorpus"; //$NON-NLS-1$
242 243
			
243
			System.out.println(TXMUIMessages.noSubcorpusNameWasSpecifiedWeveGeneratedOne);
244
			Log.info(TXMUIMessages.noSubcorpusNameWasSpecifiedWeveGeneratedOne);
244 245
			if (isAdvancedSelected()) {
245 246
				generated += "" + (this.corpus.getSubcorpora().size() + 1); //$NON-NLS-1$
246 247
			}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 2437)
855 855
	@Override
856 856
	public JobHandler compute(final boolean update) {
857 857
		
858
		StatusLine.setMessage(TXMCoreMessages.bind(TXMUIMessages.computing, this.getResult().getName()));
858
		StatusLine.setMessage(this.getResult().getComputingStartMessage());
859 859
		
860 860
		// FIXME: SJ: long process simulation to test the Job cancelation or UI progress dialog visibility
861 861
		// try {
......
1001 1001
					}
1002 1002
					
1003 1003
					// computing result
1004
					monitor.beginTask(TXMUIMessages.computing_3, 100);
1004
					monitor.beginTask(TXMEditor.this.getResult().getComputingStartMessage(), 100);
1005 1005
					
1006 1006
					notifyExtensions("notifyStartOfCompute"); //$NON-NLS-1$
1007 1007
					
1008 1008
					// user log info
1009
					if (update && TXMEditor.this.getResult().canCompute() && !TXMEditor.this.getResult().getComputingStartMessage().isEmpty()) {
1010
						Log.info(TXMEditor.this.getResult().getComputingStartMessage());
1011
					}
1009
					// if (
1010
					// // update &&
1011
					// TXMEditor.this.getResult().canCompute() && !TXMEditor.this.getResult().getComputingStartMessage().isEmpty()) {
1012
					// Log.info(TXMEditor.this.getResult().getComputingStartMessage());
1013
					// }
1012 1014
					
1013 1015
					if (!TXMEditor.this.getResult().compute(monitor)) {
1014 1016
						Log.fine("TXMEditor.compute(): " + TXMEditor.this.getClass().getSimpleName() + ": computing failed.");
1015 1017
					}
1016 1018
					// user log info
1017
					else if (update && !TXMEditor.this.getResult().getComputingDoneMessage().isEmpty()) {
1018
						Log.info(TXMEditor.this.getResult().getComputingDoneMessage());
1019
					}
1019
					// else if (
1020
					// // update &&
1021
					// !TXMEditor.this.getResult().getComputingDoneMessage().isEmpty()) {
1022
					// Log.info(TXMEditor.this.getResult().getComputingDoneMessage());
1023
					// }
1020 1024
					
1021 1025
					
1022 1026
					notifyExtensions("notifyEndOfCompute"); //$NON-NLS-1$
......
1035 1039
								// focus in the main widget
1036 1040
								setFocus();
1037 1041
								
1038
								StatusLine.setMessage(null);
1042
								StatusLine.setMessage(TXMEditor.this.getResult().getComputingDoneMessage());
1039 1043
								
1040 1044
								// FIXME: SJ: tests to enable/disable the editor widgets when computing
1041 1045
								// recursiveSetEnabled(true);
tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/messages/messages.properties (revision 2437)
1
#TXM messages generated by the PluginMessagesManager class
2
#Tue Dec 18 10:24:08 CET 2018
3
deletingQueryResultP0=Deleting query result {0}…
4
deletingSubcorpusP0=Deleting sub-corpus {0}…
5
info_creatingNewPartition=Creating partition {1} of corpus {0}…
6
info_creatingSubcorpusXFromCorpusYWithTheQueryZ=Creating sub-corpus {0} of corpus {1} with the query {2}…
7
info_deletingPartition=Deleting partition {0}…
8
info_partCreatedInXMs=Part {0} created in {1} ms.
9
info_partitionCreatedInXMs=Partition {0} created in {1} ms.
10
info_partXCreatedWithQueryZ=Part {0} created with query {1}.
11
info_searchEngineStopped=Search engine stopped.
12
info_stoppingSearchEngine=Stopping the search engine…
13
sizeOfSubcorpusP0P1ComputedInP2Ms=Size of subcorpus {0} ({1}) computed in {2} ms.
14
subcorpusP0CreatedInP1Ms=Sub-corpus {0} created in {1} ms.
1
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
2
#TXM messages generated by the PluginMessagesManager class
3
#Tue Dec 18 10:24:08 CET 2018
4

  
5
deletingQueryResultP0 = Deleting query result {0}…
6

  
7
deletingSubcorpusP0 = Deleting sub-corpus {0}…
8

  
9
info_computingTheP0SubCorpusOfP1CommaQueryP2                           = Computing the {0} sub-corpus of {1}, query: {2}...
10
info_computingTheP0SubCorpusOfP1CommaStructureP2CommaPropertyP3ColonP4 = Computing the {0} sub-corpus of {1}, structure {2}, property {3}: {4}...
11
info_creatingNewPartition                                              = Creating partition {1} of corpus {0}…
12
info_creatingSubcorpusXFromCorpusYWithTheQueryZ                        = Creating sub-corpus {0} of corpus {1} with the query {2}…
13
info_deletingPartition                                                 = Deleting partition {0}…
14
info_partCreatedInXMs                                                  = Part {0} created in {1} ms.
15
info_partXCreatedWithQueryZ                                            = Part {0} created with query {1}.
16
info_partitionCreatedInXMs                                             = Partition {0} created in {1} ms.
17
info_searchEngineStopped                                               = Search engine stopped.
18
info_stoppingSearchEngine                                              = Stopping the search engine…
19

  
20
sizeOfSubcorpusP0P1ComputedInP2Ms = Size of subcorpus {0} ({1}) computed in {2} ms.
21

  
22
subcorpusP0CreatedInP1Ms = Sub-corpus {0} created in {1} ms.
tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/messages/messages_fr.properties (revision 2437)
1
#TXM messages generated by the PluginMessagesManager class
2
#Tue Dec 18 10:24:08 CET 2018
3
deletingQueryResultP0=Suppression du résultat de requête {0}…
4
deletingSubcorpusP0=Suppression du sous-corpus {0}…
5
info_creatingNewPartition=Création de la partition {1} du corpus {0}…
6
info_creatingSubcorpusXFromCorpusYWithTheQueryZ=Création du sous-corpus {0} du corpus {1} avec la requête {2}…
7
info_deletingPartition=Suppression de la partition {0}…
8
info_partCreatedInXMs=Partie {0} créée en {1} ms.
9
info_partitionCreatedInXMs=Partition {0} créée en {1} ms.
10
info_partXCreatedWithQueryZ=Partie {0} créée avec la requête {1}.
11
info_searchEngineStopped=Moteur de recherche arrêté.
12
info_stoppingSearchEngine=Arrêt du moteur de recherche…
13
sizeOfSubcorpusP0P1ComputedInP2Ms=Taille du sous-corpus {0} ({1}) calculée en {2} ms.
14
subcorpusP0CreatedInP1Ms=Sous-corpus {0} créé en {1} ms.
1
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
2
#TXM messages generated by the PluginMessagesManager class
3
#Tue Dec 18 10:24:08 CET 2018
4

  
5
deletingQueryResultP0 = Suppression du résultat de requête {0}…
6

  
7
deletingSubcorpusP0 = Suppression du sous-corpus {0}…
8

  
9
info_computingTheP0SubCorpusOfP1CommaQueryP2                           = Calcul du sous-corpus {0} de {1}, requête : [{2}]...
10
info_computingTheP0SubCorpusOfP1CommaStructureP2CommaPropertyP3ColonP4 = Calcul du sous-corpus {0} de {1}, structure {2}, propriété {3} : {4}...
11
info_creatingNewPartition                                              = Création de la partition {1} du corpus {0}…
12
info_creatingSubcorpusXFromCorpusYWithTheQueryZ                        = Création du sous-corpus {0} du corpus {1} avec la requête {2}…
13
info_deletingPartition                                                 = Suppression de la partition {0}…
14
info_partCreatedInXMs                                                  = Partie {0} créée en {1} ms.
15
info_partXCreatedWithQueryZ                                            = Partie {0} créée avec la requête {1}.
16
info_partitionCreatedInXMs                                             = Partition {0} créée en {1} ms.
17
info_searchEngineStopped                                               = Moteur de recherche arrêté.
18
info_stoppingSearchEngine                                              = Arrêt du moteur de recherche…
19

  
20
sizeOfSubcorpusP0P1ComputedInP2Ms = Taille du sous-corpus {0} ({1}) calculée en {2} ms.
21

  
22
subcorpusP0CreatedInP1Ms = Sous-corpus {0} créé en {1} ms.
tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/messages/SearchEngineCoreMessages.java (revision 2437)
12 12
 *
13 13
 */
14 14
public class SearchEngineCoreMessages extends NLS {
15

  
15
	
16 16
	private static final String BUNDLE_NAME = "org.txm.searchengine.core.messages.messages"; //$NON-NLS-1$
17

  
17
	
18 18
	public static String info_creatingNewPartition;
19
	
19 20
	public static String info_deletingPartition;
21
	
20 22
	public static String info_partCreatedInXMs;
23
	
21 24
	public static String info_partitionCreatedInXMs;
22
	public static String deletingQueryResultP0; 
25
	
26
	public static String deletingQueryResultP0;
27
	
23 28
	public static String info_partXCreatedWithQueryZ;
29
	
24 30
	public static String info_creatingSubcorpusXFromCorpusYWithTheQueryZ;
25
	public static String deletingSubcorpusP0; 
26
	public static String sizeOfSubcorpusP0P1ComputedInP2Ms; 
31
	
32
	public static String info_computingTheP0SubCorpusOfP1CommaStructureP2CommaPropertyP3ColonP4;
33
	
34
	public static String info_computingTheP0SubCorpusOfP1CommaQueryP2;
35
	
36
	public static String deletingSubcorpusP0;
37
	
38
	public static String sizeOfSubcorpusP0P1ComputedInP2Ms;
39
	
27 40
	public static String info_searchEngineStopped;
41
	
28 42
	public static String info_stoppingSearchEngine;
29

  
30
	public static String subcorpusP0CreatedInP1Ms; 
31

  
32 43
	
44
	public static String subcorpusP0CreatedInP1Ms;
33 45
	
46
	
47
	
34 48
	static {
35 49
		// initialize resource bundle
36 50
		Utf8NLS.initializeMessages(BUNDLE_NAME, SearchEngineCoreMessages.class);
37 51
	}
38

  
39
	private SearchEngineCoreMessages() {
40
	}
41 52
	
53
	private SearchEngineCoreMessages() {}
54
	
42 55
}
tmp/org.txm.index.core/src/org/txm/index/core/functions/PartitionIndex.java (revision 2437)
131 131
	@Override
132 132
	public String getComputingStartMessage() {
133 133
		return TXMCoreMessages.bind(IndexCoreMessages.indexOfP0PropertiesP1OnP2Partition, this.pQuery, WordProperty.propertiesToString(this.pProperties).replaceAll(TXMPreferences.LIST_SEPARATOR,
134
				", "), this.getCorpus().getName()); //$NON-NLS-1$
134
				", "), this.getPartition().getSimpleName()); //$NON-NLS-1$
135 135
	}
... Ce différentiel a été tronqué car il excède la taille maximale pouvant être affichée.

Formats disponibles : Unified diff