Revision 466

tmp/org.txm.queryindex.rcp/.classpath (revision 466)
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
4
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
5
		<accessrules>
6
			<accessrule kind="accessible" pattern="**"/>
7
		</accessrules>
8
	</classpathentry>
9
	<classpathentry kind="src" path="src"/>
10
	<classpathentry kind="output" path="bin"/>
11
</classpath>
0 12

  
tmp/org.txm.queryindex.rcp/META-INF/MANIFEST.MF (revision 466)
1
Manifest-Version: 1.0
2
Bundle-ManifestVersion: 2
3
Bundle-Name: org.txm.queryindex.rcp
4
Bundle-SymbolicName: org.txm.queryindex.rcp;singleton:=true
5
Bundle-Version: 1.0.0.qualifier
6
Bundle-Activator: queryindexrcp.Activator
7
Require-Bundle: org.eclipse.ui,
8
 org.eclipse.core.runtime,
9
 org.eclipse.ui.editors;bundle-version="3.8.100",
10
 org.eclipse.core.expressions;bundle-version="3.4.500",
11
 org.txm.core;bundle-version="0.7.0",
12
 org.txm.index.core;bundle-version="1.0.0",
13
 org.txm.index.rcp;bundle-version="1.0.0",
14
 org.txm.rcp;bundle-version="0.7.8",
15
 org.txm.lexicaltable.core,
16
 org.txm.statsengine.r.core,
17
 org.txm.statsengine.r.rcp
18
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
19
Bundle-ActivationPolicy: lazy
20
Export-Package: org.txm.functions.queryindex,
21
 org.txm.rcpapplication.commands.function;x-friends:="org.txm.rcpapplication,org.txm.toolbox",
22
 org.txm.rcpapplication.commands.link,
23
 org.txm.rcpapplication.editors.input,
24
 org.txm.rcpapplication.editors.queryindex,
25
 queryindexrcp,
26
 queryindexrcp.actions,
27
 queryindexrcp.adapters
28
Bundle-Vendor: Textometrie.org
0 29

  
tmp/org.txm.queryindex.rcp/TODO.txt (revision 466)
1
- link to LexicalTable
2
- link to Matrice MotsxMots
3
- link to WordCloud 
4
- Adapter :
5
	getAdapter
6
	create Adapter
7
	declare Adapter in plugin.xml
8
- CorporaView :
9
	status line
10
	open result
11
- Delete Object
12
	implémenter Function devrait suffire
13
- LexicalTableImpl : createLexicalImpl
14
- Command : ComputeQueryIndex
15
- Editor
16
- Editor input
17
- WordCloud : constructeur
18
- WordCloud editor : init
0 19

  
tmp/org.txm.queryindex.rcp/.project (revision 466)
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>QueryIndexRCP</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
		<buildCommand>
14
			<name>org.eclipse.pde.ManifestBuilder</name>
15
			<arguments>
16
			</arguments>
17
		</buildCommand>
18
		<buildCommand>
19
			<name>org.eclipse.pde.SchemaBuilder</name>
20
			<arguments>
21
			</arguments>
22
		</buildCommand>
23
	</buildSpec>
24
	<natures>
25
		<nature>org.eclipse.pde.PluginNature</nature>
26
		<nature>org.eclipse.jdt.core.javanature</nature>
27
	</natures>
28
</projectDescription>
0 29

  
tmp/org.txm.queryindex.rcp/src/queryindexrcp/actions/SampleAction.java (revision 466)
1
package queryindexrcp.actions;
2

  
3
import org.eclipse.jface.action.IAction;
4
import org.eclipse.jface.viewers.ISelection;
5
import org.eclipse.ui.IWorkbenchWindow;
6
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
7
import org.eclipse.jface.dialogs.MessageDialog;
8

  
9
/**
10
 * Our sample action implements workbench action delegate.
11
 * The action proxy will be created by the workbench and
12
 * shown in the UI. When the user tries to use the action,
13
 * this delegate will be created and execution will be 
14
 * delegated to it.
15
 * @see IWorkbenchWindowActionDelegate
16
 */
