Révision 1199

tmp/org.txm.annotation.core/src/org/txm/annotation/core/AnnotationEngine.java (revision 1199)
19 19
	 */
20 20
	public abstract boolean isAutomatic();
21 21
	
22
	/**
23
	 * Automatically annotate a XML-TXM file
24
	 * 
25
	 * @param xmlFile to annotate
26
	 * @param binaryCorpusDirectory
27
	 * @param parameters
28
	 * @return
29
	 */
22 30
	public abstract boolean processFile(File xmlFile, File binaryCorpusDirectory, HashMap<String, Object> parameters);
23 31
	
24 32
	/**
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartsEngine.java (revision 1199)
17 17
import org.txm.core.engines.EngineType;
18 18
import org.txm.core.preferences.TBXPreferences;
19 19
import org.txm.core.preferences.TXMPreferences;
20
import org.txm.core.results.TXMResult;
21
import org.txm.objects.Project;
20 22
import org.txm.utils.logger.Log;
21 23

  
22 24

  
......
566 568
		return directComputing;
567 569
	} 
568 570
	
569
	
570 571
	/**
571 572
	 * 
572 573
	 * @param result
......
590 591
	public Object createChart(ChartResult result)	{
591 592
		return this.createChart(result, result.getChartType());
592 593
	}
593

  
594 594
	
595
	
596
	
597 595
	/**
598 596
	 * 
599 597
	 * @param chart
......
606 604
		}
607 605
	}
608 606
	
607
	@Override
608
	public void notify(TXMResult r, String state) {
609
		//nothing to do
610
	}
609 611
	
612
	public String getDetails() {
613
		return this.getClass()+ " "+this.toString();
614
	}
610 615
}
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/MainCorpus.java (revision 1199)
39 39
import java.util.UUID;
40 40

  
41 41
import org.eclipse.core.runtime.IProgressMonitor;
42
import org.txm.Toolbox;
42 43
import org.txm.core.messages.TXMCoreMessages;
43 44
import org.txm.core.results.TXMParameters;
44 45
import org.txm.objects.Project;
......
570 571

  
571 572
		DeleteDir.deleteDirectory(dataDirectory);
572 573
		registryFile.delete();
574
		
575
		Toolbox.notifyEngines(this, "clean");
573 576
	}
574 577

  
575 578
	@Override
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPSearchEngine.java (revision 1199)
7 7
import org.txm.Toolbox;
8 8
import org.txm.core.engines.EngineType;
9 9
import org.txm.core.messages.TXMCoreMessages;
10
import org.txm.core.results.TXMResult;
10 11
import org.txm.importer.cwb.PatchCwbRegistry;
11 12
import org.txm.libs.cqp.CQPLibPreferences;
12 13
import org.txm.objects.CorpusBuild;
......
452 453
			return false;
453 454
		}
454 455
	}
456

  
457
	@Override
458
	public void notify(TXMResult r, String state) {
459
		// TODO Auto-generated method stub
460
	}
455 461
}
tmp/org.txm.statsengine.core/src/org/txm/statsengine/core/StatsEngine.java (revision 1199)
1 1
package org.txm.statsengine.core;
2 2

  
3 3
import org.txm.core.engines.Engine;
4
import org.txm.core.results.TXMResult;
4 5

  
5 6
//FIXME: useless class
6 7
public abstract class StatsEngine implements Engine {
......
9 10

  
10 11
	@Override
11 12
	public abstract String getName();
13
	
14
	@Override
15
	public void notify(TXMResult r, String state) {
16
		return;
17
	}
18
	
19
	public String getDetails() {
20
		return "";
21
	}
12 22
}
tmp/org.txm.querycooccurrences.rcp/src/org/txm/rcp/commands/function/ComputeQueryCooccurrence.java (revision 1199)
171 171
			int nqueries = (queries1.size()*queries2.size());
172 172
			System.out.println("Number of queries: "+nqueries);
173 173
			System.out.println("Estimated time: "+(nqueries*reqtime/1000)+" secs");
174
			cooc = new QueryCooccurrence(corpus, queries1, names1, queries2, names2, dist, min, struct);
174
			cooc = new QueryCooccurrence(corpus);
175
			cooc.setParameters(queries1, names1, queries2, names2, dist, min, struct);
176
			cooc.compute();
175 177
			System.out.println(TXMUIMessages.ComputeCoocMatrix_1+cooc.getNNodes());
176 178
			System.out.println(TXMUIMessages.ComputeCoocMatrix_2+cooc.getNEdges());
177 179
			System.out.println(TXMUIMessages.ComputeCoocMatrix_3+dist);
tmp/org.txm.querycooccurrences.rcp/src/org/txm/functions/coocmatrix/QueryCooccurrence.java (revision 1199)
45 45
	protected int nEdges = 0;
46 46
	protected int minCooc;
47 47
	
48
	public QueryCooccurrence(CQPCorpus corpus, 
48
	public void setParameters(
49 49
			ArrayList<CQLQuery> queries1, ArrayList<String> names1, 
50 50
			ArrayList<CQLQuery> queries2, ArrayList<String> names2, 
51
			int dist, int minCooc, String struct) throws CqiClientException, RWorkspaceException {
51
			int dist, int minCooc, String struct) {
52 52
		
53
		super(corpus);
54 53
		this.queries1 = queries1;
55 54
		this.names1 = names1;
56 55
		this.queries2 = queries2;
57 56
		this.names2 = names2;
58
		this.corpus = corpus;
59 57
		this.dist = dist;
60 58
		this.minCooc = minCooc;
61 59
		if (struct != null) {
......
64 62
		else {
65 63
			this.struct = "within text";
66 64
		}
65
	}
67 66
	
68
		nNodes = queries1.size();
69
				
70
		coocs = new int[queries1.size()][queries2.size()];
71
		for (int i = 0 ; i < queries1.size() ; i++) {
72

  
73
			//if (oriented) j = 0; // if the graph is not oriented, we don't need to evaluate all queries
74
			for (int j = 0 ; j < queries2.size() ; j++) {
75
				String query = "("+queries1.get(i)+"[]{0,"+dist+"}"+queries2.get(j)+")|("+queries2.get(j)+"[]{0,"+dist+"}"+queries1.get(i)+") "+this.struct;
76
					
77
				Log.info("ListCooc: query "+query);
78
				QueryResult result = corpus.query(new CQLQuery(query), "tmp", false);
79
				coocs[i][j] = result.getNMatch();
80
				if (coocs[i][j] >= minCooc) {
81
					nEdges++;
82
				} else {
83
					coocs[i][j] = 0;
84
				}
85
				result.drop();
86
			}
87
		}
67
	public QueryCooccurrence(CQPCorpus corpus) throws CqiClientException, RWorkspaceException {
68
		super(corpus);
69
		this.corpus = corpus;
70
		this.setVisible(true);
88 71
	}
89
	
72
		
90 73
	@Override
91 74
	public String getName() {
92 75
		return corpus.getName() + " d=" + dist + " min=" + minCooc;
......
231 214
	};
232 215
	
233 216
	@Override
234
	public Object getAdapter(Class adapter) {
235
		return coocMatrixAdapter;
217
	public Object getAdapter(Class adapterType) {
218
		if (adapterType == IWorkbenchAdapter.class)
219
			return coocMatrixAdapter;
220
		return null;
236 221
	}
237 222

  
238 223
	@Override
239 224
	public String getSimpleName() {
240
		return "QueryCooccurrence";
225
		return "d=" + dist + " min=" + minCooc;
241 226
	}
242 227

  
243 228
	@Override
244 229
	public String getDetails() {
245
		return queries1.toString()+ " "+queries2.toString();
230
		return getResultype()+" d=" + dist + " min=" + minCooc+" Q1="+queries1.toString()+ " Q2="+queries2.toString();
246 231
	}
247 232

  
248 233
	@Override
......
253 238
	@Override
254 239
	public boolean setParameters(TXMParameters parameters) {
255 240
		//FIXME: not yet implemented.
256
		System.err.println("QueryCooccurrence.setParameters(): not yet implemented.");
241
		//System.err.println("QueryCooccurrence.setParameters(): not yet implemented.");
257 242
		return false;
258 243
	}
259 244

  
260 245
	@Override
261 246
	public boolean saveParameters() throws Exception {
262 247
		//FIXME: not yet implemented.
263
		System.err.println("QueryCooccurrence.saveParameters(): not yet implemented.");
264
		return false;
248
		//System.err.println("QueryCooccurrence.saveParameters(): not yet implemented.");
249
		return true;
265 250
	}
266 251

  
267 252
	@Override
268 253
	public boolean loadParameters() throws Exception {
269 254
		//FIXME: not yet implemented.
270
		System.err.println("QueryCooccurrence.loadParameters(): not yet implemented.");
271
		return false;
255
		//System.err.println("QueryCooccurrence.loadParameters(): not yet implemented.");
256
		return true;
272 257
	}
273 258

  
274 259
	@Override
275 260
	protected boolean _compute() throws Exception {
276
		// TODO Auto-generated method stub
277
		return false;
261

  
262
		nNodes = queries1.size();
263
				
264
		coocs = new int[queries1.size()][queries2.size()];
265
		for (int i = 0 ; i < queries1.size() ; i++) {
266

  
267
			//if (oriented) j = 0; // if the graph is not oriented, we don't need to evaluate all queries
268
			for (int j = 0 ; j < queries2.size() ; j++) {
269
				String query = "("+queries1.get(i)+"[]{0,"+dist+"}"+queries2.get(j)+")|("+queries2.get(j)+"[]{0,"+dist+"}"+queries1.get(i)+") "+this.struct;
270
					
271
				Log.info("ListCooc: query "+query);
272
				QueryResult result = corpus.query(new CQLQuery(query), "TMP", false);
273
				coocs[i][j] = result.getNMatch();
274
				if (coocs[i][j] >= minCooc) {
275
					nEdges++;
276
				} else {
277
					coocs[i][j] = 0;
278
				}
279
				result.drop();
280
			}
281
		}
282
		return true;
278 283
	}
279 284

  
280 285
	@Override
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/debug/EnginesDebugView.java (revision 1199)
39 39

  
40 40
import org.eclipse.jface.layout.GridDataFactory;
41 41
import org.eclipse.jface.viewers.IContentProvider;
42
import org.eclipse.jface.viewers.ISelection;
42 43
import org.eclipse.jface.viewers.ITreeContentProvider;
43 44
import org.eclipse.jface.viewers.LabelProvider;
45
import org.eclipse.jface.viewers.StructuredSelection;
44 46
import org.eclipse.jface.viewers.TreeViewer;
45 47
import org.eclipse.swt.SWT;
46 48
import org.eclipse.swt.custom.ScrolledComposite;
49
import org.eclipse.swt.events.KeyEvent;
50
import org.eclipse.swt.events.KeyListener;
51
import org.eclipse.swt.events.MouseEvent;
52
import org.eclipse.swt.events.MouseListener;
47 53
import org.eclipse.swt.events.SelectionEvent;
48 54
import org.eclipse.swt.events.SelectionListener;
49 55
import org.eclipse.swt.layout.GridData;
......
92 98

  
93 99
	/** The ID. */
