Revision 859

tmp/org.txm.progression.rcp/plugin.xml (revision 859)
86 86
      <menuContribution
87 87
            locationURI="popup:org.txm.index.rcp.editors.IndexEditor">
88 88
         <command
89
               commandId="org.txm.progression.rcp.commands.SendToProgression"
89
               commandId="org.txm.progression.rcp.handlers.ComputeProgression"
90 90
               icon="icons/functions/progression.png"
91 91
               label="%command.name.3"
92 92
               style="push">
93
            <parameter
94
                  name="sendToTargetCommandId"
95
                  value="org.txm.progression.rcp.handlers.ComputeProgression">
96
            </parameter>
97 93
         </command>
98 94
      </menuContribution>
99 95
      <menuContribution
100 96
            locationURI="popup:org.txm.index.rcp.editors.DictionnaryEditor">
101 97
         <command
102
               commandId="org.txm.progression.rcp.commands.SendToProgression"
98
               commandId="org.txm.progression.rcp.handlers.ComputeProgression"
103 99
               icon="icons/functions/progression.png"
104 100
               label="%command.name.3"
105 101
               style="push">
106
            <parameter
107
                  name="sendToTargetCommandId"
108
                  value="org.txm.progression.rcp.handlers.ComputeProgression">
109
            </parameter>
110 102
         </command>
111 103
      </menuContribution>
112 104
      <menuContribution
113 105
            locationURI="popup:org.txm.internalview.rcp.editors.InternalViewEditor">
114 106
         <command
115
               commandId="org.txm.progression.rcp.commands.SendToProgression"
107
               commandId="org.txm.progression.rcp.handlers.ComputeProgression"
116 108
               icon="icons/functions/progression.png"
117 109
               label="%command.name.3"
118 110
               style="push">
119
            <parameter
120
                  name="sendToTargetCommandId"
121
                  value="org.txm.progression.rcp.handlers.ComputeProgression">
122
            </parameter>
123 111
         </command>
124 112
      </menuContribution>
125 113
   </extension>
......
166 154
            </iterate>
167 155
         </with>
168 156
      </definition>
157
      <definition
158
            id="ProgressionEditorActive">
159
         <with
160
               variable="activePart">
161
            <instanceof
162
                  value="org.txm.progression.rcp.editors.ProgressionEditor">
163
            </instanceof>
164
         </with>
165
      </definition>
169 166
   </extension>
167
   <extension
168
         point="org.eclipse.ui.handlers">
169
      <handler
170
            class="org.txm.progression.rcp.handlers.SendProgressionTo"
171
            commandId="org.txm.index.rcp.handlers.ComputeIndex">
172
         <activeWhen>
173
            <and>
174
               <reference
175
                     definitionId="ProgressionEditorActive">
176
               </reference>
177
               <reference
178
                     definitionId="SendSelectionContextNotActive">
179
               </reference>
180
            </and>
181
         </activeWhen>
182
      </handler>
183
   </extension>
170 184

  
171 185
</plugin>
tmp/org.txm.progression.rcp/META-INF/MANIFEST.MF (revision 859)
15 15
 org.eclipse.swt;visibility:=reexport,
16 16
 org.txm.core;bundle-version="0.7.0";visibility:=reexport,
17 17
 org.eclipse.core.expressions;bundle-version="3.4.600";visibility:=reexport,
18
 org.txm.rcp;visibility:=reexport
18
 org.txm.rcp;visibility:=reexport,
19
 org.txm.links.rcp;bundle-version="1.0.0"
19 20
Export-Package: org.txm.progression.rcp.adapters,org.txm.progression.r
20 21
 cp.chartsengine.events,org.txm.progression.rcp.editors,org.txm.progre
21 22
 ssion.rcp.handlers,org.txm.progression.rcp.messages,org.txm.progressi
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/handlers/SendProgressionTo.java (revision 859)
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.progression.rcp.handlers;
29

  
30
import org.eclipse.core.commands.ExecutionEvent;
31
import org.eclipse.jface.viewers.IStructuredSelection;
32
import org.txm.links.rcp.handlers.SendSelectionToQueryable;
33
import org.txm.progression.core.chartsengine.base.ProgressionChartCreator;
34
import org.txm.progression.core.functions.Progression;
35

  
36
/**
37
 * Sends the selected points of a progression to compute another command.
38
 * 
39
 * @author sjacquot
40
 * 
41
 */
42
public class SendProgressionTo extends SendSelectionToQueryable {
43

  
44

  
45
	@Override
46
	public String createQuery(ExecutionEvent event, IStructuredSelection selection) {
47
		String query;
48
		Progression progression = (Progression) this.getActiveEditorResult(event);
49
		// gets the progression queries from the current selected chart series
50
		query = progression.getQueriesString(((ProgressionChartCreator)progression.getChartCreator()).getSelectedSeries(progression.getChart()));
51
		return  query;
52
	}
53

  
54

  
55

  
56
}
0 57

  
tmp/org.txm.concordance.rcp/plugin.xml (revision 859)
102 102
      <menuContribution
103 103
            locationURI="popup:org.txm.index.rcp.editors.IndexEditor">
104 104
         <command
105
               commandId="org.txm.concordance.rcp.commands.SendToConcordance"
105
               commandId="org.txm.concordance.rcp.handlers.ComputeConcordance"
106 106
               icon="icons/concordance.png"
107 107
               label="%command.name.1"
108 108
               style="push">
109
            <parameter
110
                  name="sendToTargetCommandId"
111
                  value="org.txm.concordance.rcp.handlers.ComputeConcordance">
112
            </parameter>
113 109
         </command>
114 110
      </menuContribution>
115 111
      <menuContribution
116 112
            locationURI="popup:org.txm.index.rcp.editors.DictionnaryEditor">
117 113
         <command
118
               commandId="org.txm.concordance.rcp.commands.SendToConcordance"
114
               commandId="org.txm.concordance.rcp.handlers.ComputeConcordance"
119 115
               icon="icons/concordance.png"
120 116
               label="%command.name.1"
121 117
               style="push">
122
            <parameter
123
                  name="sendToTargetCommandId"
124
                  value="org.txm.concordance.rcp.handlers.ComputeConcordance">
125
            </parameter>
126 118
         </command>
127 119
      </menuContribution>
128 120
      <menuContribution