17
public class SampleAction implements IWorkbenchWindowActionDelegate {
18
	private IWorkbenchWindow window;
19
	/**
20
	 * The constructor.
21
	 */
22
	public SampleAction() {
23
	}
24

  
25
	/**
26
	 * The action has been activated. The argument of the
27
	 * method represents the 'real' action sitting
28
	 * in the workbench UI.
29
	 * @see IWorkbenchWindowActionDelegate#run
30
	 */
31
	public void run(IAction action) {
32
		MessageDialog.openInformation(
33
			window.getShell(),
34
			"QueryIndexRCP",
35
			"Hello, Eclipse world");
36
	}
37

  
38
	/**
39
	 * Selection in the workbench has been changed. We 
40
	 * can change the state of the 'real' action here
41
	 * if we want, but this can only happen after 
42
	 * the delegate has been created.
43
	 * @see IWorkbenchWindowActionDelegate#selectionChanged
44
	 */
45
	public void selectionChanged(IAction action, ISelection selection) {
46
	}
47

  
48
	/**
49
	 * We can use this method to dispose of any system
50
	 * resources we previously allocated.
51
	 * @see IWorkbenchWindowActionDelegate#dispose
52
	 */
53
	public void dispose() {
54
	}
55

  
56
	/**
57
	 * We will cache window object in order to
58
	 * be able to provide parent shell for the message dialog.
59
	 * @see IWorkbenchWindowActionDelegate#init
60
	 */
61
	public void init(IWorkbenchWindow window) {
62
		this.window = window;
63
	}
64
}
0 65

  
tmp/org.txm.queryindex.rcp/src/queryindexrcp/adapters/AdapterFactory.java (revision 466)
1
// Copyright © 2010-2013 ENS de Lyon.
2
package queryindexrcp.adapters;
3

  
4
import org.eclipse.core.runtime.IAdapterFactory;
5
import org.eclipse.jface.resource.ImageDescriptor;
6
import org.eclipse.ui.model.IWorkbenchAdapter;
7
import org.eclipse.ui.plugin.AbstractUIPlugin;
8
import org.txm.functions.queryindex.QueryIndex;
9
import org.txm.rcp.Application;
10
import org.txm.rcp.IImageKeys;
11

  
12
/**
13
 * A factory for creating Adapter objects.
14
 * 
15
 * @author mdecorde
16
 */
17
public class AdapterFactory implements IAdapterFactory {
18

  
19
	/** The Index adapter. */
20
	private IWorkbenchAdapter QueryIndexAdapter = new IWorkbenchAdapter() {
21

  
22
		@Override
23
		public Object[] getChildren(Object o) {
24
			return new Object[0];
25
		}
26

  
27
		@Override
28
		public ImageDescriptor getImageDescriptor(Object object) {
29
			return AbstractUIPlugin.imageDescriptorFromPlugin(
30
					Application.PLUGIN_ID, IImageKeys.QUERYINDEX);
31
		}
32

  
33
		@Override
34
		public String getLabel(Object o) {
35
			return ((QueryIndex) o).getName();
36
		}
37

  
38
		@Override
39
		public Object getParent(Object o) {
40
			return ((QueryIndex) o).getCorpus();
41
		}
42
	};
43

  
44
	/**
45
	 * Gets the adapter.
46
	 *
47
	 * @param adaptableObject the adaptable object
48
	 * @param adapterType the adapter type
49
	 * @return the adapter
50
	 * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object,
51
	 * java.lang.Class)
52
	 */
53
	@Override
54
	public Object getAdapter(Object adaptableObject, Class adapterType) {
55
		if (adapterType == IWorkbenchAdapter.class
56
				&& adaptableObject instanceof QueryIndex)
57
			return QueryIndexAdapter;
58
		return null;
59
	}
60

  
61
	/**
62
	 * Gets the adapter list.
63
	 *
64
	 * @return the adapter list
65
	 * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
66
	 */
67
	@Override
68
	@SuppressWarnings("unchecked") //$NON-NLS-1$
69
	public Class[] getAdapterList() {
70
		return new Class[] { IWorkbenchAdapter.class };
71
	}
72

  
73
}
0 74

  
tmp/org.txm.queryindex.rcp/src/queryindexrcp/Activator.java (revision 466)
1
package queryindexrcp;
2

  
3
import org.eclipse.jface.resource.ImageDescriptor;
4
import org.eclipse.ui.plugin.AbstractUIPlugin;
5
import org.osgi.framework.BundleContext;
6

  
7
/**
8
 * The activator class controls the plug-in life cycle
9
 */
