Révision 3405
TXM/trunk/org.txm.textsbalance.core/src/org/txm/textsbalance/core/chartsengine/jfreechart/JFCTextsBalanceSpiderChartCreator.java (revision 3405) | ||
---|---|---|
72 | 72 |
while (it.hasNext()) { |
73 | 73 |
Comparable[] key = it.next(); |
74 | 74 |
Integer value = data.get(key); |
75 |
System.out.println("JFCTextsBalanceSpiderChartCreator.updateChart(): adding " + key + ", " + key[0] + ", " + key[1] + " to dataset."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ |
|
75 |
//System.out.println("JFCTextsBalanceSpiderChartCreator.updateChart(): adding " + key + ", " + key[0] + ", " + key[1] + " to dataset."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
|
76 | 76 |
dataset.addValue(value, key[0], key[1]); |
77 | 77 |
} |
78 | 78 |
|
79 |
chart.setTitle("metadata = " + textsBalance.getStructuralUnitProperty() + ", N = " + textsBalance.getValues().size() + ", fmin = " + textsBalance.getFMin() + |
|
80 |
", fmax = " + textsBalance.getFMax() + ", counting " + (textsBalance.groupingByTexts()?"texts":"words")); |
|
79 |
chart.setTitle("metadata = " + textsBalance.getStructuralUnitProperty() + ", N = " + textsBalance.getValues().size() + ", fmin = " + textsBalance.getFMin() + ", fmax = " + textsBalance.getFMax() + ", counting " + (textsBalance.groupingByTexts()?"texts":"words")); |
|
81 | 80 |
|
82 | 81 |
plot.setMaxValue(textsBalance.getFMax()); |
83 | 82 |
|
TXM/trunk/org.txm.connlu.core/src/org/txm/conllu/core/function/UDSearch.java (revision 3405) | ||
---|---|---|
9 | 9 |
import org.txm.conllu.core.preferences.UDPreferences; |
10 | 10 |
import org.txm.core.results.TXMParameters; |
11 | 11 |
import org.txm.libs.deptreeviz.UDPrintTree; |
12 |
import org.txm.searchengine.core.Selection; |
|
12 | 13 |
import org.txm.searchengine.cqp.CQPSearchEngine; |
13 | 14 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
14 | 15 |
import org.txm.searchengine.cqp.corpus.CQPCorpus; |
... | ... | |
54 | 55 |
return matches != null; |
55 | 56 |
} |
56 | 57 |
|
58 |
public Selection getSelection() { |
|
59 |
return matches; |
|
60 |
} |
|
61 |
|
|
57 | 62 |
public boolean toSVG(File svgFile, int sent, int sub, String T, String NT) { |
58 | 63 |
if (!isDrawn()) return false; // no result |
59 | 64 |
try { |
TXM/trunk/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/EditionPanel.java (revision 3405) | ||
---|---|---|
812 | 812 |
public void setURL(String url) { |
813 | 813 |
|
814 | 814 |
if (!this.browser.isDisposed()) { |
815 |
|
|
815 | 816 |
if ("webkit".equals(this.browser.getBrowserType())) { |
816 |
super.setURL(URLUtils.encodeURL(url)); |
|
817 |
String u = URLUtils.encodeURL(url); |
|
818 |
Log.finer("setting encoded URL: "+u); |
|
819 |
super.setURL(u); |
|
817 | 820 |
} else { |
821 |
Log.finer("setting URL: "+url); |
|
818 | 822 |
super.setURL(url); |
819 | 823 |
} |
820 | 824 |
} |
TXM/trunk/org.txm.treesearch.rcp/src/org/txm/treesearch/command/ConcordanceLineToTreeSearch.java (revision 3405) | ||
---|---|---|
1 |
// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté |
|
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.treesearch.command; |
|
29 |
|
|
30 |
import java.util.HashMap; |
|
31 |
import java.util.List; |
|
32 |
|
|
33 |
import org.eclipse.core.commands.ExecutionEvent; |
|
34 |
import org.eclipse.core.commands.ExecutionException; |
|
35 |
import org.eclipse.core.runtime.IConfigurationElement; |
|
36 |
import org.eclipse.core.runtime.RegistryFactory; |
|
37 |
import org.eclipse.jface.viewers.ISelection; |
|
38 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
39 |
import org.eclipse.jface.viewers.StructuredSelection; |
|
40 |
import org.eclipse.ui.handlers.HandlerUtil; |
|
41 |
import org.txm.concordance.core.functions.Concordance; |
|
42 |
import org.txm.concordance.core.functions.Line; |
|
43 |
import org.txm.core.messages.TXMCoreMessages; |
|
44 |
import org.txm.core.preferences.TXMPreferences; |
|
45 |
import org.txm.core.results.TXMResult; |
|
46 |
import org.txm.objects.Match; |
|
47 |
import org.txm.rcp.editors.TXMEditor; |
|
48 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
|
49 |
import org.txm.searchengine.core.QueryBasedTXMResult; |
|
50 |
import org.txm.searchengine.cqp.corpus.CQPCorpus; |
|
51 |
import org.txm.treesearch.editor.TreeSearchEditor; |
|
52 |
import org.txm.treesearch.function.TreeSearch; |
|
53 |
import org.txm.treesearch.function.TreeSearchSelector; |
|
54 |
import org.txm.treesearch.preferences.TreeSearchPreferences; |
|
55 |
import org.txm.utils.logger.Log; |
|
56 |
|
|
57 |
|
|
58 |
/** |
|
59 |
* Open the TIGERSearch Editor using the current selection OR a preference node set in the RCP command parameter TXMPreferences.RESULT_PARAMETERS_NODE_PATH |
|
60 |
* |
|
61 |
* @author mdecorde. |
|
62 |
*/ |
|
63 |
public class ConcordanceLineToTreeSearch extends BaseAbstractHandler { |
|
64 |
|
|
65 |
/** The ID. */ |
|
66 |
public static String ID = ConcordanceLineToTreeSearch.class.getName(); |
|
67 |
|
|
68 |
/* |
|
69 |
* (non-Javadoc) |
|
70 |
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
|
71 |
*/ |
|
72 |
@Override |
|
73 |
public Object execute(final ExecutionEvent event) throws ExecutionException { |
|
74 |
|
|
75 |
TXMResult r = BaseAbstractHandler.getActiveEditorResult(event); |
|
76 |
|
|
77 |
if (!(r instanceof Concordance)) { |
|
78 |
Log.warning("Result is not a concordance: "+r); |
|
79 |
return null; |
|
80 |
} |
|
81 |
|
|
82 |
ISelection s = HandlerUtil.getCurrentSelection(event); |
|
83 |
if (!(s instanceof StructuredSelection)) { |
|
84 |
Log.warning("Selection is not a Line: "+s); |
|
85 |
return null; |
|
86 |
} |
|
87 |
|
|
88 |
StructuredSelection selection = (StructuredSelection) s; |
|
89 |
List list = selection.toList(); |
|
90 |
|
|
91 |
if (list.size() == 0) { |
|
92 |
Log.warning("No editor selection: "+r); |
|
93 |
return null; |
|
94 |
} |
|
95 |
|
|
96 |
Concordance concordance = (Concordance)r; |
|
97 |
Object o = list.get(0); |
|
98 |
if (!(o instanceof Line)) { |
|
99 |
Log.warning("Selection is not a Line: "+o); |
|
100 |
return null; |
|
101 |
} |
|
102 |
Line l = (Line)o; |
|
103 |
//TreeSearchSelector selector = ComputeTreeSearch.getSelectorForCorpus(concordance.getCorpus(), "UD"); |
|
104 |
|
|
105 |
TreeSearch ts = ComputeTreeSearch.getTreeSearchFor(concordance.getCorpus()); |
|
106 |
|
|
107 |
ts.setQuery(concordance.getQuery()); |
|
108 |
|
|
109 |
try { |
|
110 |
if (ts.compute() && ts.getSelection() != null) { |
|
111 |
int i = 0; |
|
112 |
|
|
113 |
for (Match m : ts.getSelection().getMatches()) { |
|
114 |
if (m.getStart() <= l.getKeywordPosition() && l.getKeywordPosition() <= m.getEnd()) { |
|
115 |
ts.setIndexAndSubIndex(i, 1); |
|
116 |
break; |
|
117 |
} |
|
118 |
i++; |
|
119 |
} |
|
120 |
} |
|
121 |
} |
|
122 |
catch (Exception e) { |
|
123 |
// TODO Auto-generated catch block |
|
124 |
e.printStackTrace(); |
|
125 |
} |
|
126 |
|
|
127 |
return ComputeTreeSearch.openEditor(ts); |
|
128 |
} |
|
129 |
} |
|
0 | 130 |
TXM/trunk/org.txm.treesearch.rcp/plugin.xml (revision 3405) | ||
---|---|---|
48 | 48 |
name="Syntactic Tree" |
49 | 49 |
returnTypeId="org.txm.treesearch.function.TreeSearch"> |
50 | 50 |
</command> |
51 |
<command |
|
52 |
categoryId="TreeSearch4TXM.commands.category" |
|
53 |
defaultHandler="org.txm.treesearch.command.ConcordanceLineToTreeSearch" |
|
54 |
id="org.txm.treesearch.command.ConcordanceLineToTreeSearch" |
|
55 |
name="Syntactic Tree concordance link"> |
|
56 |
</command> |
|
51 | 57 |
</extension> |
52 | 58 |
<extension |
53 | 59 |
point="org.eclipse.ui.menus"> |
... | ... | |
95 | 101 |
<menuContribution |
96 | 102 |
locationURI="popup:org.txm.concordance.rcp.editors.ConcordanceEditor"> |
97 | 103 |
<command |
98 |
commandId="org.txm.treesearch.command.ComputeTreeSearch"
|
|
104 |
commandId="org.txm.treesearch.command.ConcordanceLineToTreeSearch"
|
|
99 | 105 |
icon="icons/functions/Tree.png" |
100 | 106 |
label="Send To TreeSearch" |
101 | 107 |
style="push"> |
TXM/trunk/org.txm.treesearch.core/src/org/txm/treesearch/function/TreeSearch.java (revision 3405) | ||
---|---|---|
7 | 7 |
import org.txm.core.results.TXMParameters; |
8 | 8 |
import org.txm.core.results.TXMResult; |
9 | 9 |
import org.txm.searchengine.core.IQuery; |
10 |
import org.txm.searchengine.core.Selection; |
|
10 | 11 |
import org.txm.searchengine.cqp.corpus.CQPCorpus; |
11 | 12 |
import org.txm.treesearch.preferences.TreeSearchPreferences; |
12 | 13 |
|
... | ... | |
141 | 142 |
|
142 | 143 |
return this.subIndex; |
143 | 144 |
} |
145 |
|
|
146 |
public void setQuery(IQuery query) { |
|
147 |
this.pQuery = query; |
|
148 |
} |
|
149 |
|
|
150 |
public abstract Selection getSelection(); |
|
144 | 151 |
|
145 | 152 |
} |
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 3405) | ||
---|---|---|
904 | 904 |
|
905 | 905 |
// restrict the computing Job to one at time |
906 | 906 |
if (this.computingJob != null && this.computingJob.getResult() == null) { |
907 |
Log.info(NLS.bind("Editor is already computing {0}. Please wait or abort the computing job ({1}).", this.result.getSimpleName(), this.computingJob.getName()));
|
|
907 |
Log.finer(NLS.bind("Editor is already computing {0}. Please wait or abort the computing job ({1}).", this.result, this.computingJob.getName()));
|
|
908 | 908 |
return this.computingJob; |
909 | 909 |
} |
910 | 910 |
|
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/CorporaView.java (revision 3405) | ||
---|---|---|
406 | 406 |
Object selectedItem = selection.getFirstElement(); |
407 | 407 |
if (selectedItem != null) { |
408 | 408 |
String commandId = doubleClickInstalledCommands.get(selectedItem.getClass().getName()); |
409 |
|
|
410 |
if (commandId == null) { |
|
411 |
for (String clazz : doubleClickInstalledCommands.keySet()) { |
|
412 |
if (selectedItem.getClass().getSuperclass().getName().equals(clazz)) { |
|
413 |
commandId = doubleClickInstalledCommands.get(clazz); |
|
414 |
break; |
|
415 |
} |
|
416 |
} |
|
417 |
} |
|
418 |
|
|
409 | 419 |
if (commandId != null) { |
410 | 420 |
BaseAbstractHandler.executeCommand(commandId); |
411 | 421 |
} |
TXM/trunk/org.txm.tigersearch.rcp/src/org/txm/function/tigersearch/TIGERSearch.java (revision 3405) | ||
---|---|---|
10 | 10 |
import org.txm.core.results.TXMParameters; |
11 | 11 |
import org.txm.objects.CorpusBuild; |
12 | 12 |
import org.txm.searchengine.core.SearchEnginesManager; |
13 |
import org.txm.searchengine.core.Selection; |
|
13 | 14 |
import org.txm.searchengine.cqp.CQPSearchEngine; |
14 | 15 |
import org.txm.searchengine.cqp.corpus.CQPCorpus; |
15 | 16 |
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty; |
... | ... | |
324 | 325 |
|
325 | 326 |
return "platform:/plugin/org.txm.tigersearch.rcp/icons/functions/TS.png"; |
326 | 327 |
} |
328 |
|
|
329 |
@Override |
|
330 |
public Selection getSelection() { |
|
331 |
|
|
332 |
// TODO Auto-generated method stub |
|
333 |
return null; |
|
334 |
} |
|
327 | 335 |
} |
Formats disponibles : Unified diff