129 121
            locationURI="popup:org.txm.cooccurrence.rcp.editors.CooccurrencesEditor">
130 122
         <command
131
               commandId="org.txm.concordance.rcp.commands.SendToConcordance"
123
               commandId="org.txm.concordance.rcp.handlers.ComputeConcordance"
132 124
               icon="icons/concordance.png"
133 125
               label="%command.name.1"
134 126
               style="push">
135
            <parameter
136
                  name="sendToTargetCommandId"
137
                  value="org.txm.concordance.rcp.handlers.ComputeConcordance">
138
            </parameter>
139 127
         </command>
140 128
      </menuContribution>
141 129
      <menuContribution
142 130
            locationURI="popup:org.txm.internalview.rcp.editors.InternalViewEditor">
143 131
         <command
144
               commandId="org.txm.concordance.rcp.commands.SendToConcordance"
132
               commandId="org.txm.concordance.rcp.handlers.ComputeConcordance"
145 133
               icon="icons/concordance.png"
146 134
               label="%command.name.1"
147 135
               style="push">
148
            <parameter
149
                  name="sendToTargetCommandId"
150
                  value="org.txm.concordance.rcp.handlers.ComputeConcordance">
151
            </parameter>
152 136
         </command>
153 137
      </menuContribution>
154 138
      <menuContribution
155 139
            locationURI="popup:org.txm.referencer.rcp.editors.ReferencerEditor">
156 140
         <command
157
               commandId="org.txm.concordance.rcp.commands.SendToConcordance"
141
               commandId="org.txm.concordance.rcp.handlers.ComputeConcordance"
158 142
               icon="icons/concordance.png"
159 143
               label="%command.name.1"
160 144
               style="push">
161
            <parameter
162
                  name="sendToTargetCommandId"
163
                  value="org.txm.concordance.rcp.handlers.ComputeConcordance">
164
            </parameter>
165 145
         </command>
166 146
      </menuContribution>
167 147
      <menuContribution
168 148
            locationURI="popup:org.txm.edition.rcp.editors.SynopticEditionEditor">
169 149
         <command
170
               commandId="org.txm.concordance.rcp.commands.SendToConcordance"
150
               commandId="org.txm.concordance.rcp.handlers.ComputeConcordance"
171 151
               icon="icons/concordance.png"
172 152
               label="%command.name.1"
173 153
               style="push">
174
            <parameter
175
                  name="sendToTargetCommandId"
176
                  value="org.txm.concordance.rcp.handlers.ComputeConcordance">
177
            </parameter>
178 154
         </command>
179 155
      </menuContribution>
180 156
   </extension>
......
197 173
            id="org.txm.concordance.rcp.handlers.DeleteLines"
198 174
            name="%command.name.37">
199 175
      </command>
200
      <command
201
            categoryId="org.txm.rcp.category.txm"
202
            id="org.txm.concordance.rcp.commands.SendToConcordance"
203
            name="%command.name.1">
204
         <commandParameter
205
               id="sendToTargetCommandId"
206
               name="sendToTargetCommandId"
207
               optional="true">
208
         </commandParameter>
209
      </command>
210 176
   </extension>
211 177
   <extension
212 178
         point="org.eclipse.ui.preferencePages">
tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/BaseAbstractHandler.java (revision 859)
11 11
import org.eclipse.core.commands.ParameterValuesException;
12 12
import org.eclipse.core.commands.ParameterizedCommand;
13 13
import org.eclipse.core.commands.common.NotDefinedException;
14
import org.eclipse.swt.widgets.Event;
15 14
import org.eclipse.ui.IViewPart;
16 15
import org.eclipse.ui.IWorkbenchPage;
17 16
import org.eclipse.ui.IWorkbenchWindow;
18 17
import org.eclipse.ui.PartInitException;
19 18
import org.eclipse.ui.PlatformUI;
20 19
import org.eclipse.ui.commands.ICommandService;
20
import org.eclipse.ui.contexts.IContextActivation;
21
import org.eclipse.ui.contexts.IContextService;
21 22
import org.eclipse.ui.handlers.HandlerUtil;
22 23
import org.eclipse.ui.handlers.IHandlerService;
23 24
import org.txm.core.preferences.TXMPreferences;
......
39 40
public abstract class BaseAbstractHandler extends AbstractHandler {
40 41

  
41 42
	
43
	
44
	public final static String SEND_SELECTION_TO_COMMAND_CONTEXT_ID = "sendSelectionToContext"; //$NON-NLS-1$
45
	
46

  
47
	
42 48
	/**
43 49
	 * Default constructor.
44 50
	 */
......
123 129
	}
124 130
	
125 131
	/**
132
	 * Gets the parent of the result stored in the active editor.
133
	 * This parent will be send to the target command as parent of the new result.
134
	 * This method is essentially dedicated to be overridden, if needed, to define a parent that is not the direct parent (eg. the corpus parent instead of the partition parent). 
135
	 * @param event
136
	 * @return
137
	 */
138
	public TXMResult getResultParent(ExecutionEvent event)	{
139
		return this.getActiveEditorResult(event).getParent();
140
	}
141
	
142
	
143
	/**
126 144
	 * Logs a severe entry.
127 145
	 * @param selection
128 146
	 */
......
223 241

  
224 242
		
225 243
	}	
244

  
226 245
	
246
	/**
247
	 * Executes a command handler specified by its id and activates/deactivates the "send selection context".
248
	 * @param commandId
249
	 */
250
	public static void executeSendToCommand(String commandId) {
251
		executeSendToCommand(commandId, null);
252
	}
253

  
254
	
255
	
256
	/**
257
	 * Executes a command handler specified by its id and activates/deactivates the "send selection context".
258
	 * @param commandId
259
	 * @param resultUUID
260
	 */
261
	public static void executeSendToCommand(String commandId, String resultUUID) {
262
		IContextService contextService = (IContextService) PlatformUI.getWorkbench().getAdapter(IContextService.class);
263
		IContextActivation activationToken = contextService.activateContext(SEND_SELECTION_TO_COMMAND_CONTEXT_ID);
264
		executeCommand(commandId, resultUUID);
265
		contextService.deactivateContext(activationToken);
266
	}
267
	
268
	
269
	
270
	
227 271
}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 859)
53 53
import org.eclipse.ui.IWorkbenchWindow;
54 54
import org.eclipse.ui.PartInitException;
55 55
import org.eclipse.ui.PlatformUI;
56
import org.eclipse.ui.contexts.IContextActivation;
57
import org.eclipse.ui.contexts.IContextService;
56 58
import org.eclipse.ui.menus.IMenuService;
57 59
import org.eclipse.ui.part.EditorPart;
58 60
import org.txm.core.results.Parameter;
......
1171 1173
	 * @param column column index >= 0; if == -1, the parameter is ignored
1172 1174
	 * @param commandId
1173 1175
	 */
1174
	public static void addDoubleClickCommandListener(final Table table, final int column, final String commandId, final String targetCommandId)	{
1176
	public static void addDoubleClickCommandListener(final Table table, final int column, final String commandId)	{
1175 1177
		
1176 1178
		table.addMouseListener(new MouseAdapter() {
1177 1179
			@Override
1178 1180
			public void mouseDoubleClick(MouseEvent e) {
1179
				Point mouseposition = new Point(e.x
1180
						+ table.getHorizontalBar()
1181
						.getSelection(), e.y);
1182
				if (column >0 && column != getPointedColumn(table, mouseposition)) {
1181
				Point mouseposition = new Point(e.x + table.getHorizontalBar().getSelection(), e.y);
1182
				if (column > 0 && column != getPointedColumn(table, mouseposition)) {
1183 1183
					return;
1184 1184
				}
1185
				
1186
				BaseAbstractHandler.executeCommand(commandId, Collections.singletonMap("sendToTargetCommandId", targetCommandId)); //$NON-NLS-1$
1185
				BaseAbstractHandler.executeCommand(commandId);
1187 1186
			}
1188 1187
		});
1189 1188
	}
1190 1189
	
1190
	
1191 1191
	/**
1192
	 * Adds a mouse adapter to the specified composite that executes a command link specified by its id on double click event.
1193
	 * @param table
1194
	 * @param commandId
1195
	 */
1196
	public static void addDoubleClickCommandListener(Composite composite, final String commandId)	{
1197
		composite.addMouseListener(new MouseAdapter() {
1198
			@Override
1199
			public void mouseDoubleClick(MouseEvent e) {
1200
				BaseAbstractHandler.executeCommand(commandId);
1201
			}
1202
		});
1203
	}
1204

  
1205
	
1206
	/**
1192 1207
	 * Gets the pointed column.
1193 1208
	 *
1194 1209
	 * @param mouseposition the mouseposition
......
1200 1215
		for (int i = 0 ; i < table.getColumnCount() ; i++) {
1201 1216
			TableColumn col = table.getColumn(i);
1202 1217
			sumWidthColumn += col.getWidth();
1203
			if (x < sumWidthColumn)
1218
			if (x < sumWidthColumn) {
1204 1219
				return i;
1220
			}
1205 1221
		}
1206 1222
		
1207 1223
		return -1;
1208 1224
	}
1209
	
1210
	/**
1211
	 * Adds a mouse adapter to the specified composite that executes a command link specified by its id on double click event.
1212
	 * @param table
1213
	 * @param commandId
1214
	 */
1215
	public static void addDoubleClickCommandListener(Composite composite, final String commandId, final String targetCommandId)	{
1216
		composite.addMouseListener(new MouseAdapter() {
1217
			@Override
1218
			public void mouseDoubleClick(MouseEvent e) {
1219
				BaseAbstractHandler.executeCommand(commandId, Collections.singletonMap("sendToTargetCommandId", targetCommandId)); //$NON-NLS-1$
1220
			}
1221
		});
1222
	}
1223 1225

  
1224 1226
	/**
1225 1227
	 * @return the lastComputingParameters
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/ChartComposite.java (revision 859)
26 26

  
27 27

  
28 28

  
29
	protected static final String CONTEXT_MENU_ID =  "ChartEditorContextMenu"; //$NON-NLS-1$
29
	protected static final String CONTEXT_MENU_EMPTY_AREA_ID =  "ChartEditorContextMenuEmptyArea"; //$NON-NLS-1$
30
	protected static final String CONTEXT_MENU_ITEM_AREA_ID =  "ChartEditorContextMenuItemArea"; //$NON-NLS-1$
30 31
	
31 32

  
32 33
	/**
......
65 66

  
66 67
	
67 68
	/**
68
	 * Creates the pop up menu dedicated to empty area location click event.
69
	 * Creates the pop up menu dedicated to empty area location click event that is populated from plugin.xml.
69 70
	 */
70 71
	public void initEmptyAreaContextMenu()	{
71
		Menu menu = TXMEditor.initContextMenu(this, CONTEXT_MENU_ID);
72
		Menu menu = TXMEditor.initContextMenu(this, CONTEXT_MENU_EMPTY_AREA_ID);
72 73
	    this.contextMenus.set(EventCallBack.AREA_EMPTY, menu);
73 74
	}
74 75

  
......
77 78
	 * Creates the pop up menu dedicated to chart item location click event.
78 79
	 */
79 80
	public void initItemAreaContextMenu()	{
80
		Menu menu = new Menu(this);
81
	    MenuItem chartEntityLabelItem = new MenuItem(menu, SWT.CASCADE);
81
		Menu menu = TXMEditor.initContextMenu(this, CONTEXT_MENU_ITEM_AREA_ID);
82
		
83
		//Menu menu = new Menu(this);
84
	    //MenuItem chartEntityLabelItem = new MenuItem(menu, SWT.NONE);
82 85
	    //chartEntityLabelItem.setText(""); // this string is dedicated to be overridden by the current selected chart entity label/name 
83 86

  
84 87
	    // FIXME : tests
......
88 91
//	    deleteItem.setText("Delete");
89 92
//
90 93
	    // sub-menu for selected items
91
	    Menu newMenu = new Menu(menu);
92
	    chartEntityLabelItem.setMenu(newMenu);
94
//	    Menu newMenu = new Menu(menu);
95
//	    chartEntityLabelItem.setMenu(newMenu);
93 96

  
94 97
//	    MenuItem shortcutItem = new MenuItem(newMenu, SWT.NONE);
95 98
//	    shortcutItem.setText("Shortcut");
......
104 107
	 * @param index
105 108
	 */
106 109
	public void setCurrentContextMenu(int index)	{
110
		
111
		// FIXME: DEbug
112
		System.err.println("ChartComposite.setCurrentContextMenu(): setting menu to " + index + " / " + this.contextMenus.get(index));
113
		
107 114
		this.setMenu(this.contextMenus.get(index));
108 115
	}
109 116
	
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/SWTChartsComponentsProvider.java (revision 859)
695 695
							// update the mouse over item selection according to the mouse event
696 696
							chartEditor.getComposite().getChartComponent().updateMouseOverItem(e);
697 697
							
698
							// FIXME: temporary disabled for 0.7.8
699 698
							// manually pop up the menu
700 699
							if(chartEditor.getComposite().getMenu() != null)	{
701 700
								chartEditor.getComposite().getMenu().setLocation(new Point(e.getXOnScreen(), e.getYOnScreen()));
tmp/org.txm.chartsengine.rcp/plugin.xml (revision 859)
69 69
      </menuContribution>
70 70
      <menuContribution
71 71
            allPopups="false"
72
            locationURI="popup:ChartEditorContextMenu">
72
            locationURI="popup:ChartEditorContextMenuEmptyArea">
73 73
         <command
74 74
               commandId="ExportChartEditorView"
75 75
               icon="icons/export_view.png"
......
92 92
      </menuContribution>
93 93
      <menuContribution
94 94
            allPopups="false"
95
            locationURI="popup:ChartEditorContextMenuItemArea">
96
         <menu
97
               id="ChartEditorContextMenuItemArea.ItemMenu"
98
               label="selected items dynamic label">
99
         </menu>
100
      </menuContribution>
101
      <menuContribution
102
            allPopups="false"
95 103
            locationURI="toolbar:org.txm.rcp.toolbarresult?before=org.txm.rcp.handlers.export.ExportResult">
96 104
         <command
97 105
               commandId="ExportChart"
tmp/org.txm.index.rcp/src/org/txm/index/rcp/editors/IndexEditor.java (revision 859)
500 500
		paramArea.pack();
501 501

  
502 502
		// Add double click, "Send to" command
503
		TXMEditor.addDoubleClickCommandListener(viewer.getTable(), "org.txm.concordance.rcp.commands.SendToConcordance", "org.txm.concordance.rcp.handlers.ComputeConcordance"); //$NON-NLS-1$
504

  
503
		TXMEditor.addDoubleClickCommandListener(viewer.getTable(), 1, "org.txm.concordance.rcp.handlers.ComputeConcordance"); //$NON-NLS-1$
504
		TXMEditor.addDoubleClickCommandListener(viewer.getTable(), 2, "org.txm.progression.rcp.handlers.ComputeProgression"); //$NON-NLS-1$
505
		
505 506
		// Register the context menu
506 507
		TXMEditor.initContextMenu(this.viewer.getTable(), this.getSite(), this.viewer);
507 508

  
tmp/org.txm.index.rcp/plugin.xml (revision 859)
115 115
               <menuContribution
116 116
                     locationURI="popup:org.txm.index.rcp.editors.DictionnaryEditor">
117 117
                  <command
118
                        commandId="org.txm.index.rcp.commands.SendToIndex"
118
                        commandId="org.txm.index.rcp.handlers.ComputeIndex"
119 119
                        icon="icons/index.png"
120 120
                        label="%command.name.2"
121 121
                        style="push">
122
                     <parameter
123
                           name="sendToTargetCommandId"
124
                           value="org.txm.cooccurrence.rcp.handlers.ComputeCooccurrences">
125
                     </parameter>
126 122
                  </command>
127 123
               </menuContribution>
128 124
               <menuContribution
129 125
                     locationURI="popup:org.txm.internalview.rcp.editors.InternalViewEditor">
130 126
                  <command
131
                        commandId="org.txm.index.rcp.commands.SendToIndex"
127
                        commandId="org.txm.index.rcp.handlers.ComputeIndex"
132 128
                        icon="icons/index.png"
133 129
                        label="%command.name.2"
134 130
                        style="push">
135
                     <parameter
136
                           name="sendToTargetCommandId"
137
                           value="org.txm.cooccurrence.rcp.handlers.ComputeCooccurrences">
138
                     </parameter>
139 131
                  </command>
140 132
               </menuContribution>
133
               <menuContribution
134
                     locationURI="popup:ChartEditorContextMenuItemArea.ItemMenu">
135
                  <command
136
                        commandId="org.txm.index.rcp.handlers.ComputeIndex"
137
                        icon="icons/index.png"
138
                        label="%command.name.2"
139
                        style="push">
140
                     <visibleWhen
141
                           checkEnabled="false">
142
                        <reference
143
                              definitionId="ProgressionEditorActive">
144
                        </reference>
145
                     </visibleWhen>
146
                  </command>
147
               </menuContribution>
141 148
      
142 149
   </extension>
143 150
   <extension
......
190 197
            id="org.txm.index.rcp.handlers.ComputeLexicon"
191 198
            name="%command.name.0">
192 199
      </command>
193
      <command
194
            id="org.txm.index.rcp.commands.SendToIndex"
195
            name="%command.name.2">
196
         <commandParameter
197
               id="sendToTargetCommandId"
198
               name="sendToTargetCommandId"
199
               optional="true">
200
         </commandParameter>
201
      </command>
202 200

  
203 201
      <command
204 202
            defaultHandler="org.txm.synopticedition.rcp.commands.link.IndexToLexicalTable"
......
272 270
         point="org.eclipse.ui.handlers">
273 271
      <handler
274 272
            class="org.txm.index.rcp.handlers.SendIndexTo"
275
            commandId="org.txm.progression.rcp.commands.SendToProgression">
273
            commandId="org.txm.progression.rcp.handlers.ComputeProgression">
276 274
         <activeWhen>
277 275
         <and>
278 276
         <or>
......
285 283
         
286 284
         </or>
287 285
         <reference
288
               definitionId="OneOrMoreElementSelected">
286
               definitionId="SendSelectionContextNotActive">
289 287
         </reference>
290 288
         </and>
291 289
         </activeWhen>
292 290
      </handler>
293 291
      <handler
294 292
            class="org.txm.index.rcp.handlers.SendIndexTo"
295
            commandId="org.txm.concordance.rcp.commands.SendToConcordance">
293
            commandId="org.txm.concordance.rcp.handlers.ComputeConcordance">
296 294
         <activeWhen>
297 295
         <and>
298 296
            <or>
......
303 301
                     definitionId="LexiconEditorActive">
304 302
               </reference>
305 303
            </or>
306
            <reference
307
                  definitionId="OneOrMoreElementSelected">
308
            </reference>
304
            
305
            
306
               <reference
307
                     definitionId="SendSelectionContextNotActive">
308
               </reference>
309
            
309 310
            </and>
310 311
         </activeWhen>
311 312
      </handler>
312 313
      <handler
313 314
            class="org.txm.index.rcp.handlers.SendIndexTo"
314
            commandId="org.txm.cooccurrence.rcp.commands.SendToCooccurrence">
315
            commandId="org.txm.cooccurrence.rcp.handlers.ComputeCooccurrences">
315 316
         <activeWhen>
316 317
         <and>
317 318
               <reference
318 319
                     definitionId="IndexEditorActive">
319 320
               </reference>
320 321
               <reference
321
                     definitionId="OneOrMoreElementSelected">
322
                     definitionId="SendSelectionContextNotActive">
322 323
               </reference>
323 324
               </and>
324 325
         </activeWhen>
325 326
      </handler>
326 327
      <handler
327 328
            class="org.txm.index.rcp.handlers.SendIndexTo"
328
            commandId="org.txm.index.rcp.commands.SendToIndex">
329
            commandId="org.txm.index.rcp.handlers.ComputeIndex">
329 330
         <activeWhen>
330 331
         <and>
331 332
               <reference
332 333
                     definitionId="LexiconEditorActive">
333 334
               </reference>
334 335
               <reference
335
                     definitionId="OneOrMoreElementSelected">
336
                     definitionId="SendSelectionContextNotActive">
336 337
               </reference>
337 338
               </and>
338 339
         </activeWhen>
tmp/org.txm.internalview.rcp/plugin.xml (revision 859)
104 104
                      point="org.eclipse.ui.handlers">
105 105
                   <handler
106 106
                         class="org.txm.internalview.rcp.handlers.SendInternalViewTo"
107
                         commandId="org.txm.concordance.rcp.commands.SendToConcordance">
107
                         commandId="org.txm.concordance.rcp.handlers.ComputeConcordance">
108 108
                      <activeWhen>
109 109
                      <and>
110 110
                            <reference
111 111
                                  definitionId="InternalViewEditorActive">
112 112
                            </reference>
113 113
                                     <reference
114
               definitionId="OneOrMoreElementSelected">
115
         </reference>
114
                                           definitionId="SendSelectionContextNotActive">
115
                                     </reference>
116 116
                            </and>
117 117
                      </activeWhen>
118 118
                   </handler>
119 119
                   <handler
120 120
                         class="org.txm.internalview.rcp.handlers.SendInternalViewTo"
121
                         commandId="org.txm.index.rcp.commands.SendToIndex">
121
                         commandId="org.txm.index.rcp.handlers.ComputeIndex">
122 122
                      <activeWhen>
123 123
                      <and>
124 124
                         <reference
125 125
                               definitionId="InternalViewEditorActive">
126 126
                         </reference>
127 127
                                  <reference
128
               definitionId="OneOrMoreElementSelected">
129
         </reference>
128
                                        definitionId="SendSelectionContextNotActive">
129
                                  </reference>
130 130
                         </and>
131 131
                      </activeWhen>
132 132
                   </handler>
133 133
                   <handler
134 134
                         class="org.txm.internalview.rcp.handlers.SendInternalViewTo"
135
                         commandId="org.txm.progression.rcp.commands.SendToProgression">
135
                         commandId="org.txm.progression.rcp.handlers.ComputeProgression">
136 136
                      <activeWhen>
137 137
                      <and>
138 138
                            <reference
139 139
                                  definitionId="InternalViewEditorActive">
140 140
                            </reference>
141 141
                                     <reference
142
               definitionId="OneOrMoreElementSelected">
143
         </reference>
142
                                           definitionId="SendSelectionContextNotActive">
143
                                     </reference>
144 144
                            </and>
145 145
                      </activeWhen>
146 146
                   </handler>
tmp/org.txm.referencer.rcp/src/org/txm/referencer/rcp/editors/ReferencerEditor.java (revision 859)
316 316
		
317 317
		
318 318
		// Add double click, "Send to" command
319
		TXMEditor.addDoubleClickCommandListener(viewer.getTable(), "org.txm.concordance.rcp.commands.SendToConcordance", "org.txm.concordance.rcp.handlers.ComputeConcordance"); //$NON-NLS-1$
319
		TXMEditor.addDoubleClickCommandListener(viewer.getTable(), "org.txm.concordance.rcp.handlers.ComputeConcordance"); //$NON-NLS-1$
320 320
		
321 321
		// Register the context menu
322 322
		TXMEditor.initContextMenu(this.viewer.getTable(), this.getSite(), this.viewer);
tmp/org.txm.referencer.rcp/plugin.xml (revision 859)
117 117
         point="org.eclipse.ui.handlers">
118 118
      <handler
119 119
            class="org.txm.referencer.rcp.handlers.SendReferencerTo"
120
            commandId="org.txm.concordance.rcp.commands.SendToConcordance">
120
            commandId="org.txm.concordance.rcp.handlers.ComputeConcordance">
121 121
         <activeWhen>
122 122
         <and>
123 123
            <reference
124 124
                  definitionId="ReferencerEditorActive">
125 125
            </reference>
126
                     <reference
127
               definitionId="OneOrMoreElementSelected">
128
         </reference>
126
            <reference
127
                  definitionId="SendSelectionContextNotActive">
128
            </reference>
129 129
            </and>
130 130
         </activeWhen>
131 131
      </handler>
tmp/org.txm.cooccurrence.rcp/plugin.xml (revision 859)
10 10
            name="%command.name"
11 11
            returnTypeId="org.txm.cooccurrence.core.functions.Cooccurrence">
12 12
      </command>
13
      <command
14
            id="org.txm.cooccurrence.rcp.commands.SendToCooccurrence"
15
            name="%command.name.4">
16
         <commandParameter
17
               id="sendToTargetCommandId"
18
               name="sendToTargetCommandId"
19
               optional="true">
20
         </commandParameter>
21
      </command>
22 13
   </extension>
23 14
   <extension
24 15
         point="org.eclipse.ui.preferencePages">
......
104 95
      <menuContribution
105 96
            locationURI="popup:org.txm.index.rcp.editors.IndexEditor">
106 97
         <command
107
               commandId="org.txm.cooccurrence.rcp.commands.SendToCooccurrence"
98
               commandId="org.txm.cooccurrence.rcp.handlers.ComputeCooccurrences"
108 99
               icon="icons/cooccurrences.png"
109 100
               label="%command.name.4"
110 101
               style="push">
111
            <parameter
112
                  name="sendToTargetCommandId"
113
                  value="org.txm.cooccurrence.rcp.handlers.ComputeCooccurrences">
114
            </parameter>
115 102
         </command>
116 103
      </menuContribution>
117 104
   </extension>
......
154 141
         point="org.eclipse.ui.handlers">
155 142
      <handler
156 143
            class="org.txm.cooccurrence.rcp.handlers.SendCooccurrenceTo"
157
            commandId="org.txm.concordance.rcp.commands.SendToConcordance">
144
            commandId="org.txm.concordance.rcp.handlers.ComputeConcordance">
158 145
         <activeWhen>
159 146
            <and>
160 147
               <reference
161 148
                     definitionId="CooccurrenceEditorActive">
162 149
               </reference>
163 150
               <reference
164
                     definitionId="OneOrMoreElementSelected">
151
                     definitionId="SendSelectionContextNotActive">
165 152
               </reference>
166 153
            </and></activeWhen>
167 154
      </handler>
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/editors/CooccurrencesEditor.java (revision 859)
478 478
		
479 479
		
480 480
		// Add double click, "Send to" command
481
		TXMEditor.addDoubleClickCommandListener(viewer.getTable(), "org.txm.concordance.rcp.commands.SendToConcordance", "org.txm.concordance.rcp.handlers.ComputeConcordance"); //$NON-NLS-1$
481
		TXMEditor.addDoubleClickCommandListener(viewer.getTable(), "org.txm.concordance.rcp.handlers.ComputeConcordance"); //$NON-NLS-1$
482 482

  
483 483
		// TODO replace this with a command+menucontribution
484 484
		// viewer.getTable().addMouseListener(new MouseAdapter() {
tmp/org.txm.index.core/src/org/txm/index/core/functions/Lexicon.java (revision 859)
95 95
	private Corpus corpus;
96 96

  
97 97
	
98
	/**
99
	 * 
100
	 * @param corpus
101
	 */
102
	public Lexicon(Corpus corpus) {
103
		super(corpus);
104
		this.corpus = corpus;
98
	
99
	
100
	
101
	public Lexicon(Corpus corpus)	{
102
		this(null, corpus);
105 103
	}
106 104

  
105
	public Lexicon(String uuid)	{
106
		this(uuid, null);
107
	}
107 108
	
109
	public Lexicon(String uuid, Corpus corpus)	{
110
		super(uuid, corpus);
111
		this.corpus = (Corpus) this.parent;
112
	}
113

  
114
	
108 115
	@Override
109 116
	public boolean saveParameters() throws Exception {
110 117
		// TODO Auto-generated method stub
tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/events/DefaultChartMouseListener.java (revision 859)
161 161
							MultipleItemsSelector selector = (MultipleItemsSelector) renderer.getItemsSelector();
162 162
							int selectedSeries;
163 163
							for(int i = 0; i < selector.getSelectedSeriesCount(); i++) {
164
								
165
								// FIXME: this case should never happen but it happens since 0.8.0_alpha. Need to check why the selected series is not well removed in the selector
166
								if(selector.getSelectedSeries()[i] == null)	{
167
									continue;
168
								}
169
								
164 170
								selectedSeries = selector.getSelectedSeries()[i];
165 171
								int[] selectedItems = selector.getSelectedItems(selectedSeries);
166 172
								for(int j = 0; j < selectedItems.length; j++) {
......
170 176
									}
171 177
									// CA
172 178
									else if(itemEntity.getDataset() instanceof CAXYDataset)	{
173
										menuText += ((CAXYDataset) ((XYPlot)plot).getDataset()).getLabel(selectedSeries, selectedItems[j]);
179
										menuText += ((CAXYDataset)((XYPlot)plot).getDataset()).getLabel(selectedSeries, selectedItems[j]);
174 180
									}
175 181
									// Progression
176 182
									else if(itemEntity.getDataset() instanceof XYSeriesCollection)	{
177
										menuText +=  ((XYSeriesCollection)itemEntity.getDataset()).getSeriesKey(selectedSeries);
183
										menuText += ((XYSeriesCollection)itemEntity.getDataset()).getSeriesKey(selectedSeries);
178 184
										menuText += " / "; //$NON-NLS-1$
179 185
										break;
180 186
									}
......
219 225
			eventArea = EventCallBack.AREA_EMPTY;
220 226
		}
221 227

  
228
		
229
		
230
		// FIXME: Debug
231
//		System.err.println("DefaultChartMouseListener.chartMouseClicked(): ");
232
//    	System.out.println("DefaultChartMouseListener.chartMouseClicked(): call backs count: " + eventCallBacks.size());
233
//        System.err.println("DefaultChartMouseListener.chartMouseClicked(): click count: " + event.getTrigger().getClickCount());
234
		System.err.println("DefaultChartMouseListener.chartMouseClicked(): entity type: " + entity);
235
        System.err.println("DefaultChartMouseListener.chartMouseClicked(): eventArea: " + eventArea);
236

  
237
		
222 238
		// Set the composite current menu
223 239
		final int a = eventArea;
224 240
		final String t = menuText;
225 241
		this.chartComponent.getChartEditor().getComposite().getDisplay().syncExec(new Runnable () {
226 242
			public void run() {
227 243
				chartComponent.getChartEditor().getComposite().setCurrentContextMenu(a);
228
				if(!t.isEmpty() && chartComponent.getChartEditor().getComposite().getMenu() != null)	{
244
				if(!t.isEmpty() && chartComponent.getChartEditor().getComposite().getMenu() != null
245
						//&& chartComponent.getChartEditor().getComposite().getMenu().getItemCount() > 0
246
						)	{
247

  
248
					// FIXME: Debug
249
					System.err.println("DefaultChartMouseListener.chartMouseClicked(...).new Runnable() {...}.run(): menu = " + chartComponent.getChartEditor().getComposite().getMenu());
250
					
251
					
229 252
					chartComponent.getChartEditor().getComposite().getMenu().getItem(0).setText(t);
230 253
				}
231 254
			}
......
238 261
		}
239 262

  
240 263

  
241
		// FIXME: Debug
242
//    	System.out.println("DefaultChartMouseListener.chartMouseClicked(): call backs count: " + eventCallBacks.size());
243
//        System.err.println("DefaultChartMouseListener.chartMouseClicked(): click count: " + event.getTrigger().getClickCount());
244
//        System.err.println("DefaultChartMouseListener.chartMouseClicked(): entity type: " + entity);
245 264

  
246 265
	}
247 266

  
tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/swt/JFCComposite.java (revision 859)
1 1
package org.txm.chartsengine.jfreechart.rcp.swt;
2 2

  
3
import java.awt.Component;
4

  
5 3
import org.eclipse.swt.SWT;
6 4
import org.eclipse.swt.widgets.Composite;
7 5
import org.jfree.chart.ChartMouseListener;
......
11 9
import org.jfree.chart.plot.XYPlot;
12 10
import org.txm.chartsengine.jfreechart.core.renderers.MultipleItemsSelector;
13 11
import org.txm.chartsengine.jfreechart.core.renderers.interfaces.IRendererWithItemSelection;
14
import org.txm.chartsengine.rcp.IChartComponent;
15 12
import org.txm.chartsengine.rcp.editors.ChartEditor;
16 13
import org.txm.chartsengine.rcp.events.EventCallBackHandler;
17 14
import org.txm.chartsengine.rcp.swt.SwingChartComposite;
......
247 244
		else if(this.getChart().getPlot() instanceof CategoryPlot && this.getChart().getCategoryPlot().getRenderer() instanceof IRendererWithItemSelection)	{
248 245
			renderer = (IRendererWithItemSelection) this.getChart().getCategoryPlot().getRenderer();
249 246
		}
250
				
247

  
251 248
		if(renderer != null && renderer.getItemsSelector() instanceof MultipleItemsSelector)	{
252 249
			((MultipleItemsSelector)renderer.getItemsSelector()).removeAllSelectedItems();
253 250
		}
tmp/org.txm.core/src/java/org/txm/Toolbox.java (revision 859)
273 273
			Log.finest("Toolbox.initialize(): reloading persitent results...");
274 274
			ArrayList<String> resultsNodesQualifiers = TXMPreferences.getAllResultsNodesQualifiers();
275 275
			for (String nodeQualifier : resultsNodesQualifiers) {
276
				
277
				// FIXME: skip, Corpora, Text, Page, etc. that are not manage like this at this moment
278
				if(TXMPreferences.getString(TXMPreferences.BUNDLE_ID, nodeQualifier).isEmpty())	{
279
					continue;
280
				}
281
				
276 282
				try {
277 283
					Log.finest("Toolbox.initialize(): loading from result node qualifier " + nodeQualifier);
278
					Log.finest("Toolbox.initialize(): class =  " + TXMPreferences.getString("class", nodeQualifier));
279
					Log.finest("Toolbox.initialize(): parent_uuid =  " + TXMPreferences.getString(TXMPreferences.PARENT_UUID, nodeQualifier));
280
					Log.finest("Toolbox.initialize(): bundle_id =  " + TXMPreferences.getString(TXMPreferences.BUNDLE_ID, nodeQualifier));
284
					Log.finest("Toolbox.initialize(): class = " + TXMPreferences.getString("class", nodeQualifier));
285
					Log.finest("Toolbox.initialize(): parent_uuid = " + TXMPreferences.getString(TXMPreferences.PARENT_UUID, nodeQualifier));
286
					Log.finest("Toolbox.initialize(): bundle_id = " + TXMPreferences.getString(TXMPreferences.BUNDLE_ID, nodeQualifier));
281 287
					Bundle bundle = Platform.getBundle(TXMPreferences.getString(TXMPreferences.BUNDLE_ID, nodeQualifier));
282 288
					Class<?> cl = bundle.loadClass(TXMPreferences.getString("class", nodeQualifier));
283 289
					Constructor<?> cons = cl.getConstructor(String.class);
tmp/org.txm.links.rcp/plugin.xml (revision 859)
16 16
         </command>
17 17
      </menuContribution>
18 18
   </extension>
19
   <extension
20
         point="org.eclipse.ui.contexts">
21
      <context
22
            id="sendSelectionToContext"
23
            name="sendSelectionToContext"
24
            parentId="org.eclipse.ui.contexts.window">
25
      </context>
26
   </extension>
27
   <extension
28
         point="org.eclipse.core.expressions.definitions">
29
      <definition
30
            id="SendSelectionContextNotActive">
31
         <not>
32
            <with
33
                  variable="activeContexts">
34
               <iterate
35
                     ifEmpty="false"
36
                     operator="or">
37
                  <equals
38
                        value="sendSelectionToContext">
39
                  </equals>
40
               </iterate>
41
            </with>
42
         </not>
43
      </definition>
44
   </extension>
19 45

  
20 46
</plugin>
tmp/org.txm.links.rcp/src/org/txm/links/rcp/handlers/SendSelectionToQueryable.java (revision 859)
30 30
import org.eclipse.core.commands.ExecutionEvent;
31 31
import org.eclipse.core.commands.ExecutionException;
32 32
import org.eclipse.jface.viewers.IStructuredSelection;
33
import org.eclipse.ui.IWorkbenchWindow;
34
import org.eclipse.ui.PlatformUI;
35
import org.eclipse.ui.contexts.IContextActivation;
36
import org.eclipse.ui.contexts.IContextService;
33 37
import org.eclipse.ui.handlers.HandlerUtil;
34 38
import org.txm.core.preferences.TXMPreferences;
35 39
import org.txm.core.results.TXMResult;
......
45 49
 */
46 50
public abstract class SendSelectionToQueryable extends BaseAbstractHandler {
47 51

  
52
	
48 53

  
49 54
	/**
50 55
	 * Creates the query.
......
63 68
		return this.createQuery(event, selection);
64 69
	}
65 70

  
66
	/**
67
	 * Gets the parent of the result stored in the active editor.
68
	 * This parent will be send to the target command as parent of the new result.
69
	 * This method is essentially dedicated to be overridden, if needed, to define a parent that is not the direct parent (eg. the corpus parent instead of the partition parent). 
70
	 * @param event
71
	 * @return
72
	 */
73
	public TXMResult getResultParent(ExecutionEvent event)	{
74
		return this.getActiveEditorResult(event).getParent();
75
	}
71

  
76 72
	
77
	
78 73
	@Override
79 74
	public Object execute(ExecutionEvent event) throws ExecutionException {
80 75
		
76
		System.err.println("SendSelectionToQueryable.execute()");
77
		
81 78
		IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
82
		String commandId = event.getParameter("sendToTargetCommandId"); //$NON-NLS-1$
79
		//String commandId = event.getParameter("sendToTargetCommandId"); //$NON-NLS-1$
83 80
		
81
		String commandId = event.getCommand().getId();
82
		
83
		
84
		
84 85
		if (
85
				//selection != null && 
86
				commandId != null && !commandId.isEmpty()) {
86
				selection != null
87
				//&& 
88
				//commandId != null && !commandId.isEmpty()
89
				) {
87 90
			
88 91
			String query = this.createQuery(event, selection);
89 92
			String queries = this.createQueries(event, selection);
......
98 101
			TXMPreferences.put(uuid, TXMPreferences.PARENT_UUID, this.getResultParent(event).getUUID());
99 102
			TXMPreferences.put(uuid, TXMPreferences.QUERY, query);
100 103
			TXMPreferences.put(uuid, TXMPreferences.QUERIES, queries);
101
			BaseAbstractHandler.executeCommand(commandId, uuid);
104
			
105
			
106
			//this.getActiveEditor(event).close();
107

  
108
//			IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
109
//			IContextService contextService = (IContextService)window.getService(IContextService.class);
110
			
111
			
112
//			IContextService contextService = (IContextService) PlatformUI.getWorkbench().getAdapter(IContextService.class);
113
//			IContextActivation activationToken = contextService.activateContext(SEND_SELECTION_TO_COMMAND_CONTEXT_ID);
114
//			
115
//			
116
////			ICommandService commandManager = (ICommandService) window.getService(ICommandService.class);
117
////			IHandlerService handlerService = (IHandlerService)window.getService(IHandlerService.class);
118
////			handlerService.activateHandler(commandId, handler)
119
//			//event.getCommand().getHandler().dispose();
120
//			//event.getCommand().setHandler(handler)
121
//			
122
//			BaseAbstractHandler.executeCommand(commandId, uuid);
123
//			
124
//			
125
//			contextService.deactivateContext(activationToken);
126

  
127

  
128
			BaseAbstractHandler.executeSendToCommand(commandId, uuid);
129
			
102 130
		}
103 131
		else	{
104 132
			this.logCanNotCompute(selection);
tmp/org.txm.tigersearch.rcp/.settings/org.eclipse.jdt.groovy.core.prefs (revision 859)
1
eclipse.preferences.version=1
2
groovy.compiler.level=23
0 3

  
tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/Specificities.java (revision 859)
134 134
	
135 135
	
136 136
	
137
	
138
	
139
	
137 140
	/**
138 141
	 * Specificities.
139 142
	 *
......
149 152
		this.lexicalTable.setVMaxFilter(Integer.MAX_VALUE);
150 153
	}
151 154
	
152
	/**
153
	 * Utility method to compute the specificity index of a word in a subcorpus.
154
	 * <br>
155
	 * Calls the R specificities function with a matrix built with the parameters
156
	 * <pre>
157
	 * f	F-f
158
	 * t-f	T-t-F+f
159
	 * </pre>
160
	 * 
161
	 * @param f word frequency in subcorpus
162
	 * @param F word frequency in corpus
163
	 * @param t subcorpus size
164
	 * @param T corpus size
165
	 * @return the specificity index
166
	 * @throws Exception
167
	 */
168
	public static double computeIndex(int f, int F, int t, int T) throws Exception {
169
		RWorkspace rw = RWorkspace.getRWorkspaceInstance();
170
		rw.voidEval("library(textometry)");
171
		REXP rez = rw.eval("specificities(matrix(c("+f+", "+(t-f)+", "+(F-f)+", "+(T-t-F+f)+"), ncol=2))");
172
		if (rez != null) return rez.asDoubles()[0];
173
		return 0.0d;
174
	}
175
	
176
	
177
	/**
178
	 * Sets the unit property.
179
	 * @param unitProperty
180
	 */
181
	public void setUnitProperty(Property unitProperty)	{
182
		this.unitProperty = unitProperty;
183
	}
184
	
185 155

  
186
	
187 156
	@Override
188 157
	protected boolean _compute() throws Exception {
189 158
		
......
298 267
//		}
299 268
	}
300 269

  
270
	
301 271
	/**
272
	 * Utility method to compute the specificity index of a word in a subcorpus.
273
	 * <br>
274
	 * Calls the R specificities function with a matrix built with the parameters
275
	 * <pre>
276
	 * f	F-f
277
	 * t-f	T-t-F+f
278
	 * </pre>
279
	 * 
280
	 * @param f word frequency in subcorpus
281
	 * @param F word frequency in corpus
282
	 * @param t subcorpus size
283
	 * @param T corpus size
284
	 * @return the specificity index
285
	 * @throws Exception
286
	 */
287
	public static double computeIndex(int f, int F, int t, int T) throws Exception {
288
		RWorkspace rw = RWorkspace.getRWorkspaceInstance();
289
		rw.voidEval("library(textometry)");
290
		REXP rez = rw.eval("specificities(matrix(c("+f+", "+(t-f)+", "+(F-f)+", "+(T-t-F+f)+"), ncol=2))");
291
		if (rez != null) return rez.asDoubles()[0];
292
		return 0.0d;
293
	}
294
	
295
	
296
	/**
297
	 * Sets the unit property.
298
	 * @param unitProperty
299
	 */
300
	public void setUnitProperty(Property unitProperty)	{
301
		this.unitProperty = unitProperty;
302
	}
303
	
304

  
305
	
306
	
307
	/**
302 308
	 * Gets the type focus.
303 309
	 *
304 310
	 * @return the type focus

Also available in: Unified diff