10
public class Activator extends AbstractUIPlugin {
11

  
12
	// The plug-in ID
13
	public static final String PLUGIN_ID = "QueryIndexRCP"; //$NON-NLS-1$
14

  
15
	// The shared instance
16
	private static Activator plugin;
17
	
18
	/**
19
	 * The constructor
20
	 */
21
	public Activator() {
22
	}
23

  
24
	/*
25
	 * (non-Javadoc)
26
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
27
	 */
28
	public void start(BundleContext context) throws Exception {
29
		super.start(context);
30
		plugin = this;
31
	}
32

  
33
	/*
34
	 * (non-Javadoc)
35
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
36
	 */
37
	public void stop(BundleContext context) throws Exception {
38
		plugin = null;
39
		super.stop(context);
40
	}
41

  
42
	/**
43
	 * Returns the shared instance
44
	 *
45
	 * @return the shared instance
46
	 */
47
	public static Activator getDefault() {
48
		return plugin;
49
	}
50

  
51
	/**
52
	 * Returns an image descriptor for the image file at the given
53
	 * plug-in relative path
54
	 *
55
	 * @param path the path
56
	 * @return the image descriptor
57
	 */
58
	public static ImageDescriptor getImageDescriptor(String path) {
59
		return imageDescriptorFromPlugin(PLUGIN_ID, path);
60
	}
61
}
0 62

  
tmp/org.txm.queryindex.rcp/src/org/txm/functions/queryindex/QueryIndex.java (revision 466)
1
package org.txm.functions.queryindex;
2

  
3
import java.io.BufferedReader;
4
import java.io.File;
5
import java.io.FileInputStream;
6
import java.io.FileOutputStream;
7
import java.io.IOException;
8
import java.io.InputStreamReader;
9
import java.io.OutputStreamWriter;
10
import java.util.ArrayList;
11
import java.util.Arrays;
12
import java.util.Collection;
13
import java.util.Collections;
14
import java.util.Comparator;
15
import java.util.LinkedHashMap;
16
import java.util.List;
17
import java.util.Map;
18

  
19
import org.eclipse.core.runtime.IAdaptable;
20
import org.eclipse.jface.resource.ImageDescriptor;
21
import org.eclipse.ui.model.IWorkbenchAdapter;
22
import org.eclipse.ui.plugin.AbstractUIPlugin;
23
import org.txm.core.messages.TXMCoreMessages;
24
import org.txm.core.results.TXMResult;
25
import org.txm.index.core.functions.LineComparator.SortMode;
26
import org.txm.index.core.messages.IndexCoreMessages;
27
import org.txm.lexicaltable.core.functions.LexicalTable;
28
import org.txm.lexicaltable.core.statsengine.r.data.LexicalTableImpl;
29
import org.txm.rcp.IImageKeys;
30
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
31
import org.txm.searchengine.cqp.corpus.Corpus;
32
import org.txm.searchengine.cqp.corpus.Part;
33
import org.txm.searchengine.cqp.corpus.Partition;
34
import org.txm.searchengine.cqp.corpus.QueryResult;
35
import org.txm.searchengine.cqp.corpus.query.Query;
36
import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
37
import org.txm.utils.logger.Log;
38

  
39
public class QueryIndex extends TXMResult implements IAdaptable {
40
	Corpus corpus;
41
	Partition partition;
42

  
43
	LinkedHashMap<String, QueryIndexLine> lines = new LinkedHashMap<String, QueryIndexLine>();
44
	List<String> partnames;
45
	//	private int FilterFmin;
46
	//	private int FilterFmax;
47
	//	private int FilterVmax;
48

  
49
	//	public int getFilterFmin() {
50
	//		return FilterFmin;
51
	//	}
52
	//
53
	//	public int getFilterFmax() {
54
	//		return FilterFmax;
55
	//	}
56
	//
57
	//	public int getFilterVmax() {
58
	//		return FilterVmax;
59
	//	}
60

  
61
	/** The writer. */
62
	private OutputStreamWriter writer;
63

  
64
	public int getT() {
65
		int t = 0;
66
		for (QueryIndexLine line : lines.values()) {
67
			t += line.getFrequency();
68
		}
69
		return t;
70
	}
71

  
72
	public int getFmin() {
73
		int t = 999999999;
74
		for (QueryIndexLine line : lines.values()) {
75
			int f = line.getFrequency();
76
			if (f < t) t = f;
77
		}
78
		return t;
79
	}
80

  
81
	public int getFmax() {
82
		int t = 0;
83
		for (QueryIndexLine line : lines.values()) {
84
			int f = line.getFrequency();
85
			if (f > t) t = f;
86
		}
87
		return t;
88
	}
89

  
90
	public int getV() {
91
		return lines.values().size();
92
	}
93

  
94
	public QueryIndex(Corpus corpus) {
95
		this.corpus = corpus;
96
		partnames = Arrays.asList(corpus.getName());
97
	}
98

  
99
	public String getName() {
100
		if (partition != null)
101
			return partition.getName();
102
		return corpus.getName();
103
	}
104

  
105
	public TXMResult getParent() {
106
		if (partition != null) return partition;
107
		return corpus;
108
	}
109

  
110
	public QueryIndex(Partition partition) {
111
		this.corpus = partition.getCorpus();
112
		this.partition = partition;
113
		partnames = partition.getPartNames();
114
	}
115

  
116
	public Corpus getCorpus() {
117
		return corpus;
118
	}
119

  
120
	public Partition getPartition() {
121
		return partition;
122
	}
123

  
124
	public Collection<QueryIndexLine> getLines() {
125
		return lines.values();
126
	}
127

  
128
	public LinkedHashMap<String, QueryIndexLine> getLinesHash() {
129
		return lines;
130
	}
131

  
132
	//	public void filterLines(int fmin, int fmax) {
133
	//		System.out.println("filter lines fmin="+fmin +" fmax="+fmax );
134
	//		this.FilterFmin = fmin;
135
	//		this.FilterFmax = fmax;
136
	//	}
137
	int multi = 1;
138
	public void sortLines(SortMode mode, boolean revert) {
139

  
140
		multi = 1;
141
		if (revert) multi = -1;
142
		List<Map.Entry<String, QueryIndexLine>> entries =
143
				new ArrayList<Map.Entry<String, QueryIndexLine>>(lines.entrySet());
144

  
145
		if (mode == SortMode.FREQUNIT) {
146
			Collections.sort(entries, new Comparator<Map.Entry<String, QueryIndexLine>>() {
147
				public int compare(Map.Entry<String, QueryIndexLine> a, Map.Entry<String, QueryIndexLine> b){
148
					int ret = multi * (a.getValue().getFrequency() - b.getValue().getFrequency());
149
					if (ret == 0) {
150
						return multi * a.getValue().getName().compareTo(b.getValue().getName());
151
					}
152
					return ret;
153
				}
154
			});
155
		} else if (mode == SortMode.FREQ) {
156
			Collections.sort(entries, new Comparator<Map.Entry<String, QueryIndexLine>>() {
157
				public int compare(Map.Entry<String, QueryIndexLine> a, Map.Entry<String, QueryIndexLine> b){
158
					return multi * (a.getValue().getFrequency() - b.getValue().getFrequency());
159
				}
160
			});
161
		} else if (mode == SortMode.UNIT) {
162
			Collections.sort(entries, new Comparator<Map.Entry<String, QueryIndexLine>>() {
163
				public int compare(Map.Entry<String, QueryIndexLine> a, Map.Entry<String, QueryIndexLine> b){
164
					return multi * a.getValue().getName().compareTo(b.getValue().getName());
165
				}
166
			});
167
		} else if (mode == SortMode.UNITFREQ) {
168
			Collections.sort(entries, new Comparator<Map.Entry<String, QueryIndexLine>>() {
169
				public int compare(Map.Entry<String, QueryIndexLine> a, Map.Entry<String, QueryIndexLine> b){
170
					int ret = multi * a.getValue().getName().compareTo(b.getValue().getName());
171
					if (ret == 0) {
172
						return multi * (a.getValue().getFrequency() - b.getValue().getFrequency());
173
					}
174
					return ret;
175
				}
176
			});
177
		}
178

  
179
		LinkedHashMap<String, QueryIndexLine> sortedMap = new LinkedHashMap<String, QueryIndexLine>();
180
		for (Map.Entry<String, QueryIndexLine> entry : entries) {
181
			sortedMap.put(entry.getKey(), entry.getValue());
182
		}
183

  
184
		lines = sortedMap;
185
	}
186

  
187
	//	public void cut(int vmax) {
188
	//		System.out.println("TODO cut tmax="+vmax );
189
	//		this.FilterVmax = vmax;
190
	//	}
191

  
192
	public boolean isComputedWithPartition() {
193
		return partition != null;
194
	}
195

  
196
	public void addLinesFromFile(File propFile) throws CqiClientException, IOException {
197
		BufferedReader reader = new BufferedReader(new InputStreamReader(
198
				new FileInputStream(propFile), "UTF-8")); //$NON-NLS-1$
199

  
200
		String line = reader.readLine();
201
		while (line != null) {
202
			String[] split = line.split("=", 2); //$NON-NLS-1$
203
			if (split.length == 2) {
204
				if (hasLine(split[0])) {
205
					System.out.println(TXMCoreMessages.QueryIndex_2+line);
206
				} else {
207
					if (addLine(split[0], new Query(split[1])) == null) {
208
						System.out.println(TXMCoreMessages.QueryIndex_3+line);
209
					}
210
				}
211
			}
212
			line = reader.readLine();
213
		}
214
		reader.close();
215
	}
216

  
217
	/**
218
	 * Write all the lines on a writer.
219
	 *
220
	 * @param outfile the outfile
221
	 * @param encoding the encoding
222
	 * @param colseparator the colseparator
223
	 * @param txtseparator the txtseparator
224
	 * @return true, if successful
225
	 */
226
	public boolean toTxt(File outfile, String encoding, String colseparator, String txtseparator) {
227
		try {
228
			toTxt(outfile, 0, lines.size(), encoding, colseparator, txtseparator);
229
		} catch (Exception e) {
230
			System.err.println(IndexCoreMessages.Index_7 + Log.toString(e));
231
			return false;
232
		}
233
		return true;
234
	}
235

  
236
	/**
237
	 * Write the lines between from and to on a writer.
238
	 *
239
	 * @param outfile the outfile
240
	 * @param from The first line to be written
241
	 * @param to The last line to be writen
242
	 * @param encoding the encoding
243
	 * @param colseparator the colseparator
244
	 * @param txtseparator the txtseparator
245
	 * @throws CqiClientException the cqi client exception
246
	 * @throws IOException Signals that an I/O exception has occurred.
247
	 */
248
	public void toTxt(File outfile, int from, int to, String encoding, String colseparator, String txtseparator)
249
			throws CqiClientException, IOException {
250
		// NK: writer declared as class attribute to perform a clean if the operation is interrupted
251
		this.writer = new OutputStreamWriter(new FileOutputStream(outfile),
252
				encoding); 
253
		String header = "Queries"; //$NON-NLS-1$
254
		header = txtseparator+ header.substring(0, header.length() - 1) +txtseparator;
255
		header += colseparator+ txtseparator+ "F" + txtseparator; //$NON-NLS-1$
256

  
257
		if (partnames.size() > 1)
258
			for (int j = 0; j < partnames.size(); j++)
259
				header += colseparator + txtseparator+ partnames.get(j).replace(txtseparator, txtseparator+txtseparator)+txtseparator; 
260
		header += "\n"; //$NON-NLS-1$
261
		writer.write(header);
262

  
263
		// for(Line ligne: lines)
264
		for (String name : lines.keySet()) {
265
			QueryIndexLine ligne = lines.get(name);
266
			writer.write(txtseparator+ ligne.getName().replace(txtseparator, txtseparator+txtseparator)+ txtseparator + colseparator + ligne.getFrequency()); 
267
			if (partnames.size() > 1)
268
				for (int j = 0; j < partnames.size(); j++)
269
					writer.write(colseparator + ligne.getFrequency(j)); 
270
			writer.write("\n"); //$NON-NLS-1$
271
		}
272
		writer.flush();
273
		writer.close();
274
	}
275

  
276
	public List<String> getPartnames() {
277
		return partnames;
278
	}
279

  
280
	public QueryIndexLine addLine(String name, Query query) throws CqiClientException {
281
		if (lines.containsKey(name)) return null;
282
		QueryResult[] qresults;
283
		if (partition != null) {
284
			qresults = new QueryResult[partition.getNPart()];
285
			List<Part> parts = partition.getParts();
286
			for (int i = 0 ; i < parts.size() ; i++) {
287
				qresults[i] = parts.get(i).query(query, "tmp", true); //$NON-NLS-1$
288
				//qresults[i].drop(); // free mem done later
289
			}
290
		} else {
291
			qresults = new QueryResult[1];
292
			qresults[0] = corpus.query(query, "tmp", true); //$NON-NLS-1$
293
			//qresults[0].drop(); // free mem done later
294
		}
295

  
296
		QueryIndexLine line = new QueryIndexLine(name, query, qresults);
297
		lines.put(name, line);
298
		return line;
299
	}
300

  
301
	public LexicalTable toLexicalTable() {
302
		if (partition == null) return null;
303

  
304
		int npart = partition.getNPart();
305
		int[][] freqs = new int[lines.size()][npart];
306
		String[] rownames = new String[lines.size()];
307
		String[] colnames = new String[npart];
308

  
309
		int i = 0;
310
		for (String key : lines.keySet()) {
311

  
312
			QueryIndexLine line = lines.get(key);
313
			int[] linefreqs = line.getFreqs();
314
			rownames[i] = line.getName();
315
			for (int j = 0 ; j < npart ; j++) {
316
				freqs[i][j] = linefreqs[j];
317
			}
318
			i++;
319
		}
320
		List<Part> parts = partition.getParts();
321
		for (int j = 0 ; j < npart ; j++) {
322
			colnames[j] = parts.get(j).getName();
323
		}
324

  
325
		try {
326
			LexicalTableImpl lt = new LexicalTableImpl(freqs, rownames, colnames);
327
			LexicalTable table = new LexicalTable(partition, partition.getProperty(), 1, lt);
328
			return table;
329
		} catch (Exception e) {
330
			Log.printStackTrace(e);
331
		}
332
		return null;
333
	}
334

  
335
	public boolean removeLine(String name) {
336
		if (lines.containsKey(name)) {
337
			lines.remove(name);
338
			return true;
339
		} else {
340
			return false;
341
		}
342
	}
343

  
344
	public boolean hasLine(String name) {
345
		return lines.containsKey(name);
346
	}
347

  
348
	public ArrayList<QueryIndexLine> getLines(int from, int to) {
349
		if (lines.size() == 0) return new ArrayList<QueryIndexLine>();
350

  
351
		if (from < 0) from = 0;
352
		if (to < 0) to = 0;
353
		if (to > lines.size()) to = lines.size();
354
		if (from > to) from = to - 1;
355
		ArrayList<QueryIndexLine> tmp = new ArrayList<QueryIndexLine>();
356
		int i = 0;
357
		for (QueryIndexLine line : lines.values()) {
358
			if (i >= from && i < to) {
359
				tmp.add(line);
360
			}
361
			i++;
362
		}
363

  
364
		return tmp;
365
	}
366

  
367
	@Override
368
	public void clean() {
369
		try {
370
			this.writer.flush();
371
			this.writer.close();	
372
		} catch (IOException e) {
373
			Log.printStackTrace(e);
374
		}
375
	}
376

  
377
	@Override
378
	public Object getAdapter(Class adapterType) {
379
		if (adapterType == IWorkbenchAdapter.class)
380
			return queryindexAdapter;
381
		return null;
382
	}
383

  
384
	/** The QueryIndex adapter. */
385
	private static IWorkbenchAdapter queryindexAdapter = new IWorkbenchAdapter() {
386

  
387
		@Override
388
		public Object[] getChildren(Object o) {
389
			return new Object[0];
390
		}
391

  
392
		@Override
393
		public ImageDescriptor getImageDescriptor(Object object) {
394
			return IImageKeys.getImageDescriptor(IImageKeys.QUERYINDEX);
395
			//return AbstractUIPlugin.imageDescriptorFromPlugin("QueryIndexRCP", "icons/functions/WordCloud.png"); //$NON-NLS //$NON-NLS-1$
396
			//return null;
397
		}
398

  
399
		@Override
400
		public String getLabel(Object o) {
401
			return ((QueryIndex) o).getName();
402
		}
403

  
404
		@Override
405
		public Object getParent(Object o) {
406
			if (((QueryIndex) o).getPartition() != null) {
407
				return ((QueryIndex) o).getPartition();
408
			} else {
409
				return ((QueryIndex) o).getCorpus();
410
			}
411
		}
412
	};
413

  
414
	@Override
415
	public boolean delete() {
416
		if (partition != null) return partition.removeResult(this);
417
		else if (corpus != null) return corpus.removeResult(this);
418
		return false;
419
	}
420

  
421
	@Override
422
	public String getSimpleName() {
423
		return "";
424
	}
425

  
426
	@Override
427
	public String getDetails() {
428
		return "";
429
	}
430
}
0 431

  
tmp/org.txm.queryindex.rcp/src/org/txm/functions/queryindex/package.html (revision 466)
1
<html>
2
<body>
3
<p>Prototype of Query index.</p>
4
</body>
5
</html>
0 6

  
tmp/org.txm.queryindex.rcp/src/org/txm/functions/queryindex/QueryIndexLine.java (revision 466)
1
package org.txm.functions.queryindex;
2

  
3
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
4
import org.txm.searchengine.cqp.corpus.QueryResult;
5
import org.txm.searchengine.cqp.corpus.query.Query;
6

  
7
public class QueryIndexLine {
8
	String name;
9
	private Query query;
10
	QueryResult[] qresults;
11
	int[] freqs;
12
	int total;
13

  
14

  
15
	public QueryIndexLine(String name, Query query, QueryResult[] qresults) {
16
		this.qresults = qresults;
17
		this.query = query;
18
		this.name = name;
19
	}
20

  
21
	public String getName() {
22
		return name;
23
	}
24

  
25
	public Query getQuery() {
26
		return query;
27
	}
28
	
29
	public int[] getFreqs() {
30
		computeFreqsAndTotal();
31
		return freqs;
32
	}
33
	
34
	private void computeFreqsAndTotal() {
35
		if (freqs == null) {
36
			//System.out.println("compute freqs");
37
			total = 0;
38
			try {
39
				freqs = new int[qresults.length];
40
				for (int i = 0 ; i < freqs.length ; i++) {
41
					//System.out.println("add "+qresults[i].getNMatch());
42
					freqs[i] = qresults[i].getNMatch();
43
					total += freqs[i];
44
					qresults[i].drop();
45
				}
46
				qresults = null;
47
			} catch (CqiClientException e) {
48
				// TODO Auto-generated catch block
49
				org.txm.utils.logger.Log.printStackTrace(e);
50
				freqs = new int[0];
51
			}
52
		} else {
53
			total = 0;
54
			for (int i = 0 ; i < freqs.length ; i++) {
55
				total += freqs[i];
56
			}
57
		}
58
	}
59

  
60
	public int getFrequency() {
61
		computeFreqsAndTotal();
62
		return total;
63
	}
64
	
65
	public int getFrequency(int i) {
66
		computeFreqsAndTotal();
67
		return freqs[i];
68
	}
69
	
70
	public void setFrequencies(int[] freqs) {
71
		this.freqs = freqs;
72
//		total = 0 ;
73
//		for (int f : freqs) total+=f;
74
//		System.out.println("total : "+total);
75
	}
76

  
77
	/*private static void mergeMatches(int from, List<Match> matches, List<Match> tmp) {
78
		int im1 = 0;
79
		for (int im2 = 0 ; im2 < tmp.size() && im1 < matches.size() ;) {
80
			Match m1 = matches.get(im1);
81
			Match m2 = tmp.get(im2);
82

  
83
			if (m1.getStart() < m2.getStart()) {
84
				im1++;
85
			} else if (m1.getStart() >  m2.getStart()) {
86
				im2++;
87
				matches.add(im1,m2);
88
			} else {
89
				if (m1.getEnd() <  m2.getEnd()) {
90
					im1++;
91
				} else if (m1.getEnd() >  m2.getEnd()) {
92
					im2++;
93
					matches.add(im1,m2);
94
				} else {
95
					System.out.println("ERROR while merging : m1 == m2");
96
				}
97
			}
98
		} // end of match merge
99
	}
100

  
101
	public void union(List<QueryIndexLine> lines) throws CqiClientException {
102
		for (QueryIndexLine line : lines) { // process lines	
103
			for (QueryResult qresult : line.getQResult()) {
104

  
105
				List<Match> matches = qresult.getMatches();
106

  
107
				int nmatches = matches.size();
108
				int im1 = 0;
109
				List<Match> matches2 = qresult.getMatches();
110
				int nmatches2 = matches2.size();
111
				ArrayList<Match> tmp = new ArrayList<Match>(); // receive the match to add
112

  
113
				// 1-5 2-5 3-6 7-9
114
				// 1.4 1-5 2-5 3-5 7-8 7-9
115
				// select all without doublons
116
				int im2;
117
				for (im2 = 0 ; im2 < nmatches2 && im1 < nmatches ;) {
118
					Match m1 = matches.get(im1);
119
					Match m2 = matches2.get(im2);
120

  
121
					if (m1.getStart() == m2.getStart() && m1.getEnd() == m2.getEnd()) {
122
						// don't add
123
						im2++; // test next match2
124
					} else {
125
						tmp.add(m2);
126
						if (m1.getStart() <  m2.getStart()) {
127
							im1++;
128
						} else if (m1.getStart() >  m2.getStart()){
129
							im2++;
130
						} else {
131
							if (m1.getEnd() <  m2.getEnd()) {
132
								im1++;
133
							} else {
134
								im2++;
135
							} 
136
						}
137
					}
138
				} // almost end of match selection
139
				for (int i = im2 ; i < nmatches2 ; i++) 
140
					tmp.add(matches2.get(im2)); // get the last ones if any
141

  
142
				// merge
143
				mergeMatches(0, matches, tmp);
144
			} // end of union
145
			freqs = null; // will be recomputed next time
146
		}
147
	}*/
148

  
149
	/*public void inter(List<QueryIndexLine> lines) throws CqiClientException {
150
		List<Match> matches = qresult.getMatches();
151
		for (QueryIndexLine line : lines) {
152
			List<Match> matches2 = line.getQResult().getMatches();
153
		}
154
		freq = -1;
155
	}
156

  
157
	public void minus(List<QueryIndexLine> lines)throws CqiClientException {
158
		List<Match> matches = qresult.getMatches();
159
		for (QueryIndexLine line : lines) {
160
			List<Match> matches2 = line.getQResult().getMatches();
161
		}
162
		freq = -1;
163
	}
164
	 */
165
}
0 166

  
tmp/org.txm.queryindex.rcp/src/org/txm/rcpapplication/editors/queryindex/LineContentProvider.java (revision 466)
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.rcpapplication.editors.queryindex;
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.functions.queryindex.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/rcpapplication/editors/queryindex/LineLabelProvider.java (revision 466)
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.rcpapplication.editors.queryindex;
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.functions.queryindex.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/rcpapplication/editors/queryindex/QueryIndexEditor.java (revision 466)
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.rcpapplication.editors.queryindex;
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.custom.ScrolledComposite;
44
import org.eclipse.swt.events.ControlAdapter;
45
import org.eclipse.swt.events.ControlEvent;
46
import org.eclipse.swt.events.KeyEvent;
47
import org.eclipse.swt.events.KeyListener;
48
import org.eclipse.swt.events.MouseAdapter;
49
import org.eclipse.swt.events.MouseEvent;
50
import org.eclipse.swt.events.SelectionEvent;
51
import org.eclipse.swt.events.SelectionListener;
52
import org.eclipse.swt.graphics.Font;
53
import org.eclipse.swt.graphics.FontData;
54
import org.eclipse.swt.graphics.Image;
55
import org.eclipse.swt.graphics.Point;
56
import org.eclipse.swt.graphics.Rectangle;
57
import org.eclipse.swt.layout.FormAttachment;
58
import org.eclipse.swt.layout.FormData;
59
import org.eclipse.swt.layout.FormLayout;
60
import org.eclipse.swt.layout.GridData;
61
import org.eclipse.swt.layout.GridLayout;
62
import org.eclipse.swt.widgets.Button;
63
import org.eclipse.swt.widgets.Composite;
64
import org.eclipse.swt.widgets.Display;
65
import org.eclipse.swt.widgets.FileDialog;
66
import org.eclipse.swt.widgets.Label;
67
import org.eclipse.swt.widgets.Menu;
68
import org.eclipse.swt.widgets.Spinner;
69
import org.eclipse.swt.widgets.TableColumn;
70
import org.eclipse.ui.IEditorInput;
71
import org.eclipse.ui.IEditorSite;
72
import org.eclipse.ui.PartInitException;
73
import org.eclipse.ui.part.EditorPart;
74
import org.txm.functions.queryindex.QueryIndex;
75
import org.txm.functions.queryindex.QueryIndexLine;
76
import org.txm.index.core.functions.LineComparator.SortMode;
77
import org.txm.index.rcp.messages.IndexUIMessages;
78
import org.txm.rcp.JobsTimer;
79
import org.txm.rcp.Messages;
80
import org.txm.rcp.StatusLine;
81
import org.txm.rcp.commands.editor.CustomizableEditor;
82
import org.txm.rcp.editors.TableKeyListener;
83
import org.txm.rcp.swt.dialog.LastOpened;
84
import org.txm.rcp.swt.widget.NamedAssistedQueryWidget;
85
import org.txm.rcp.swt.widget.NavigationWidget;
86
import org.txm.rcp.utils.JobHandler;
87
import org.txm.rcp.views.QueriesView;
88
import org.txm.rcp.views.corpora.CorporaView;
89
import org.txm.rcpapplication.editors.input.QueryIndexEditorInput;
90
import org.txm.searchengine.cqp.CQPEngine;
91
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
92
import org.txm.searchengine.cqp.corpus.Corpus;
93
import org.txm.searchengine.cqp.corpus.Partition;
94
import org.txm.searchengine.cqp.corpus.Property;
95
import org.txm.searchengine.cqp.corpus.query.Query;
96
import org.txm.statsengine.r.rcp.views.RVariablesView;
97
import org.txm.utils.logger.Log;
98

  
99
/**
100
 * display the query index parameters and result.
101
 * 
102
 * @author mdecorde
103
 */