94 100
	public static String ID = EnginesDebugView.class.getName(); //$NON-NLS-1$
101
	private TreeViewer viewer;
95 102

  
96 103
	/**
97 104
	 * Instantiates a new queries view.
......
122 129

  
123 130
		parent.setLayout(new GridLayout(1, true));
124 131

  
125
		TreeViewer viewer = new TreeViewer(parent);
132
		viewer = new TreeViewer(parent);
126 133
		viewer.getTree().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
127 134
		
128 135
		viewer.setLabelProvider(new LabelProvider() {
......
180 187
			}
181 188
		});
182 189
		
190
		viewer.getTree().addKeyListener(new KeyListener() {
191
			
192
			@Override
193
			public void keyReleased(KeyEvent e) {
194
				// TODO Auto-generated method stub
195
				
196
			}
197
			
198
			@Override
199
			public void keyPressed(KeyEvent e) {
200
				if (e.keyCode == SWT.F5) {
201
					viewer.refresh();
202
				}
203
			}
204
		});
205
		
206
		viewer.getTree().addMouseListener(new MouseListener() {
207
			
208
			@Override
209
			public void mouseUp(MouseEvent e) {
210
				// TODO Auto-generated method stub
211
			}
212
			
213
			@Override
214
			public void mouseDown(MouseEvent e) {
215
				// TODO Auto-generated method stub
216
			}
217
			
218
			@Override
219
			public void mouseDoubleClick(MouseEvent e) {
220
				ISelection isel = viewer.getSelection();
221
				if (isel instanceof StructuredSelection) {
222
					StructuredSelection sel = (StructuredSelection)isel;
223
					if (!sel.isEmpty()) {
224
						for (Object o : sel.toList()) {
225
							if (o instanceof Engine) {
226
								System.out.println(((Engine)o).getDetails());
227
							}
228
						}
229
					}
230
				}
231
			}
232
		});
233
		
183 234
		LinkedHashMap<EngineType, EnginesManager<?>> i = Toolbox.getEngineManagers();
184 235
		viewer.setInput(i);
185 236
	}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/function/RenameResult.java (revision 1199)
1 1
package org.txm.rcp.commands.function;
2 2

  
3
import java.util.List;
4

  
3 5
import org.eclipse.core.commands.AbstractHandler;
4 6
import org.eclipse.core.commands.ExecutionEvent;
5 7
import org.eclipse.core.commands.ExecutionException;
......
8 10
import org.eclipse.jface.viewers.IStructuredSelection;
9 11
import org.eclipse.ui.IWorkbenchWindow;
10 12
import org.eclipse.ui.handlers.HandlerUtil;
13
import org.txm.Toolbox;
11 14
import org.txm.core.preferences.TXMPreferences;
12 15
import org.txm.core.results.TXMResult;
16
import org.txm.objects.CorpusBuild;
13 17
import org.txm.rcp.swt.dialog.TextDialog;
14 18
import org.txm.rcp.views.corpora.CorporaView;
15 19

  
......
30 34
			if (dialog.open() == TextDialog.OK) {
31 35
				String newName = dialog.getText();
32 36
				//if (newName.length() > 0) {
37
				
38
					if (r instanceof CorpusBuild) { // test if another corpus has the same name
39
						List<TXMResult> corpora = Toolbox.workspace.getDeepChildren(CorpusBuild.class);
40
					}
41
				
33 42
					r.setUserName(newName);
34 43
					try {
35 44
						r.autoSaveParametersFromAnnotations();
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 1199)
471 471
	}
472 472

  
473 473
	/**
474
	 * @return the commandParametersComposite. Put here you main parameter widgets
474
	 * @return the commandParametersComposite. Put here you main parameter widgets using RowData data layout
475 475
	 */
476 476
	public Group getExtendedParametersGroup() {
477 477
		return this.extendedParametersGroup;
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/GLComposite.java (revision 1199)
39 39
	 */
40 40
	public final void setLayout(Layout layout) {
41 41
		System.out.println("Warning: GLComposite.setLayout is called without effect: "+name);
42
		Thread.dumpStack();
42 43
		//super.setLayout(layout);
43 44
	}
44 45

  
tmp/org.txm.annotation.rcp/src/org/txm/annotation/rcp/editor/AnnotationArea.java (revision 1199)
116 116
	public abstract boolean isDirty();
117 117
	
118 118
	public abstract boolean discardChanges();
119

  
120
	/**
121
	 * 
122
	 * @return true if the corpus indexes & editions needs to be updated after saving annotation
123
	 */
124
	public abstract boolean needToUpdateIndexes();
119 125
}
tmp/org.txm.annotation.rcp/src/org/txm/annotation/rcp/editor/AnnotationExtension.java (revision 1199)
131 131
			@Override
132 132
			public void widgetSelected(SelectionEvent e) {
133 133
				boolean saveSuccessful = true;
134
				boolean needToUpdateIndexes = false;
134 135
				//System.out.println("Saving annotations...");
135 136
				if (annotationAreas != null) {
136 137
					for (AnnotationArea aa : annotationAreas) {
137 138
						saveSuccessful = saveSuccessful && aa.save();
139
						needToUpdateIndexes = needToUpdateIndexes || aa.needToUpdateIndexes();
138 140
					}
139 141
				}
140 142

  
141
				JobHandler job = new JobHandler("Updating corpus editions and indexes", true) {
143
				if (saveSuccessful && needToUpdateIndexes) {
144
					JobHandler job = new JobHandler("Updating corpus editions and indexes", true) {
142 145

  
143
					@Override
144
					protected IStatus run(IProgressMonitor monitor) {
145
						final MainCorpus corpus = (MainCorpus) editor.getResult().getFirstParent(MainCorpus.class);
146
						monitor.setTaskName("updating corpus indexes and editions");
147
						if (corpus != null && UpdateCorpus.update(corpus) != null) {
148
							monitor.worked(50);
149
							this.syncExec(new Runnable() {
150
								public void run() {
151
									CorporaView.refreshObject(corpus);
152
								}
153
							});
154
							return Status.OK_STATUS;
155
						} else {
156
							monitor.worked(50);
157
							System.out.println("Fail to update corpus. Aborting");
158
							System.out.println("Fix XML-TXM files and call command 'UpdateCorpus'");
159
							return Status.CANCEL_STATUS;
146
						@Override
147
						protected IStatus run(IProgressMonitor monitor) {
148
							final MainCorpus corpus = (MainCorpus) editor.getResult().getFirstParent(MainCorpus.class);
149
							monitor.setTaskName("updating corpus indexes and editions");
150
							if (corpus != null && UpdateCorpus.update(corpus) != null) {
151
								monitor.worked(50);
152
								this.syncExec(new Runnable() {
153
									public void run() {
154
										CorporaView.refreshObject(corpus);
155
									}
156
								});
157
								return Status.OK_STATUS;
158
							} else {
159
								monitor.worked(50);
160
								System.out.println("Fail to update corpus. Aborting");
161
								System.out.println("Fix XML-TXM files and call command 'UpdateCorpus'");
162
								return Status.CANCEL_STATUS;
163
							}
160 164
						}
161
					}
162
				};
163
				job.schedule();
165
					};
166
					job.schedule();
167
				}
164 168

  
165

  
166 169
			}
167 170

  
168 171
			@Override
tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/SimpleKRAnnotation.java (revision 1199)
700 700
		return false;
701 701
	}
702 702

  
703
	@Override
704
	public boolean needToUpdateIndexes() {
705
		return true;
706
	}
703 707
}
tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/KRAnnotation.java (revision 1199)
916 916
	public boolean discardChanges() {
917 917
		return false;
918 918
	}
919

  
920
	@Override
921
	public boolean needToUpdateIndexes() {
922
		return true;
923
	}
919 924
}
tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/WordAnnotationToolbar.java (revision 1199)
731 731
	public boolean discardChanges() {
732 732
		return false;
733 733
	}
734

  
735
	@Override
736
	public boolean needToUpdateIndexes() {
737
		return true;
738
	}
734 739
}
tmp/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/KRAnnotationEngine.java (revision 1199)
14 14
import org.txm.annotation.kr.core.repository.KnowledgeRepository;
15 15
import org.txm.annotation.kr.core.repository.KnowledgeRepositoryManager;
16 16
import org.txm.annotation.kr.core.repository.SQLKnowledgeRepository;
17
import org.txm.core.results.TXMResult;
17 18
import org.txm.objects.Project;
18
import org.txm.objects.BaseOldParameters;
19 19
import org.txm.searchengine.cqp.corpus.CQPCorpus;
20 20
import org.txm.searchengine.cqp.corpus.MainCorpus;
21 21
import org.txm.sql.SQLConnection;
22
import org.txm.utils.DeleteDir;
22 23
import org.txm.utils.logger.Log;
23 24
import org.w3c.dom.Element;
24 25
import org.w3c.dom.NodeList;
......
414 415
		// TODO not implemented yet.
415 416
		return false;
416 417
	}
418

  
419
	@Override
420
	public void notify(TXMResult r, String state) {
421
		
422
		if (r instanceof MainCorpus && "clean".equals(state)) {
423
			MainCorpus c = (MainCorpus)r;
424
			File buildDirectory = new File(c.getProjectDirectory(), "temporary_annotations/"+c.getID());
425
			if (buildDirectory.exists()) {
426
				DeleteDir.deleteDirectory(buildDirectory);
427
			}
428
		} else if (r instanceof Project && "clean".equals(state)) {
429
			Project c = (Project)r;
430
			File buildDirectory = new File(c.getProjectDirectory(), "temporary_annotations");
431
			if (buildDirectory.exists()) {
432
				DeleteDir.deleteDirectory(buildDirectory);
433
			}
434
		}
435
	}
436

  
437
	@Override
438
	public String getDetails() {
439
		return "";
440
	}
417 441
}
tmp/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/AnnotationManager.java (revision 1199)
12 12
import org.txm.annotation.kr.core.repository.TypedValue;
13 13
import org.txm.annotation.kr.core.storage.temporary.TemporaryAnnotationManager;
14 14
import org.txm.core.engines.Engine;
15
import org.txm.core.results.TXMResult;
16
import org.txm.objects.Project;
15 17
import org.txm.searchengine.cqp.corpus.MainCorpus;
16 18
import org.txm.searchengine.cqp.corpus.query.Match;
17 19
import org.txm.utils.logger.Log;
......
22 24
 * @author mdecorde
23 25
 *
24 26
 */
25
public class AnnotationManager implements Engine {
27
public class AnnotationManager {
26 28

  
27 29
	MainCorpus corpus;
28 30
	TemporaryAnnotationManager tempManager;
......
308 310
		return tempManager.getEntityManager() != null && tempManager.getEntityManager().isOpen();
309 311
	}
310 312

  
311
	@Override
312
	public String getName() {
313
		return "Annotation";
314
	}
315 313

  
316
	@Override
317
	public boolean isRunning() {
318
		return isOpen();
319
	}
320

  
321
	@Override
322 314
	public boolean initialize() throws Exception {
323 315
		tempManager = new TemporaryAnnotationManager(corpus);
324 316
		dirty = tempManager.getAnnotations().size() > 0;
325 317
		cqpManager = new CQPAnnotationManager(corpus);
326 318
		return false;
327 319
	}
328

  
329
	@Override
330
	public boolean start(IProgressMonitor arg0) throws Exception {
331
		return true;
332
	}
333

  
334
	@Override
335
	public boolean stop() throws Exception {
336
		return true;
337
	}
338 320
	
339 321
	/**
340 322
	 * 
tmp/org.txm.setups/BuildLinux64bit.sh (revision 1199)
64 64
find "$APP/DEBIAN/preinst" -type f -exec sed -i "s/TXMVERSION/$VERSION/g" {} \;
65 65
find "$APP/DEBIAN/postinst" -type f -exec sed -i "s/TXMVERSION/$VERSION/g" {} \;
66 66
find "$APP/usr/bin/TXM" -type f -exec sed -i "s/TXMVERSION/$VERSION/g" {} \;
67
find "$APP/DEBIAN/control" -type f -exec sed -i "s/Package: txm/Package: txm-${VERSION}/g" {} \;
67
find "$APP/DEBIAN/control" -type f -exec sed -i "s/TXMVERSION/${VERSION}/g" {} \;
68

  
68 69
mv "$APP/usr/bin/TXM" "$APP/usr/bin/TXM-$VERSION"
69 70
mv "$APP/usr/lib/TXM" "$APP/usr/lib/TXM-$VERSION"
70
find "$APP/usr/share/applications/TXM.desktop" -type f -exec sed -i "s/\/usr\/share\/TXM/\/usr\/share\/TXM-$VERSION/g" {} \;
71
find "$APP/usr/share/applications/TXM.desktop" -type f -exec sed -i "s/\/usr\/bin\/TXM/\/usr\/bin\/TXM-$VERSION/g" {} \;
72
find "$APP/usr/share/applications/TXM debug.desktop" -type f -exec sed -i "s/\/usr\/share\/TXM/\/usr\/share\/TXM-$VERSION/g" {} \;
73
find "$APP/usr/share/applications/TXM debug.desktop" -type f -exec sed -i "s/\/usr\/bin\/TXM/\/usr\/bin\/TXM-$VERSION/g" {} \;
71

  
72
find "$APP/usr/share/applications/TXM.desktop" -type f -exec sed -i "s/TXMVERSION/$VERSION/g" {} \;
73
find "$APP/usr/share/applications/TXM.desktop" -type f -exec sed -i "s/TXMVERSION/$VERSION/g" {} \;
74
find "$APP/usr/share/applications/TXM debug.desktop" -type f -exec sed -i "s/TXMVERSION/$VERSION/g" {} \;
75
find "$APP/usr/share/applications/TXM debug.desktop" -type f -exec sed -i "s/TXMVERSION/$VERSION/g" {} \;
74 76
mv "$APP/usr/share/applications/TXM.desktop" "$APP/usr/share/applications/TXM-$VERSION.desktop"
75 77
mv "$APP/usr/share/applications/TXM debug.desktop" "$APP/usr/share/applications/TXM-$VERSION debug.desktop"
78

  
76 79
mv "$APP/usr/share/doc/txm" "$APP/usr/share/doc/txm-$VERSION"
77
find "$APP/usr/share/lintian/overrides/txm" -type f -exec sed -i "s/txm binary/txm-$VERSION binary/g" {} \;
80

  
81
find "$APP/usr/share/lintian/overrides/txm" -type f -exec sed -i "s/TXMVERSION/$VERSION/g" {} \;
78 82
mv "$APP/usr/share/lintian/overrides/txm" "$APP/usr/share/lintian/overrides/txm-$VERSION"
79 83
mv "$APP/usr/share/TXM" "$APP/usr/share/TXM-$VERSION"
80 84

  
tmp/org.txm.setups/shared/debian/usr/share/applications/TXM.desktop (revision 1199)
1 1
[Desktop Entry]
2 2
Encoding=UTF-8
3 3
Type=Application
4
Name=TXM 0.8.0
5
Version=0.8.0
4
Name=TXM TXMVERSION
5
Version=TXMVERSION
6 6
GenericName=Textual data analysis software
7 7
GenericName[cn]= 文本分析软件
8 8
GenericName[de]=Textanalysesoftware
......
14 14
Comment[de]=Textometrie, quantitative und qualitative Analyse von elektronischen Textkorpora
15 15
Comment[fr]=Textométrie, analyse quantitative et qualitative de données textuelles
16 16
Comment[ru]=текстометрия, количественный и качественный анализ цифровых корпусов текстов 
17
Icon=/usr/share/TXM/TXM.png
18
Exec=/usr/bin/TXM
17
Icon=/usr/share/TXM-TXMVERSION/TXM.png
18
Exec=/usr/bin/TXM-TXMVERSION
19 19
Terminal=false
20
Categories=Sciences;Education;Science;
20
Categories=Sciences;Education;Science;
tmp/org.txm.setups/shared/debian/usr/share/applications/TXM debug.desktop (revision 1199)
1 1
[Desktop Entry]
2 2
Encoding=UTF-8
3 3
Type=Application
4
Name=TXM 0.8.0 Debug
5
Version=0.8.0
4
Name=TXM TXMVERSION Debug
5
Version=TXMVERSION
6 6
GenericName=Textual data analysis software
7 7
GenericName[cn]= 文本分析软件
8 8
GenericName[de]=Textanalysesoftware
......
14 14
Comment[de]=Textometrie, quantitative und qualitative Analyse von elektronischen Textkorpora
15 15
Comment[fr]=Textométrie, analyse quantitative et qualitative de données textuelles
16 16
Comment[ru]=текстометрия, количественный и качественный анализ цифровых корпусов текстов 
17
Icon=/usr/share/TXM/TXM.png
18
Exec=/usr/bin/TXM
17
Icon=/usr/share/TXM-TXMVERSION/TXM debug.png
18
Exec=/usr/bin/TXM-TXMVERSION -log -debug -console -consoleLog -noredirection
19 19
Terminal=true
20
Categories=Sciences;Education;Science;
20
Categories=Sciences;Education;Science;
tmp/org.txm.setups/shared/debian/usr/share/lintian/overrides/txm (revision 1199)
1
txm binary: arch-independent-package-contains-binary-or-object
2
txm binary: unstripped-binary-or-object
1
txm-TXMVERSION binary: arch-independent-package-contains-binary-or-object
2
txm-TXMVERSION binary: unstripped-binary-or-object
tmp/org.txm.setups/shared/debian/usr/bin/TXM (revision 1199)
1 1
# This script launches TXM in the right directory and with the right TXM.ini file
2 2
UBUNTU_MENUPROXY=0
3 3
VERSION=-TXMVERSION
4

  
5 4
echo "TXM: Preparing redirections in $HOME/TXM_PostInstallOutputLogs.txt and $HOME/TXM_PostInstallErrorLogs.txt files."
6 5

  
7 6
LOGFILESMSG=", see $HOME/TXM_PostInstallOutputLogs.txt and $HOME/TXM_PostInstallErrorLogs.txt output and error messages files."
......
94 93
	    echo "TXM: Failed to remove $DOTTXMHOME directory$LOGFILESMSG"
95 94
	    exit 1 ;
96 95
	fi
96
	
97
	echo "TXM: resetting RCP workspace."
98
	rm -rf "$TXMHOME/corpora/.metadata"
99
	if [ -d "$TXMHOME/corpora/.metadata" ]; then
100
	    zenity --info --text="TXM: Failed to remove $TXMHOME/corpora/.metadata"
101
	    echo "TXM: Failed to remove $TXMHOME/corpora/.metadata"
102
	    exit 1 ;
103
	fi
97 104

  
98 105
    mkdir "$DOTTXMHOME"
99 106
    if [ ! -d "$DOTTXMHOME" ]; then
......
150 157
## uncomment next lien to enable full debug
151 158
#DEBUGOPTIONS="-log -consolelog -clean -debug -console -noexit"
152 159

  
153
SWT_GTK3=0 UBUNTU_MENUPROXY=0 exec "${TXMINSTALL}/TXM" -run --launcher.ini "$DOTTXMHOME/TXM.ini" $DEBUGOPTIONS -data "$TXMHOME/corpora" -user "$DOTTXMHOME/user" -install "$TXMINSTALL"
160
SWT_GTK3=0 UBUNTU_MENUPROXY=0 exec "${TXMINSTALL}/TXM" "$@" -run --launcher.ini "$DOTTXMHOME/TXM.ini" $DEBUGOPTIONS -data "$TXMHOME/corpora" -user "$DOTTXMHOME/user" -install "$TXMINSTALL"
tmp/org.txm.setups/shared/debian/DEBIAN/control (revision 1199)
1 1
Package: txm
2
Version: 0.8.0
2
Version: TXMVERSION
3 3
Section: base
4 4
Priority: optional
5 5
Architecture: all
tmp/org.txm.setups/shared/debian/DEBIAN/preinst (revision 1199)
2 2
VERSION=-TXMVERSION
3 3

  
4 4
echo "removing /usr/lib/TXM${VERSION}"
5
if [ ! -d "/usr/lib/TXM${VERSION}" ]; then
5
if [ -d "/usr/lib/TXM${VERSION}" ]; then
6 6
	rm -rf "/usr/lib/TXM${VERSION}"
7 7
fi
8 8

  
9 9
echo "removing /usr/share/doc/txm${VERSION}"
10
if [ ! -d "/usr/share/doc/txm${VERSION}" ]; then
10
if [ -d "/usr/share/doc/txm${VERSION}" ]; then
11 11
	rm -rf "/usr/share/doc/txm${VERSION}"
12 12
fi
13 13

  
14 14
echo "removing /usr/share/lintian/overrides/txm${VERSION}"
15
if [ ! -d "/usr/share/lintian/overrides/txm${VERSION}" ]; then
15
if [ -d "/usr/share/lintian/overrides/txm${VERSION}" ]; then
16 16
	rm -rf "/usr/share/lintian/overrides/txm${VERSION}"
17 17
fi
18 18

  
19 19
echo "removing /usr/share/TXM${VERSION}"
20
if [ ! -d "/usr/share/TXM${VERSION}" ]; then
20
if [ -d "/usr/share/TXM${VERSION}" ]; then
21 21
	rm -rf "/usr/share/TXM${VERSION}"
22 22
fi
23 23

  
24 24
echo "removing /usr/share/applications/TXM${VERSION}.desktop"
25
if [ ! -f "/usr/share/applications/TXM${VERSION}.desktop" ]; then
25
if [ -f "/usr/share/applications/TXM${VERSION}.desktop" ]; then
26 26
	rm "/usr/share/applications/TXM${VERSION}.desktop"
27
fi
28

  
29
echo "removing /usr/share/applications/TXM${VERSION} debug.desktop"
30
if [ -f "/usr/share/applications/TXM${VERSION}.desktop" ]; then
27 31
	rm "/usr/share/applications/TXM${VERSION} debug.desktop"
28 32
fi
29 33

  
30 34
echo "removing /usr/bin/TXM${VERSION}"
31
if [ ! -f "/usr/bin/TXM${VERSION}" ]; then
35
if [ -f "/usr/bin/TXM${VERSION}" ]; then
32 36
	rm "/usr/bin/TXM${VERSION}"
33 37
fi
34 38

  
tmp/org.txm.setups/shared/debian/DEBIAN/copyright (revision 1199)
4 4
Upstream-Name: txm
5 5
Source : https://sourceforge.net/projects/txm/
6 6

  
7
Copyright: Copyright © 2010-2017 ENS de Lyon. Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of Nice Sophia Antipolis, University of Paris 3.
7
Copyright: Copyright © 2010-2018 ENS de Lyon. Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of Nice Sophia Antipolis, University of Paris 3.
8 8
License: GPL-2+
9 9
 The TXM platform is free software: you can redistribute it
10 10
 and/or modify it under the terms of the GNU General Public
tmp/org.txm.queryindex.rcp/src/org/txm/queryindex/rcp/editors/LineContentProvider.java (revision 1199)
1
// Copyright © 2010-2013 ENS de Lyon.
2
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3
// Lyon 2, University of Franche-Comté, University of Nice
4
// Sophia Antipolis, University of Paris 3.
5
// 
6
// The TXM platform is free software: you can redistribute it
7
// and/or modify it under the terms of the GNU General Public
8
// License as published by the Free Software Foundation,
9
// either version 2 of the License, or (at your option) any
10
// later version.
11
// 
12
// The TXM platform is distributed in the hope that it will be
13
// useful, but WITHOUT ANY WARRANTY; without even the implied
14
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
// PURPOSE. See the GNU General Public License for more
16
// details.
17
// 
18
// You should have received a copy of the GNU General
19
// Public License along with the TXM platform. If not, see
20
// http://www.gnu.org/licenses.
21
// 
22
// 
23
// 
24
// $LastChangedDate:$
25
// $LastChangedRevision:$
26
// $LastChangedBy:$ 
27
//
28
package org.txm.queryindex.rcp.editors;
29

  
30
import java.util.List;
31

  
32
import org.eclipse.jface.viewers.IStructuredContentProvider;
33
import org.eclipse.jface.viewers.Viewer;
34
import org.txm.queryindex.core.functions.QueryIndexLine;
35

  
36
// TODO: Auto-generated Javadoc
37
/**
38
 * The IStructuredContentProvider used by the reference and line tables.
39
 *
40
 * @author jmague
41
 */
42
public class LineContentProvider implements IStructuredContentProvider {
43

  
44
	/*
45
	 * (non-Javadoc)
46
	 * 
47
	 * @see
48
	 * org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java
49
	 * .lang.Object)
50
	 */
51
	@Override
52
	public Object[] getElements(Object inputElement) {
53
		@SuppressWarnings("unchecked")
54
		List<QueryIndexLine> lines = (List<QueryIndexLine>) inputElement;
55
		return lines.toArray();
56
	}
57

  
58
	/*
59
	 * (non-Javadoc)
60
	 * 
61
	 * @see org.eclipse.jface.viewers.IContentProvider#dispose()
62
	 */
63
	@Override
64
	public void dispose() {
65
		// TODO Auto-generated method stub
66

  
67
	}
68

  
69
	/*
70
	 * (non-Javadoc)
71
	 * 
72
	 * @see
73
	 * org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface
74
	 * .viewers.Viewer, java.lang.Object, java.lang.Object)
75
	 */
76
	@Override
77
	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
78
		// TODO Auto-generated method stub
79
	}
80

  
81
}
0 82

  
tmp/org.txm.queryindex.rcp/src/org/txm/queryindex/rcp/editors/LineLabelProvider.java (revision 1199)
1
// Copyright © 2010-2013 ENS de Lyon.
2
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3
// Lyon 2, University of Franche-Comté, University of Nice
4
// Sophia Antipolis, University of Paris 3.
5
// 
6
// The TXM platform is free software: you can redistribute it
7
// and/or modify it under the terms of the GNU General Public
8
// License as published by the Free Software Foundation,
9
// either version 2 of the License, or (at your option) any
10
// later version.
11
// 
12
// The TXM platform is distributed in the hope that it will be
13
// useful, but WITHOUT ANY WARRANTY; without even the implied
14
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
// PURPOSE. See the GNU General Public License for more
16
// details.
17
// 
18
// You should have received a copy of the GNU General
19
// Public License along with the TXM platform. If not, see
20
// http://www.gnu.org/licenses.
21
// 
22
// 
23
// 
24
// $LastChangedDate:$
25
// $LastChangedRevision:$
26
// $LastChangedBy:$ 
27
//
28
package org.txm.queryindex.rcp.editors;
29

  
30
import org.eclipse.jface.viewers.ILabelProviderListener;
31
import org.eclipse.jface.viewers.ITableLabelProvider;
32
import org.eclipse.swt.graphics.Image;
33
import org.txm.queryindex.core.functions.QueryIndexLine;
34

  
35
// TODO: Auto-generated Javadoc
36
/**
37
 * The Class LineLabelProvider.
38
 */
39
public class LineLabelProvider implements ITableLabelProvider {
40

  
41
	/* (non-Javadoc)
42
	 * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
43
	 */
44
	@Override
45
	public Image getColumnImage(Object element, int columnIndex) {
46
		return null;
47
	}
48

  
49
	/* (non-Javadoc)
50
	 * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
51
	 */
52
	@Override
53
	public String getColumnText(Object element, int columnIndex) {
54
		QueryIndexLine line = (QueryIndexLine) element;
55
		switch (columnIndex) {
56
		case 0:
57
			return ""; //$NON-NLS-1$
58
		case 1:
59
			return line.getName();
60
		case 2:
61
			return "" + line.getFrequency(); //$NON-NLS-1$
62
		default:
63
			if (line.getFreqs().length > 1
64
					&& columnIndex - 3 < line.getFreqs().length)
65
				return "" + line.getFrequency(columnIndex - 3); //$NON-NLS-1$
66
			else
67
				return "";//$NON-NLS-1$
68
		}
69
	}
70

  
71
	/* (non-Javadoc)
72
	 * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
73
	 */
74
	@Override
75
	public void addListener(ILabelProviderListener listener) {
76
		// TODO Auto-generated method stub
77
	}
78

  
79
	/* (non-Javadoc)
80
	 * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
81
	 */
82
	@Override
83
	public void dispose() {
84
		// TODO Auto-generated method stub
85
	}
86

  
87
	/* (non-Javadoc)
88
	 * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
89
	 */
90
	@Override
91
	public boolean isLabelProperty(Object element, String property) {
92
		// TODO Auto-generated method stub
93
		return false;
94
	}
95

  
96
	/* (non-Javadoc)
97
	 * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
98
	 */
99
	@Override
100
	public void removeListener(ILabelProviderListener listener) {
101
		// TODO Auto-generated method stub
102
	}
103
}
0 104

  
tmp/org.txm.queryindex.rcp/src/org/txm/queryindex/rcp/editors/QueryIndexEditor.java (revision 1199)
1
// Copyright © 2010-2013 ENS de Lyon.
2
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3
// Lyon 2, University of Franche-Comté, University of Nice
4
// Sophia Antipolis, University of Paris 3.
5
// 
6
// The TXM platform is free software: you can redistribute it
7
// and/or modify it under the terms of the GNU General Public
8
// License as published by the Free Software Foundation,
9
// either version 2 of the License, or (at your option) any
10
// later version.
11
// 
12
// The TXM platform is distributed in the hope that it will be
13
// useful, but WITHOUT ANY WARRANTY; without even the implied
14
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
// PURPOSE. See the GNU General Public License for more
16
// details.
17
// 
18
// You should have received a copy of the GNU General
19
// Public License along with the TXM platform. If not, see
20
// http://www.gnu.org/licenses.
21
// 
22
// 
23
// 
24
// $LastChangedDate:$
25
// $LastChangedRevision:$
26
// $LastChangedBy:$ 
27
//
28
package org.txm.queryindex.rcp.editors;
29

  
30
import java.io.File;
31
import java.io.IOException;
32
import java.util.ArrayList;
33
import java.util.List;
34

  
35
import org.eclipse.core.runtime.IProgressMonitor;
36
import org.eclipse.core.runtime.IStatus;
37
import org.eclipse.core.runtime.Status;
38
import org.eclipse.jface.action.MenuManager;
39
import org.eclipse.jface.viewers.ISelection;
40
import org.eclipse.jface.viewers.StructuredSelection;
41
import org.eclipse.jface.viewers.TableViewer;
42
import org.eclipse.swt.SWT;
43
import org.eclipse.swt.events.KeyEvent;
44
import org.eclipse.swt.events.KeyListener;
45
import org.eclipse.swt.events.MouseAdapter;
46
import org.eclipse.swt.events.MouseEvent;
47
import org.eclipse.swt.events.SelectionEvent;
48
import org.eclipse.swt.events.SelectionListener;
49
import org.eclipse.swt.graphics.Font;
50
import org.eclipse.swt.graphics.FontData;
51
import org.eclipse.swt.graphics.Point;
52
import org.eclipse.swt.layout.GridData;
53
import org.eclipse.swt.layout.GridLayout;
54
import org.eclipse.swt.layout.RowData;
55
import org.eclipse.swt.widgets.Button;
56
import org.eclipse.swt.widgets.Composite;
57
import org.eclipse.swt.widgets.Display;
58
import org.eclipse.swt.widgets.FileDialog;
59
import org.eclipse.swt.widgets.Group;
60
import org.eclipse.swt.widgets.Label;
61
import org.eclipse.swt.widgets.Menu;
62
import org.eclipse.swt.widgets.Spinner;
63
import org.eclipse.swt.widgets.TableColumn;
64
import org.eclipse.ui.IEditorInput;
65
import org.eclipse.ui.IEditorSite;
66
import org.eclipse.ui.PartInitException;
67
import org.txm.core.messages.TXMCoreMessages;
68
import org.txm.index.core.functions.LineComparator.SortMode;
69
import org.txm.index.rcp.messages.IndexUIMessages;
70
import org.txm.queryindex.core.functions.Messages;
71
import org.txm.queryindex.core.functions.QueryIndex;
72
import org.txm.queryindex.core.functions.QueryIndexLine;
73
import org.txm.rcp.JobsTimer;
74
import org.txm.rcp.StatusLine;
75
import org.txm.rcp.editors.TXMEditor;
76
import org.txm.rcp.editors.TXMResultEditorInput;
77
import org.txm.rcp.editors.TableKeyListener;
78
import org.txm.rcp.messages.TXMUIMessages;
79
import org.txm.rcp.swt.GLComposite;
80
import org.txm.rcp.swt.dialog.LastOpened;
81
import org.txm.rcp.swt.widget.NamedAssistedQueryWidget;
82
import org.txm.rcp.swt.widget.NavigationWidget;
83
import org.txm.rcp.utils.JobHandler;
84
import org.txm.rcp.views.QueriesView;
85
import org.txm.rcp.views.corpora.CorporaView;
86
import org.txm.searchengine.cqp.CQPSearchEngine;
87
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
88
import org.txm.searchengine.cqp.corpus.CQPCorpus;
89
import org.txm.searchengine.cqp.corpus.Partition;
90
import org.txm.searchengine.cqp.corpus.Property;
91
import org.txm.searchengine.cqp.corpus.query.CQLQuery;
92
import org.txm.statsengine.r.rcp.views.RVariablesView;
93
import org.txm.utils.logger.Log;
94

  
95
/**
96
 * display the query index parameters and result.
97
 * 
98
 * @author mdecorde
99
 */
100
public class QueryIndexEditor extends TXMEditor<QueryIndex> {
101

  
102
	/** The Constant ID. */
103
	public static final String ID = "org.txm.rcp.editors.queryindex.QueryIndexEditor"; //$NON-NLS-1$
104

  
105
	/** The corpus. */
106
	protected CQPCorpus corpus;
107
	protected Partition partition; // can be null
108

  
109
	/** The index. */
110
	protected QueryIndex queryindex;
111
	boolean stored = false; // start storing at first line added
112
	// protected boolean saveQueryIndex = true;
113

  
114
	// params
115
	/** The query label. */
116
	protected Label queryLabel;
117

  
118
	/** The query widget. */
119
	protected NamedAssistedQueryWidget queryWidget;
120

  
121
	/** The N ligne p page spinner. */
122
	protected Spinner NLignePPageSpinner;
123
	// infos
124
	/** The navigation area. */
125
	protected NavigationWidget navigationArea;
126

  
127
	/** The l fmin info. */
128
	protected Label lFminInfo;
129

  
130
	/** The l fmax info. */
131
	protected Label lFmaxInfo;
132

  
133
	/** The l v info. */
134
	protected Label lVInfo;
135

  
136
	/** The l t info. */
137
	protected Label lTInfo;
138
	// result
139
	/** The line table viewer. */
140
	protected TableViewer viewer;
141

  
142
	/** The n column. */
143
	protected TableColumn nColumn;
144

  
145
	/** The unit column. */
146
	protected TableColumn unitColumn;
147

  
148
	/** The freq column. */
149
	protected TableColumn freqColumn;
150

  
151
	/** The separator column. */
152
	protected TableColumn separatorColumn;
153

  
154
	/** The top line. */
155
	protected int topLine;
156

  
157
	/** The bottom line. */
158
	protected int bottomLine;
159

  
160
	/** The nblinesperpage. */
161
	protected int nblinesperpage;
162

  
163
	/** The nblinesmax. */
164
	protected int nblinesmax;
165

  
166
//	/** The scroll composite. */
167
//	private ScrolledComposite scrollComposite;
168
//
169
//	/** The head composite. */
170
//	private Composite headComposite;
171

  
172
	/** The title. */
173
	String title;
174

  
175
	/**
176
	 * Instantiates a new index editor.
177
	 */
178
	public QueryIndexEditor() {
179
		super();
180
	}
181

  
182
	/**
183
	 * Do save.
184
	 * 
185
	 * @param arg0
186
	 *            the arg0
187
	 * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor)
188
	 */
189
	@Override
190
	public void doSave(IProgressMonitor arg0) {
191
		// TODO Auto-generated method stub
192
	}
193

  
194
	/**
195
	 * Do save as.
196
	 * 
197
	 * @see org.eclipse.lyon gournd zeroui.part.EditorPart#doSaveAs()
198
	 */
199
	@Override
200
	public void doSaveAs() {
201
		// TODO Auto-generated method stub
202
	}
203

  
204
	/**
205
	 * Inits the.
206
	 * 
207
	 * @param site
208
	 *            the site
209
	 * @param input
210
	 *            the input
211
	 * @throws PartInitException
212
	 *             the part init exception
213
	 * @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite,
214
	 *      org.eclipse.ui.IEditorInput)
215
	 */
216
	@Override
217
	public void init(IEditorSite site, IEditorInput input)
218
			throws PartInitException {
219
		setSite(site);
220
		setInput(input);
221

  
222
		TXMResultEditorInput<QueryIndex> tre = (TXMResultEditorInput)input;
223
		this.corpus = tre.getResult().getCorpus();
224
		this.partition = tre.getResult().getPartition();
225
		this.queryindex = tre.getResult();
226
	}
227

  
228
	/**
229
	 * Checks if is dirty.
230
	 * 
231
	 * @return true, if is dirty
232
	 * @see org.eclipse.ui.part.EditorPart#isDirty()
233
	 */
234
	@Override
235
	public boolean isDirty() {
236
		return false;
237
	}
238

  
239
	/**
240
	 * Checks if is save as allowed.
241
	 * 
242
	 * @return true, if is save as allowed
243
	 * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
244
	 */
245
	@Override
246
	public boolean isSaveAsAllowed() {
247
		return false;
248
	}
249

  
250
	private QueryIndex createQueryIndex() {
251
		if (queryindex == null) {
252
			if (partition != null) {
253
				queryindex = new QueryIndex(partition);
254
				title = Messages.QueryIndexEditor_0 + partition.getName();
255
			} else {
256
				queryindex = new QueryIndex(corpus);
257
				title = Messages.QueryIndexEditor_0 + corpus;
258
			}
259
		}
260
		return queryindex;
261
	}
262

  
263
	/**
264
	 * Compute index.
265
	 */
266
	public void compute() {
267

  
268
		createQueryIndex();
269

  
270
		StatusLine.setMessage(IndexUIMessages.IndexEditor_33);
271
		final CQLQuery query; // if the query is empty then we put "[]" instead
272
		if (!queryWidget.getQueryString().equals("\"\"")) {//$NON-NLS-1$
273
			query = new CQLQuery(queryWidget.getQueryString());
274
		} else {
275
			System.err.println(IndexUIMessages.IndexEditor_0);
276
			return;
277
		}
278

  
279
		final String name;
280
		if (queryWidget.getQueryName().length() == 0) {
281
			name = query.toString();
282
		} else {
283
			name = queryWidget.getQueryName();
284
		}
285

  
286
		title = "Computing QueryIndex...";
287
		
288
		try {
289
			JobHandler jobhandler = new JobHandler(title,
290
					queryWidget.getParent()) {
291
				@Override
292
				protected IStatus run(IProgressMonitor monitor) {
293
					this.runInit(monitor);
294
					JobsTimer.start();
295
					final QueryIndexLine line;
296
					try {
297
						try {
298
							if (queryindex.hasLine(name)) {
299
								System.out.println(Messages.QueryIndexEditor_1 + name);
300
								queryindex.removeLine(name);
301
							}
302
							line = queryindex.addLine(name, query);
303
						} catch (CqiClientException e2) {
304
							System.out
305
									.println(Messages.QueryIndexEditor_2
306
											+ query);
307
							Log.printStackTrace(e2);
308
							return Status.CANCEL_STATUS;
309
						}
310

  
311
						if (line == null) {
312
							System.out
313
									.println(Messages.QueryIndexEditor_2
314
											+ query);
315
							return Status.CANCEL_STATUS;
316
						}
317

  
318
						if (monitor.isCanceled())
319
							return Status.CANCEL_STATUS;
320

  
321
						queryindex.sortLines(SortMode.FREQUNIT, true);
322

  
323
						if (monitor.isCanceled())
324
							return Status.CANCEL_STATUS;
325

  
326
						this.acquireSemaphore();
327
						this.releaseSemaphore();
328

  
329
						final String message = Messages.QueryIndexEditor_3;
330

  
331
						if (monitor.isCanceled())
332
							return Status.CANCEL_STATUS;
333

  
334
						monitor.worked(95);
335
						// refresh ui
336
						syncExec(new Runnable() {
337
							@Override
338
							public void run() {
339

  
340
								System.out.println(message);
341
								StatusLine.setMessage(message);
342

  
343
								CorporaView.refresh();
344
								CorporaView.expand(queryindex.getParent());
345
								QueriesView.refresh();
346
								RVariablesView.refresh();
347

  
348
								setPartName(title);
349

  
350
								queryWidget.memorize();
351
								nblinesperpage = NLignePPageSpinner
352
										.getSelection();
353

  
354
								fillDisplayArea(0,
355
										NLignePPageSpinner.getSelection());
356

  
357
								if (line != null) {
358
									queryWidget.setText(""); //$NON-NLS-1$
359
									queryWidget.setName(""); //$NON-NLS-1$
360
									queryWidget.focus();
361
								}
362
							}
363
						});
364
					} catch (Exception e) {
365
						System.out.println(e.getLocalizedMessage());
366
						try {
367
							System.out.println(TXMUIMessages.LastCQPError
368
									+ CQPSearchEngine.getCqiClient().getLastCQPError());
369
						} catch (Exception e1) {
370
							System.out.println(IndexUIMessages.IndexEditor_10
371
									+ e1);
372
							Log.printStackTrace(e1);
373
						}
374
						Log.severe("Error while computing QueryIndex: "+e.getLocalizedMessage());
375
					} catch (ThreadDeath td) {
376
						return Status.CANCEL_STATUS;
377
					} finally {
378
						monitor.done();
379
						JobsTimer.stopAndPrint();
380
					}
381
					return Status.OK_STATUS;
382
				}
383
			};
384
			jobhandler.startJob();
385

  
386
		} catch (Exception e1) {
387
			Log.printStackTrace(e1);
388
		}
389
	}
390

  
391
	/**
392
	 * Creates the part control.
393
	 * 
394
	 * @param parent
395
	 *            the parent
396
	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
397
	 */
398
	@Override
399
	public void _createPartControl() {
400

  
401

  
402
		final Group paramArea = getExtendedParametersGroup();
403

  
404

  
405
		GLComposite resultArea = getResultArea();
406

  
407
		// on créé une Query, ici le pivot de la concordance est "[]"
408
		// Query Area: query itself + view properties
409
		Composite queryArea = new Composite(paramArea, SWT.NONE);
410
		RowData rdata = new RowData();
411
		queryArea.setLayoutData(rdata);
412
		queryArea.setLayout(new GridLayout(4, false));
413

  
... Ce différentiel a été tronqué car il excède la taille maximale pouvant être affichée.

Formats disponibles : Unified diff