104
public class QueryIndexEditor extends EditorPart implements CustomizableEditor {
105

  
106
	/** The Constant ID. */
107
	public static final String ID = "org.txm.rcpapplication.editors.queryindex.QueryIndexEditor"; //$NON-NLS-1$
108

  
109
	/** The corpus. */
110
	protected Corpus corpus;
111
	protected Partition partition; // can be null
112

  
113
	/** The index. */
114
	protected QueryIndex queryindex;
115
	boolean stored = false; // start storing at first line added
116
	// protected boolean saveQueryIndex = true;
117

  
118
	// params
119
	/** The query label. */
120
	protected Label queryLabel;
121

  
122
	/** The query widget. */
123
	protected NamedAssistedQueryWidget queryWidget;
124

  
125
	/** The N ligne p page spinner. */
126
	protected Spinner NLignePPageSpinner;
127
	// infos
128
	/** The navigation area. */
129
	protected NavigationWidget navigationArea;
130

  
131
	/** The l fmin info. */
132
	protected Label lFminInfo;
133

  
134
	/** The l fmax info. */
135
	protected Label lFmaxInfo;
136

  
137
	/** The l v info. */
138
	protected Label lVInfo;
139

  
140
	/** The l t info. */
141
	protected Label lTInfo;
142
	// result
143
	/** The line table viewer. */
144
	protected TableViewer viewer;
145

  
146
	/** The n column. */
147
	protected TableColumn nColumn;
148

  
149
	/** The unit column. */
150
	protected TableColumn unitColumn;
151

  
152
	/** The freq column. */
153
	protected TableColumn freqColumn;
154

  
155
	/** The separator column. */
156
	protected TableColumn separatorColumn;
157

  
158
	/** The top line. */
159
	protected int topLine;
160

  
161
	/** The bottom line. */
162
	protected int bottomLine;
163

  
164
	/** The nblinesperpage. */
165
	protected int nblinesperpage;
166

  
167
	/** The nblinesmax. */
168
	protected int nblinesmax;
169

  
170
	/** The scroll composite. */
171
	private ScrolledComposite scrollComposite;
172

  
173
	/** The head composite. */
174
	private Composite headComposite;
175

  
176
	/** The title. */
177
	String title;
178

  
179
	/**
180
	 * Instantiates a new index editor.
181
	 */
182
	public QueryIndexEditor() {
183
		super();
184
	}
185

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

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

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

  
226
		this.corpus = ((QueryIndexEditorInput) input).getCorpus();
227
		this.partition = ((QueryIndexEditorInput) input).getPartition();
228
		this.queryindex = ((QueryIndexEditorInput) input).getQueryIndex();
229
	}
230

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

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

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

  
266
	/**
267
	 * Compute index.
268
	 */
269
	public void compute() {
270

  
271
		createQueryIndex();
272

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

  
282
		final String name;
283
		if (queryWidget.getQueryName().length() == 0) {
284
			name = query.toString();
285
		} else {
286
			name = queryWidget.getQueryName();
287
		}
288

  
289
		try {
290
			JobHandler jobhandler = new JobHandler(title,
291
					queryWidget.getParent()) {
292
				@Override
293
				protected IStatus run(IProgressMonitor monitor) {
294
					this.runInit(monitor);
295
					JobsTimer.start();
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff