Révision 845
| tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java (revision 845) | ||
|---|---|---|
| 65 | 65 |
* Default unit/token property String. |
| 66 | 66 |
*/ |
| 67 | 67 |
public final static String DEFAULT_UNIT_PROPERTY = "word"; //$NON-NLS-1$ |
| 68 |
|
|
| 69 |
/** |
|
| 70 |
* Default structural unit String. |
|
| 71 |
*/ |
|
| 72 |
public final static String DEFAULT_STRUCTURAL_UNIT = "text"; //$NON-NLS-1$ |
|
| 68 | 73 |
|
| 74 |
/** |
|
| 75 |
* Default structural unit property String. |
|
| 76 |
*/ |
|
| 77 |
public final static String DEFAULT_STRUCTURAL_UNIT_PROPERTY = "text_id"; //$NON-NLS-1$ |
|
| 78 |
|
|
| 79 |
|
|
| 80 |
|
|
| 69 | 81 |
// essentially for Links and Persistence |
| 70 | 82 |
public final static String RESULT_UUID = "result_uuid"; //$NON-NLS-1$ |
| 71 | 83 |
public final static String PARENT_UUID = "parent_uuid"; //$NON-NLS-1$ |
| ... | ... | |
| 93 | 105 |
*/ |
| 94 | 106 |
public static final String STRUCTURAL_UNIT_PROPERTY = "structural_unit_property"; //$NON-NLS-1$ |
| 95 | 107 |
|
| 108 |
|
|
| 96 | 109 |
/** |
| 110 |
* Structural unit properties. |
|
| 111 |
*/ |
|
| 112 |
public static final String STRUCTURAL_UNIT_PROPERTIES = "structural_unit_properties"; //$NON-NLS-1$ |
|
| 113 |
|
|
| 114 |
|
|
| 115 |
/** |
|
| 97 | 116 |
* Properties. |
| 98 | 117 |
*/ |
| 99 |
public static final String PROPERTIES = "properties"; //$NON-NLS-1$
|
|
| 118 |
public static final String UNIT_PROPERTIES = "unit_properties"; //$NON-NLS-1$
|
|
| 100 | 119 |
|
| 101 | 120 |
|
| 102 | 121 |
/** |
| ... | ... | |
| 1217 | 1236 |
// System.err.println("TXMPreferences.put(): byte array -> need to prove/validate this method.");
|
| 1218 | 1237 |
// scope.getNode(nodeQualifier).putByteArray(key, (byte[]) value); |
| 1219 | 1238 |
// } |
| 1220 |
else {
|
|
| 1239 |
else if(value != null) {
|
|
| 1221 | 1240 |
// FIXME: to do if needed |
| 1222 | 1241 |
//FIXME: Debug |
| 1223 | 1242 |
System.err.println("TXMPreferences.putLocal(): error, can't find a put method that matches the value type: " + value.getClass() + "=" + value + ".");
|
| tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/handlers/ExportChart.java (revision 845) | ||
|---|---|---|
| 70 | 70 |
@Override |
| 71 | 71 |
public Object execute(ExecutionEvent event) throws ExecutionException {
|
| 72 | 72 |
|
| 73 |
Object selection = this.getSelection(event);
|
|
| 73 |
Object selection = this.getCorporaViewSelectedObject(event);
|
|
| 74 | 74 |
|
| 75 | 75 |
if(!(selection instanceof ChartResult)) {
|
| 76 | 76 |
return null; |
| tmp/org.txm.referencer.rcp/plugin.xml (revision 845) | ||
|---|---|---|
| 57 | 57 |
</visibleWhen> |
| 58 | 58 |
</command> |
| 59 | 59 |
</menuContribution> |
| 60 |
<menuContribution |
|
| 61 |
locationURI="popup:org.txm.referencer.rcp.editors.ReferencerEditor"> |
|
| 62 |
<command |
|
| 63 |
commandId="org.txm.referencer.rcp.handlers.ReferencerToConc" |
|
| 64 |
style="push"> |
|
| 65 |
</command> |
|
| 66 |
</menuContribution> |
|
| 67 | 60 |
</extension> |
| 68 | 61 |
<extension |
| 69 | 62 |
point="org.eclipse.ui.commands"> |
| 70 |
<command |
|
| 71 |
defaultHandler="org.txm.referencer.rcp.handlers.ReferencerToConc" |
|
| 72 |
id="org.txm.referencer.rcp.handlers.ReferencerToConc" |
|
| 73 |
name="%command.name.57"> |
|
| 74 |
</command> |
|
| 75 | 63 |
|
| 76 | 64 |
<command |
| 77 | 65 |
categoryId="org.txm.rcp.category.txm" |
| ... | ... | |
| 96 | 84 |
</iterate> |
| 97 | 85 |
</with> |
| 98 | 86 |
</definition> |
| 87 |
<definition |
|
| 88 |
id="ReferencerEditorActive"> |
|
| 89 |
<with |
|
| 90 |
variable="activePart"> |
|
| 91 |
<instanceof |
|
| 92 |
value="org.txm.referencer.rcp.editors.ReferencerEditor"> |
|
| 93 |
</instanceof> |
|
| 94 |
</with> |
|
| 95 |
</definition> |
|
| 99 | 96 |
</extension> |
| 100 | 97 |
<extension |
| 101 | 98 |
point="org.eclipse.core.runtime.adapters"> |
| ... | ... | |
| 116 | 113 |
name="Referencer"> |
| 117 | 114 |
</page> |
| 118 | 115 |
</extension> |
| 116 |
<extension |
|
| 117 |
point="org.eclipse.ui.handlers"> |
|
| 118 |
<handler |
|
| 119 |
class="org.txm.referencer.rcp.handlers.SendReferencerTo" |
|
| 120 |
commandId="org.txm.concordance.rcp.commands.SendToConcordance"> |
|
| 121 |
<activeWhen> |
|
| 122 |
<and> |
|
| 123 |
<reference |
|
| 124 |
definitionId="ReferencerEditorActive"> |
|
| 125 |
</reference> |
|
| 126 |
<reference |
|
| 127 |
definitionId="OneOrMoreElementSelected"> |
|
| 128 |
</reference> |
|
| 129 |
</and> |
|
| 130 |
</activeWhen> |
|
| 131 |
</handler> |
|
| 132 |
</extension> |
|
| 119 | 133 |
</plugin> |
| tmp/org.txm.referencer.rcp/META-INF/MANIFEST.MF (revision 845) | ||
|---|---|---|
| 1 | 1 |
Manifest-Version: 1.0 |
| 2 |
Require-Bundle: org.txm.utils;bundle-version="1.0.0";visibility:=reexp |
|
| 3 |
ort,org.txm.referencer.core;bundle-version="1.0.0";visibility:=reexpo |
|
| 4 |
rt,org.txm.concordance.core;bundle-version="1.0.0";visibility:=reexpo |
|
| 5 |
rt,org.txm.searchengine.cqp.core;bundle-version="1.1.0";visibility:=r |
|
| 6 |
eexport,org.txm.concordance.rcp;bundle-version="1.0.0";visibility:=re |
|
| 7 |
export,org.txm.statsengine.r.rcp;bundle-version="1.0.0";visibility:=r |
|
| 8 |
eexport,org.eclipse.ui;visibility:=reexport,org.eclipse.core.runtime; |
|
| 9 |
visibility:=reexport,org.txm.core;bundle-version="0.7.0";visibility:= |
|
| 10 |
reexport,org.txm.rcp;bundle-version="0.7.8";visibility:=reexport,org. |
|
| 11 |
eclipse.core.expressions;bundle-version="3.4.600";visibility:=reexpor |
|
| 12 |
t,org.txm.searchengine.core;bundle-version="1.0.0";visibility:=reexpo |
|
| 13 |
rt |
|
| 2 |
Require-Bundle: org.txm.utils;bundle-version="1.0.0";visibility:=reexport, |
|
| 3 |
org.txm.referencer.core;bundle-version="1.0.0";visibility:=reexport, |
|
| 4 |
org.txm.concordance.core;bundle-version="1.0.0";visibility:=reexport, |
|
| 5 |
org.txm.searchengine.cqp.core;bundle-version="1.1.0";visibility:=reexport, |
|
| 6 |
org.txm.concordance.rcp;bundle-version="1.0.0";visibility:=reexport, |
|
| 7 |
org.txm.statsengine.r.rcp;bundle-version="1.0.0";visibility:=reexport, |
|
| 8 |
org.eclipse.ui;visibility:=reexport, |
|
| 9 |
org.eclipse.core.runtime;visibility:=reexport, |
|
| 10 |
org.txm.core;bundle-version="0.7.0";visibility:=reexport, |
|
| 11 |
org.txm.rcp;bundle-version="0.7.8";visibility:=reexport, |
|
| 12 |
org.eclipse.core.expressions;bundle-version="3.4.600";visibility:=reexport, |
|
| 13 |
org.txm.searchengine.core;bundle-version="1.0.0";visibility:=reexport, |
|
| 14 |
org.txm.links.rcp;bundle-version="1.0.0" |
|
| 14 | 15 |
Export-Package: org.txm.referencer.rcp.adapters,org.txm.referencer.rcp |
| 15 | 16 |
.editors,org.txm.referencer.rcp.handlers,org.txm.referencer.rcp.prefe |
| 16 | 17 |
rences |
| tmp/org.txm.referencer.rcp/src/org/txm/referencer/rcp/handlers/ReferencerToConc.java (revision 845) | ||
|---|---|---|
| 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.referencer.rcp.handlers; |
|
| 29 |
|
|
| 30 |
import java.util.List; |
|
| 31 |
|
|
| 32 |
import org.eclipse.core.commands.AbstractHandler; |
|
| 33 |
import org.eclipse.core.commands.ExecutionEvent; |
|
| 34 |
import org.eclipse.core.commands.ExecutionException; |
|
| 35 |
import org.eclipse.jface.viewers.ISelection; |
|
| 36 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
| 37 |
import org.eclipse.osgi.util.NLS; |
|
| 38 |
import org.eclipse.ui.IWorkbenchPage; |
|
| 39 |
import org.eclipse.ui.PartInitException; |
|
| 40 |
import org.eclipse.ui.handlers.HandlerUtil; |
|
| 41 |
import org.txm.concordance.core.functions.Concordance; |
|
| 42 |
import org.txm.concordance.rcp.editors.ConcordanceEditor; |
|
| 43 |
import org.txm.rcp.editors.TXMResultEditorInput; |
|
| 44 |
import org.txm.rcp.messages.TXMUIMessages; |
|
| 45 |
import org.txm.referencer.core.functions.Referencer; |
|
| 46 |
import org.txm.referencer.core.functions.Referencer.Line; |
|
| 47 |
import org.txm.referencer.rcp.editors.ReferencerEditor; |
|
| 48 |
import org.txm.searchengine.cqp.ReferencePattern; |
|
| 49 |
import org.txm.searchengine.cqp.corpus.Corpus; |
|
| 50 |
import org.txm.searchengine.cqp.corpus.Property; |
|
| 51 |
import org.txm.searchengine.cqp.corpus.query.Query; |
|
| 52 |
|
|
| 53 |
// TODO: Auto-generated Javadoc |
|
| 54 |
/** |
|
| 55 |
* The Class ReferencerToConc. |
|
| 56 |
*/ |
|
| 57 |
public class ReferencerToConc extends AbstractHandler {
|
|
| 58 |
|
|
| 59 |
/* (non-Javadoc) |
|
| 60 |
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
|
| 61 |
*/ |
|
| 62 |
@Override |
|
| 63 |
public Object execute(ExecutionEvent event) throws ExecutionException {
|
|
| 64 |
IStructuredSelection selection = (IStructuredSelection) HandlerUtil |
|
| 65 |
.getActiveWorkbenchWindow(event).getActivePage().getSelection(); |
|
| 66 |
|
|
| 67 |
ReferencerEditor refeditor = (ReferencerEditor) HandlerUtil |
|
| 68 |
.getActiveWorkbenchWindow(event).getActivePage() |
|
| 69 |
.getActivePart(); |
|
| 70 |
|
|
| 71 |
return link(refeditor, selection); |
|
| 72 |
} |
|
| 73 |
|
|
| 74 |
/** |
|
| 75 |
* Link. |
|
| 76 |
* |
|
| 77 |
* @param refeditor the refeditor |
|
| 78 |
* @param iSelection the selection |
|
| 79 |
* @return the object |
|
| 80 |
*/ |
|
| 81 |
public static Object link(ReferencerEditor refeditor, ISelection iSelection) |
|
| 82 |
{
|
|
| 83 |
IStructuredSelection selection = (IStructuredSelection) iSelection; |
|
| 84 |
String query = getQuery(refeditor.getReferencer(), selection); |
|
| 85 |
if (query.length() == 0) |
|
| 86 |
return null; |
|
| 87 |
Corpus corpus = refeditor.getCorpus(); |
|
| 88 |
Concordance concordance = new Concordance(corpus); |
|
| 89 |
|
|
| 90 |
ReferencePattern rp = new ReferencePattern(); |
|
| 91 |
for (Property p : refeditor.getReferencer().getPattern()) |
|
| 92 |
rp.addProperty(p); |
|
| 93 |
|
|
| 94 |
concordance.setParameters(new Query(query), null, null, null, null, null, null, rp, rp, null, null); |
|
| 95 |
TXMResultEditorInput editorInput = new TXMResultEditorInput(concordance); |
|
| 96 |
|
|
| 97 |
IWorkbenchPage page = refeditor.getEditorSite().getWorkbenchWindow().getActivePage(); |
|
| 98 |
try {
|
|
| 99 |
ConcordanceEditor conceditor = (ConcordanceEditor) page.openEditor(editorInput, |
|
| 100 |
ConcordanceEditor.class.getName()); //$NON-NLS-1$ |
|
| 101 |
} catch (PartInitException e) {
|
|
| 102 |
System.err.println("Error: "+e.getLocalizedMessage());
|
|
| 103 |
} |
|
| 104 |
|
|
| 105 |
return null; |
|
| 106 |
} |
|
| 107 |
|
|
| 108 |
/** |
|
| 109 |
* Gets the query. |
|
| 110 |
* |
|
| 111 |
* @param selection the selection |
|
| 112 |
* @return the query |
|
| 113 |
*/ |
|
| 114 |
private static String getQuery(Referencer referencer, IStructuredSelection selection) {
|
|
| 115 |
String query = ""; //$NON-NLS-1$ |
|
| 116 |
|
|
| 117 |
Line fline = (Line) selection.getFirstElement(); |
|
| 118 |
int nbToken = 1; |
|
| 119 |
|
|
| 120 |
List<Line> lines = selection.toList(); |
|
| 121 |
|
|
| 122 |
Property prop = referencer.getProperty(); |
|
| 123 |
for (int t = 0; t < nbToken; t++) |
|
| 124 |
{
|
|
| 125 |
query += "["+prop + "=\""; //$NON-NLS-1$ //$NON-NLS-2$ |
|
| 126 |
|
|
| 127 |
for (Line line : lines) {
|
|
| 128 |
String s = line.getPropValue(); |
|
| 129 |
s = Query.addBackSlash(s); |
|
| 130 |
query += s + "|"; //$NON-NLS-1$ |
|
| 131 |
} |
|
| 132 |
query = query.substring(0, query.length() - 1); |
|
| 133 |
query += "\"] "; //$NON-NLS-1$ |
|
| 134 |
} |
|
| 135 |
query = query.substring(0, query.length() - 1); |
|
| 136 |
return query; |
|
| 137 |
} |
|
| 138 |
} |
|
| tmp/org.txm.referencer.rcp/src/org/txm/referencer/rcp/handlers/___ReferencerToConc.java (revision 845) | ||
|---|---|---|
| 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.referencer.rcp.handlers; |
|
| 29 |
|
|
| 30 |
import java.util.List; |
|
| 31 |
|
|
| 32 |
import org.eclipse.core.commands.AbstractHandler; |
|
| 33 |
import org.eclipse.core.commands.ExecutionEvent; |
|
| 34 |
import org.eclipse.core.commands.ExecutionException; |
|
| 35 |
import org.eclipse.jface.viewers.ISelection; |
|
| 36 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
| 37 |
import org.eclipse.ui.IWorkbenchPage; |
|
| 38 |
import org.eclipse.ui.PartInitException; |
|
| 39 |
import org.eclipse.ui.handlers.HandlerUtil; |
|
| 40 |
import org.txm.concordance.core.functions.Concordance; |
|
| 41 |
import org.txm.concordance.rcp.editors.ConcordanceEditor; |
|
| 42 |
import org.txm.rcp.editors.TXMResultEditorInput; |
|
| 43 |
import org.txm.referencer.core.functions.Referencer; |
|
| 44 |
import org.txm.referencer.core.functions.Referencer.Line; |
|
| 45 |
import org.txm.referencer.rcp.editors.ReferencerEditor; |
|
| 46 |
import org.txm.searchengine.cqp.ReferencePattern; |
|
| 47 |
import org.txm.searchengine.cqp.corpus.Corpus; |
|
| 48 |
import org.txm.searchengine.cqp.corpus.Property; |
|
| 49 |
import org.txm.searchengine.cqp.corpus.query.Query; |
|
| 50 |
|
|
| 51 |
// TODO: Auto-generated Javadoc |
|
| 52 |
/** |
|
| 53 |
* The Class ReferencerToConc. |
|
| 54 |
*/ |
|
| 55 |
@Deprecated |
|
| 56 |
public class ___ReferencerToConc extends AbstractHandler {
|
|
| 57 |
|
|
| 58 |
/* (non-Javadoc) |
|
| 59 |
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
|
| 60 |
*/ |
|
| 61 |
@Override |
|
| 62 |
public Object execute(ExecutionEvent event) throws ExecutionException {
|
|
| 63 |
IStructuredSelection selection = (IStructuredSelection) HandlerUtil |
|
| 64 |
.getActiveWorkbenchWindow(event).getActivePage().getSelection(); |
|
| 65 |
|
|
| 66 |
ReferencerEditor refeditor = (ReferencerEditor) HandlerUtil |
|
| 67 |
.getActiveWorkbenchWindow(event).getActivePage() |
|
| 68 |
.getActivePart(); |
|
| 69 |
|
|
| 70 |
return link(refeditor, selection); |
|
| 71 |
} |
|
| 72 |
|
|
| 73 |
/** |
|
| 74 |
* Link. |
|
| 75 |
* |
|
| 76 |
* @param refeditor the refeditor |
|
| 77 |
* @param iSelection the selection |
|
| 78 |
* @return the object |
|
| 79 |
*/ |
|
| 80 |
public static Object link(ReferencerEditor refeditor, ISelection iSelection) |
|
| 81 |
{
|
|
| 82 |
IStructuredSelection selection = (IStructuredSelection) iSelection; |
|
| 83 |
String query = getQuery(refeditor.getReferencer(), selection); |
|
| 84 |
if (query.length() == 0) |
|
| 85 |
return null; |
|
| 86 |
Corpus corpus = refeditor.getCorpus(); |
|
| 87 |
Concordance concordance = new Concordance(corpus); |
|
| 88 |
|
|
| 89 |
ReferencePattern rp = new ReferencePattern(); |
|
| 90 |
for (Property p : refeditor.getReferencer().getPattern()) |
|
| 91 |
rp.addProperty(p); |
|
| 92 |
|
|
| 93 |
concordance.setParameters(new Query(query), null, null, null, null, null, null, rp, rp, null, null); |
|
| 94 |
TXMResultEditorInput editorInput = new TXMResultEditorInput(concordance); |
|
| 95 |
|
|
| 96 |
IWorkbenchPage page = refeditor.getEditorSite().getWorkbenchWindow().getActivePage(); |
|
| 97 |
try {
|
|
| 98 |
ConcordanceEditor conceditor = (ConcordanceEditor) page.openEditor(editorInput, |
|
| 99 |
ConcordanceEditor.class.getName()); //$NON-NLS-1$ |
|
| 100 |
} catch (PartInitException e) {
|
|
| 101 |
System.err.println("Error: "+e.getLocalizedMessage());
|
|
| 102 |
} |
|
| 103 |
|
|
| 104 |
return null; |
|
| 105 |
} |
|
| 106 |
|
|
| 107 |
/** |
|
| 108 |
* Gets the query. |
|
| 109 |
* |
|
| 110 |
* @param selection the selection |
|
| 111 |
* @return the query |
|
| 112 |
*/ |
|
| 113 |
private static String getQuery(Referencer referencer, IStructuredSelection selection) {
|
|
| 114 |
String query = ""; //$NON-NLS-1$ |
|
| 115 |
|
|
| 116 |
Line fline = (Line) selection.getFirstElement(); |
|
| 117 |
int nbToken = 1; |
|
| 118 |
|
|
| 119 |
List<Line> lines = selection.toList(); |
|
| 120 |
|
|
| 121 |
Property prop = referencer.getProperty(); |
|
| 122 |
for (int t = 0; t < nbToken; t++) |
|
| 123 |
{
|
|
| 124 |
query += "["+prop + "=\""; //$NON-NLS-1$ //$NON-NLS-2$ |
|
| 125 |
|
|
| 126 |
for (Line line : lines) {
|
|
| 127 |
String s = line.getPropValue(); |
|
| 128 |
s = Query.addBackSlash(s); |
|
| 129 |
query += s + "|"; //$NON-NLS-1$ |
|
| 130 |
} |
|
| 131 |
query = query.substring(0, query.length() - 1); |
|
| 132 |
query += "\"] "; //$NON-NLS-1$ |
|
| 133 |
} |
|
| 134 |
query = query.substring(0, query.length() - 1); |
|
| 135 |
return query; |
|
| 136 |
} |
|
| 137 |
} |
|
| 0 | 138 | |
| tmp/org.txm.referencer.rcp/src/org/txm/referencer/rcp/handlers/ComputeReferencer.java (revision 845) | ||
|---|---|---|
| 50 | 50 |
return false; |
| 51 | 51 |
} |
| 52 | 52 |
|
| 53 |
Object selection = this.getSelection(event);
|
|
| 53 |
Object selection = this.getCorporaViewSelectedObject(event);
|
|
| 54 | 54 |
Referencer referencer = null; |
| 55 | 55 |
|
| 56 | 56 |
// Creating from Corpus |
| tmp/org.txm.referencer.rcp/src/org/txm/referencer/rcp/handlers/SendReferencerTo.java (revision 845) | ||
|---|---|---|
| 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.referencer.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.referencer.core.functions.Referencer; |
|
| 34 |
|
|
| 35 |
/** |
|
| 36 |
* Sends the selected lines of a referencer to compute another command. |
|
| 37 |
* |
|
| 38 |
* @author sjacquot |
|
| 39 |
* |
|
| 40 |
*/ |
|
| 41 |
public class SendReferencerTo extends SendSelectionToQueryable {
|
|
| 42 |
|
|
| 43 |
|
|
| 44 |
@Override |
|
| 45 |
public String createQuery(ExecutionEvent event, IStructuredSelection selection) {
|
|
| 46 |
return ((Referencer) this.getActiveEditorResult(event)).createQuery(selection.toList()); |
|
| 47 |
} |
|
| 48 |
|
|
| 49 |
|
|
| 50 |
|
|
| 51 |
} |
|
| 0 | 52 | |
| tmp/org.txm.referencer.rcp/src/org/txm/referencer/rcp/editors/ReferencerEditor.java (revision 845) | ||
|---|---|---|
| 64 | 64 |
import org.txm.referencer.core.functions.Referencer; |
| 65 | 65 |
import org.txm.referencer.core.functions.Referencer.Line; |
| 66 | 66 |
import org.txm.referencer.core.preferences.ReferencerPreferences; |
| 67 |
import org.txm.referencer.rcp.handlers.ReferencerToConc; |
|
| 67 |
import org.txm.referencer.rcp.handlers.___ReferencerToConc;
|
|
| 68 | 68 |
import org.txm.referencer.rcp.messages.ReferencerUIMessages; |
| 69 | 69 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
| 70 | 70 |
import org.txm.searchengine.cqp.corpus.Corpus; |
| ... | ... | |
| 281 | 281 |
viewer.setContentProvider(new LineContentProvider()); |
| 282 | 282 |
viewer.setInput(new ArrayList<Property>()); |
| 283 | 283 |
|
| 284 |
viewer.getTable().addMouseListener(new MouseAdapter() {
|
|
| 285 |
@Override |
|
| 286 |
public void mouseDoubleClick(MouseEvent e) {
|
|
| 287 |
|
|
| 288 |
Point mouseposition = new Point(e.x |
|
| 289 |
+ viewer.getTable().getHorizontalBar() |
|
| 290 |
.getSelection(), e.y); |
|
| 291 |
int col = getPointedColumn(mouseposition); |
|
| 292 |
if (col == 1) {
|
|
| 293 |
StatusLine.setMessage(ReferencerUIMessages.ReferencerEditor_25); |
|
| 294 |
sendSelectionToConc(); |
|
| 295 |
} else if (col == 2) {
|
|
| 296 |
//System.out.println("Send to edition ?"); //$NON-NLS-1$
|
|
| 297 |
} |
|
| 298 |
} |
|
| 299 |
}); |
|
| 284 |
// viewer.getTable().addMouseListener(new MouseAdapter() {
|
|
| 285 |
// @Override
|
|
| 286 |
// public void mouseDoubleClick(MouseEvent e) {
|
|
| 287 |
// |
|
| 288 |
// Point mouseposition = new Point(e.x
|
|
| 289 |
// + viewer.getTable().getHorizontalBar()
|
|
| 290 |
// .getSelection(), e.y);
|
|
| 291 |
// int col = getPointedColumn(mouseposition);
|
|
| 292 |
// if (col == 1) {
|
|
| 293 |
// StatusLine.setMessage(ReferencerUIMessages.ReferencerEditor_25);
|
|
| 294 |
// sendSelectionToConc();
|
|
| 295 |
// } else if (col == 2) {
|
|
| 296 |
// //System.out.println("Send to edition ?"); //$NON-NLS-1$
|
|
| 297 |
// }
|
|
| 298 |
// }
|
|
| 299 |
// });
|
|
| 300 | 300 |
|
| 301 | 301 |
nColumn = new TableColumn(viewer.getTable(), SWT.LEFT); |
| 302 | 302 |
nColumn.setText(" "); //$NON-NLS-1$
|
| ... | ... | |
| 315 | 315 |
initializeFields(); |
| 316 | 316 |
|
| 317 | 317 |
|
| 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$ |
|
| 320 |
|
|
| 318 | 321 |
// Register the context menu |
| 319 |
TXMEditor.initContextMenu(this.viewer.getTable(), this.getSite(), this.viewer); // $NON-NLS-1$
|
|
| 322 |
TXMEditor.initContextMenu(this.viewer.getTable(), this.getSite(), this.viewer); |
|
| 320 | 323 |
|
| 321 | 324 |
|
| 322 | 325 |
} |
| ... | ... | |
| 325 | 328 |
public void updateEditorFromResult(boolean update) {
|
| 326 | 329 |
|
| 327 | 330 |
fillDisplayArea(0, lineperpage); |
| 331 |
|
|
| 332 |
// FIXME: should be moved and mutualized |
|
| 328 | 333 |
QueriesView.refresh(); |
| 329 | 334 |
RVariablesView.refresh(); |
| 330 | 335 |
|
| ... | ... | |
| 335 | 340 |
|
| 336 | 341 |
|
| 337 | 342 |
/** |
| 338 |
* Send selection to conc. |
|
| 339 |
*/ |
|
| 340 |
protected void sendSelectionToConc() {
|
|
| 341 |
ReferencerToConc.link(this, this.viewer.getSelection()); |
|
| 342 |
} |
|
| 343 |
|
|
| 344 |
/** |
|
| 345 | 343 |
* Fill display area. |
| 346 | 344 |
* |
| 347 | 345 |
* @param from the from |
| tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/handlers/ComputeSpecifictiesSelectionChart.java (revision 845) | ||
|---|---|---|
| 28 | 28 |
public Object execute(ExecutionEvent event) throws ExecutionException {
|
| 29 | 29 |
|
| 30 | 30 |
|
| 31 |
Object selection = this.getSelection(event);
|
|
| 31 |
Object selection = this.getCorporaViewSelectedObject(event);
|
|
| 32 | 32 |
SpecificitiesSelection specificitiesSelection = null; |
| 33 | 33 |
|
| 34 | 34 |
// Reopening from existing result |
| tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/handlers/ComputeSpecifities.java (revision 845) | ||
|---|---|---|
| 59 | 59 |
|
| 60 | 60 |
|
| 61 | 61 |
try {
|
| 62 |
Object selection = this.getSelection(event);
|
|
| 62 |
Object selection = this.getCorporaViewSelectedObject(event);
|
|
| 63 | 63 |
Specificities specificities = null; |
| 64 | 64 |
|
| 65 | 65 |
// Reopening from existing result |
| tmp/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/preferences/CooccurrencePreferences.java (revision 845) | ||
|---|---|---|
| 68 | 68 |
preferences.putInt(MIN_RIGHT, 1); |
| 69 | 69 |
preferences.putInt(MAX_RIGHT, 10); |
| 70 | 70 |
|
| 71 |
preferences.put(PROPERTIES, TXMPreferences.DEFAULT_UNIT_PROPERTY); |
|
| 71 |
preferences.put(UNIT_PROPERTIES, TXMPreferences.DEFAULT_UNIT_PROPERTY);
|
|
| 72 | 72 |
|
| 73 | 73 |
|
| 74 | 74 |
} |
| tmp/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/functions/Cooccurrence.java (revision 845) | ||
|---|---|---|
| 210 | 210 |
protected Integer pMinRightContextSize; |
| 211 | 211 |
|
| 212 | 212 |
/** The cooccurents properties to show. */ |
| 213 |
@Parameter(key=CooccurrencePreferences.PROPERTIES) |
|
| 213 |
@Parameter(key=CooccurrencePreferences.UNIT_PROPERTIES)
|
|
| 214 | 214 |
protected List<WordProperty> pProperties; |
| 215 | 215 |
|
| 216 | 216 |
/** The keyword query. */ |
| ... | ... | |
| 822 | 822 |
|
| 823 | 823 |
StructuralUnit limit = (StructuralUnit) parameters.get(CooccurrencePreferences.STRUCTURAL_UNIT_LIMIT); |
| 824 | 824 |
|
| 825 |
Object propsParam = parameters.get(CooccurrencePreferences.PROPERTIES); |
|
| 825 |
Object propsParam = parameters.get(CooccurrencePreferences.UNIT_PROPERTIES);
|
|
| 826 | 826 |
List<WordProperty> properties = null; |
| 827 | 827 |
if (propsParam instanceof List) {
|
| 828 | 828 |
properties = (List<WordProperty>)propsParam; |
| ... | ... | |
| 1421 | 1421 |
|
| 1422 | 1422 |
@Override |
| 1423 | 1423 |
public boolean loadParameters() throws CqiClientException {
|
| 1424 |
pProperties = (List<WordProperty>) Property.stringToProperties(getCorpus(), this.getStringParameterValue(CooccurrencePreferences.PROPERTIES)); |
|
| 1424 |
pProperties = (List<WordProperty>) Property.stringToProperties(getCorpus(), this.getStringParameterValue(CooccurrencePreferences.UNIT_PROPERTIES));
|
|
| 1425 | 1425 |
pQuery = new Query(this.getStringParameterValue(CooccurrencePreferences.QUERY)); |
| 1426 | 1426 |
pStructuralUnitLimit = this.getCorpus().getStructuralUnit(this.getStringParameterValue(CooccurrencePreferences.STRUCTURAL_UNIT_LIMIT)); |
| 1427 | 1427 |
return true; |
| ... | ... | |
| 1429 | 1429 |
|
| 1430 | 1430 |
@Override |
| 1431 | 1431 |
public boolean saveParameters() {
|
| 1432 |
this.saveParameter(CooccurrencePreferences.PROPERTIES, Property.propertiesToString(this.pProperties)); |
|
| 1432 |
this.saveParameter(CooccurrencePreferences.UNIT_PROPERTIES, Property.propertiesToString(this.pProperties));
|
|
| 1433 | 1433 |
|
| 1434 | 1434 |
if (pQuery != null) {
|
| 1435 | 1435 |
this.saveParameter(CooccurrencePreferences.QUERY, pQuery.getQueryString()); |
| ... | ... | |
| 1456 | 1456 |
* @param lines |
| 1457 | 1457 |
* @return the query |
| 1458 | 1458 |
*/ |
| 1459 |
public static String createQuery(List<CLine> lines) {
|
|
| 1459 |
public String createQuery(List<CLine> lines) {
|
|
| 1460 |
|
|
| 1461 |
if(this.getQuery().isEmpty()) {
|
|
| 1462 |
return ""; //$NON-NLS-1$ |
|
| 1463 |
} |
|
| 1464 |
|
|
| 1460 | 1465 |
|
| 1461 |
Cooccurrence cooc = lines.get(0).getCooc(); |
|
| 1462 |
int nbProps = cooc.getProperties().size(); |
|
| 1463 |
List<WordProperty> props = cooc.getProperties(); |
|
| 1466 |
int nbProps = this.getProperties().size(); |
|
| 1467 |
List<WordProperty> props = this.getProperties(); |
|
| 1464 | 1468 |
|
| 1465 | 1469 |
String query = "["; //$NON-NLS-1$ |
| 1466 | 1470 |
for (int p = 0; p < nbProps; p++) {
|
| ... | ... | |
| 1477 | 1481 |
query = query.substring(0, query.length() - 3); |
| 1478 | 1482 |
query += "] "; //$NON-NLS-1$ |
| 1479 | 1483 |
|
| 1480 |
int maxempan = Math.max(cooc.getMaxLeft(), cooc.getMaxRight());
|
|
| 1481 |
if (cooc.getIncludeXPivot() && maxempan == 0) maxempan = 1;
|
|
| 1484 |
int maxempan = Math.max(this.getMaxLeft(), this.getMaxRight());
|
|
| 1485 |
if (this.getIncludeXPivot() && maxempan == 0) maxempan = 1;
|
|
| 1482 | 1486 |
|
| 1483 | 1487 |
String maxempanstr = "within " + maxempan + " "; //$NON-NLS-1$ //$NON-NLS-2$ |
| 1484 |
if (cooc.getStructure() != null) maxempanstr += cooc.getStructure().getName();
|
|
| 1488 |
if (this.getStructure() != null) maxempanstr += this.getStructure().getName();
|
|
| 1485 | 1489 |
|
| 1486 |
query = "("+cooc.getQuery()+" []* "+query+") | ("+query+" []* "+cooc.getQuery()+") "+maxempanstr; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
|
|
| 1490 |
query = "("+this.getQuery()+" []* "+query+") | ("+query+" []* "+this.getQuery()+") "+maxempanstr; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
|
|
| 1487 | 1491 |
|
| 1488 | 1492 |
return query; |
| 1489 | 1493 |
} |
| tmp/org.txm.ahc.rcp/src/org/txm/ahc/rcp/handlers/ComputeAHC.java (revision 845) | ||
|---|---|---|
| 83 | 83 |
return null; |
| 84 | 84 |
} |
| 85 | 85 |
|
| 86 |
Object selection = this.getSelection();
|
|
| 86 |
Object selection = this.getCorporaViewSelectedObject(event);
|
|
| 87 | 87 |
AHC ahc = null; |
| 88 | 88 |
|
| 89 | 89 |
|
| tmp/org.txm.index.rcp/META-INF/MANIFEST.MF (revision 845) | ||
|---|---|---|
| 11 | 11 |
org.eclipse.ui;bundle-version="3.106.1";visibility:=reexport, |
| 12 | 12 |
org.txm.rcp;visibility:=reexport, |
| 13 | 13 |
org.eclipse.core.expressions;bundle-version="3.4.600";visibility:=reexport, |
| 14 |
org.txm.searchengine.core;bundle-version="1.0.0";visibility:=reexport |
|
| 14 |
org.txm.searchengine.core;bundle-version="1.0.0";visibility:=reexport, |
|
| 15 |
org.txm.links.rcp;bundle-version="1.0.0" |
|
| 15 | 16 |
Export-Package: org.txm.index.rcp.adapters,org.txm.index.rcp.editors,o |
| 16 | 17 |
rg.txm.index.rcp.handlers,org.txm.index.rcp.messages |
| 17 | 18 |
Bundle-Vendor: Textometrie.org |
| tmp/org.txm.index.rcp/src/org/txm/index/rcp/handlers/SendToIndex.java (revision 845) | ||
|---|---|---|
| 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.index.rcp.handlers; |
|
| 29 |
|
|
| 30 |
import org.eclipse.core.commands.ExecutionEvent; |
|
| 31 |
import org.eclipse.core.commands.ExecutionException; |
|
| 32 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
| 33 |
import org.eclipse.ui.handlers.HandlerUtil; |
|
| 34 |
import org.txm.core.preferences.TXMPreferences; |
|
| 35 |
import org.txm.core.results.TXMResult; |
|
| 36 |
import org.txm.index.core.functions.Index; |
|
| 37 |
import org.txm.index.core.functions.Line; |
|
| 38 |
import org.txm.rcp.editors.TXMEditor; |
|
| 39 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
|
| 40 |
|
|
| 41 |
/** |
|
| 42 |
* Sends the selected lines of a lexicon to compute an index. |
|
| 43 |
* |
|
| 44 |
* @author mdecorde |
|
| 45 |
* @author sjacquot |
|
| 46 |
* |
|
| 47 |
*/ |
|
| 48 |
public class SendToIndex extends BaseAbstractHandler {
|
|
| 49 |
|
|
| 50 |
|
|
| 51 |
@Override |
|
| 52 |
public Object execute(ExecutionEvent event) throws ExecutionException {
|
|
| 53 |
|
|
| 54 |
IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event); |
|
| 55 |
|
|
| 56 |
if (selection != null && selection.getFirstElement() instanceof Line) {
|
|
| 57 |
|
|
| 58 |
String query = Index.createQuery(selection.toList()); |
|
| 59 |
|
|
| 60 |
TXMEditor editor = (TXMEditor) HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActivePart(); |
|
| 61 |
|
|
| 62 |
// create local result node, store it some parameters and call the linked command |
|
| 63 |
String uuid = TXMResult.createUUID(); |
|
| 64 |
TXMPreferences.put(uuid, TXMPreferences.PARENT_UUID, editor.getResult().getParent().getUUID()); |
|
| 65 |
TXMPreferences.put(uuid, TXMPreferences.QUERY, query); |
|
| 66 |
BaseAbstractHandler.executeCommand("org.txm.index.rcp.handlers.ComputeIndex", uuid); //$NON-NLS-1$
|
|
| 67 |
} |
|
| 68 |
else {
|
|
| 69 |
this.logCanNotCompute(selection); |
|
| 70 |
} |
|
| 71 |
return null; |
|
| 72 |
} |
|
| 73 |
|
|
| 74 |
// FIXME: not used anymore? |
|
| 75 |
// /** |
|
| 76 |
// * Link. |
|
| 77 |
// * |
|
| 78 |
// * @param voceditor the voceditor |
|
| 79 |
// * @param selection the selection |
|
| 80 |
// * @return the object |
|
| 81 |
// */ |
|
| 82 |
// public static Object link(IndexEditor voceditor, |
|
| 83 |
// IStructuredSelection selection) {
|
|
| 84 |
// assert (selection.getFirstElement() instanceof Line); |
|
| 85 |
// String query = getQuery(selection); |
|
| 86 |
// if (query.length() == 0) |
|
| 87 |
// return null; |
|
| 88 |
// Corpus corpus = voceditor.getCorpus(); |
|
| 89 |
// Concordance concordance = new Concordance(corpus); |
|
| 90 |
// concordance.setParameters(new Query(query), null, null, null, null, null, null, null, null, null, null); |
|
| 91 |
// TXMResultEditorInput editorInput = new TXMResultEditorInput(concordance); |
|
| 92 |
//// try {
|
|
| 93 |
//// System.out.println("Compute indexResult query: "+voceditor.getQuery());
|
|
| 94 |
//// QueryResult indexResult = corpus.query(voceditor.getQuery(), "Index", false); |
|
| 95 |
//// System.out.println("N result: "+indexResult.getNMatch());
|
|
| 96 |
//// |
|
| 97 |
//// System.out.println("Compute indexOccResult query: "+query);
|
|
| 98 |
//// QueryResult indexOccResult = corpus.query(new Query(query), "IndexOcc", false); |
|
| 99 |
//// System.out.println("N result: "+indexOccResult.getNMatch());
|
|
| 100 |
//// |
|
| 101 |
//// String queryname = "Q"+Corpus.getNextQueryCounter(); |
|
| 102 |
//// String interQueryString = queryname+"=intersect "+indexResult.getQualifiedCqpId()+" "+indexOccResult.getQualifiedCqpId()+";"; |
|
| 103 |
//// System.out.println("Compute inter query: "+interQueryString);
|
|
| 104 |
//// ((MemCqiClient)CQPSearchEngine.getCqiClient()).query(interQueryString); |
|
| 105 |
//// |
|
| 106 |
//// QueryResult inter = new QueryResult(queryname, queryname, corpus, new Query(interQueryString)); |
|
| 107 |
//// System.out.println("indexResult size: "+indexResult.getNMatch());
|
|
| 108 |
//// System.out.println("indexOccResult size: "+indexOccResult.getNMatch());
|
|
| 109 |
//// System.out.println("inter size: "+inter.getNMatch());
|
|
| 110 |
//// |
|
| 111 |
//// QueryResult inter2 = corpus.query(new Query("intersect "+indexResult.getQualifiedCqpId()+" "+indexOccResult.getQualifiedCqpId()), "Q"+Corpus.getNextQueryCounter(),false);
|
|
| 112 |
//// System.out.println("inter2 size: "+inter2.getNMatch());
|
|
| 113 |
//// } catch (Exception e) {
|
|
| 114 |
//// e.printStackTrace(); |
|
| 115 |
//// try {
|
|
| 116 |
//// System.out.println("CQP error: "+CQPSearchEngine.getCqiClient().getLastError());
|
|
| 117 |
//// } catch (Exception e1) {
|
|
| 118 |
//// e1.printStackTrace(); |
|
| 119 |
//// } |
|
| 120 |
//// } |
|
| 121 |
//// |
|
| 122 |
//// return null; |
|
| 123 |
// |
|
| 124 |
// IWorkbenchPage page = voceditor.getEditorSite().getWorkbenchWindow() |
|
| 125 |
// .getActivePage(); |
|
| 126 |
// try {
|
|
| 127 |
// ConcordanceEditor conceditor = (ConcordanceEditor) page |
|
| 128 |
// .openEditor(editorInput, ConcordanceEditor.ID); //$NON-NLS-1$ |
|
| 129 |
// } catch (PartInitException e) {
|
|
| 130 |
// System.err.println("Error: "+e.getLocalizedMessage());
|
|
| 131 |
// } |
|
| 132 |
// |
|
| 133 |
// return null; |
|
| 134 |
// } |
|
| 135 |
|
|
| 136 |
|
|
| 137 |
} |
|
| tmp/org.txm.index.rcp/src/org/txm/index/rcp/handlers/SendToCooccurrence.java (revision 845) | ||
|---|---|---|
| 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.index.rcp.handlers; |
|
| 29 |
|
|
| 30 |
import org.eclipse.core.commands.ExecutionEvent; |
|
| 31 |
import org.eclipse.core.commands.ExecutionException; |
|
| 32 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
| 33 |
import org.eclipse.ui.handlers.HandlerUtil; |
|
| 34 |
import org.txm.core.preferences.TXMPreferences; |
|
| 35 |
import org.txm.core.results.TXMResult; |
|
| 36 |
import org.txm.index.core.functions.Index; |
|
| 37 |
import org.txm.index.core.functions.Line; |
|
| 38 |
import org.txm.rcp.editors.TXMEditor; |
|
| 39 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
|
| 40 |
import org.txm.searchengine.cqp.corpus.Corpus; |
|
| 41 |
|
|
| 42 |
/** |
|
| 43 |
* Sends the selected lines of an index to compute a cooccurrence. |
|
| 44 |
* |
|
| 45 |
* @author mdecorde. |
|
| 46 |
*/ |
|
| 47 |
public class SendToCooccurrence extends BaseAbstractHandler {
|
|
| 48 |
|
|
| 49 |
@Override |
|
| 50 |
public Object execute(ExecutionEvent event) throws ExecutionException {
|
|
| 51 |
IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event); |
|
| 52 |
|
|
| 53 |
if (selection != null && selection.getFirstElement() instanceof Line) {
|
|
| 54 |
|
|
| 55 |
String query = Index.createQuery(selection.toList()); |
|
| 56 |
|
|
| 57 |
TXMEditor editor = (TXMEditor) HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActivePart(); |
|
| 58 |
|
|
| 59 |
// create local result node, store it some parameters and call the linked command |
|
| 60 |
String uuid = TXMResult.createUUID(); |
|
| 61 |
TXMResult parentCorpus = Corpus.getFirstParentCorpus(editor.getResult()); |
|
| 62 |
TXMPreferences.put(uuid, TXMPreferences.PARENT_UUID, parentCorpus.getUUID()); |
|
| 63 |
TXMPreferences.put(uuid, TXMPreferences.QUERY, query); |
|
| 64 |
BaseAbstractHandler.executeCommand("org.txm.cooccurrence.rcp.handlers.ComputeCooccurrences", uuid); //$NON-NLS-1$
|
|
| 65 |
} |
|
| 66 |
else {
|
|
| 67 |
this.logCanNotCompute(selection); |
|
| 68 |
} |
|
| 69 |
return null; |
|
| 70 |
} |
|
| 71 |
|
|
| 72 |
|
|
| 73 |
} |
|
| tmp/org.txm.index.rcp/src/org/txm/index/rcp/handlers/SendToProgression.java (revision 845) | ||
|---|---|---|
| 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.index.rcp.handlers; |
|
| 29 |
|
|
| 30 |
import java.util.List; |
|
| 31 |
|
|
| 32 |
import org.eclipse.core.commands.ExecutionEvent; |
|
| 33 |
import org.eclipse.core.commands.ExecutionException; |
|
| 34 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
| 35 |
import org.eclipse.ui.handlers.HandlerUtil; |
|
| 36 |
import org.txm.core.preferences.TXMPreferences; |
|
| 37 |
import org.txm.core.results.TXMResult; |
|
| 38 |
import org.txm.index.core.functions.Index; |
|
| 39 |
import org.txm.index.core.functions.Line; |
|
| 40 |
import org.txm.rcp.editors.TXMEditor; |
|
| 41 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
|
| 42 |
import org.txm.searchengine.cqp.corpus.Corpus; |
|
| 43 |
import org.txm.searchengine.cqp.corpus.query.Query; |
|
| 44 |
|
|
| 45 |
/** |
|
| 46 |
* Sends the selected lines of an index to compute a progression. |
|
| 47 |
* |
|
| 48 |
* @author mdecorde |
|
| 49 |
* @author sjacquot |
|
| 50 |
* |
|
| 51 |
*/ |
|
| 52 |
public class SendToProgression extends BaseAbstractHandler {
|
|
| 53 |
|
|
| 54 |
@Override |
|
| 55 |
public Object execute(ExecutionEvent event) throws ExecutionException {
|
|
| 56 |
|
|
| 57 |
IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event); |
|
| 58 |
|
|
| 59 |
if (selection != null && selection.getFirstElement() instanceof Line) {
|
|
| 60 |
|
|
| 61 |
List<Query> queries = Index.createQueries(selection.toList()); |
|
| 62 |
|
|
| 63 |
TXMEditor editor = (TXMEditor) HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActivePart(); |
|
| 64 |
|
|
| 65 |
// create local result node, store it some parameters and call the linked command |
|
| 66 |
String uuid = TXMResult.createUUID(); |
|
| 67 |
TXMResult parentCorpus = Corpus.getFirstParentCorpus(editor.getResult()); |
|
| 68 |
TXMPreferences.put(uuid, TXMPreferences.PARENT_UUID, parentCorpus.getUUID()); |
|
| 69 |
TXMPreferences.put(uuid, TXMPreferences.QUERIES, Query.queriesToString(queries)); |
|
| 70 |
BaseAbstractHandler.executeCommand("org.txm.progression.rcp.handlers.ComputeProgression", uuid); //$NON-NLS-1$
|
|
| 71 |
} |
|
| 72 |
else {
|
|
| 73 |
this.logCanNotCompute(selection); |
|
| 74 |
} |
|
| 75 |
return null; |
|
| 76 |
} |
|
| 77 |
|
|
| 78 |
|
|
| 79 |
|
|
| 80 |
|
|
| 81 |
} |
|
| tmp/org.txm.index.rcp/src/org/txm/index/rcp/handlers/SendToConcordance.java (revision 845) | ||
|---|---|---|
| 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.index.rcp.handlers; |
|
| 29 |
|
|
| 30 |
import org.eclipse.core.commands.ExecutionEvent; |
|
| 31 |
import org.eclipse.core.commands.ExecutionException; |
|
| 32 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
| 33 |
import org.eclipse.ui.handlers.HandlerUtil; |
|
| 34 |
import org.txm.core.preferences.TXMPreferences; |
|
| 35 |
import org.txm.core.results.TXMResult; |
|
| 36 |
import org.txm.index.core.functions.Index; |
|
| 37 |
import org.txm.index.core.functions.Line; |
|
| 38 |
import org.txm.rcp.editors.TXMEditor; |
|
| 39 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
|
| 40 |
import org.txm.searchengine.cqp.corpus.Corpus; |
|
| 41 |
|
|
| 42 |
/** |
|
| 43 |
* Sends the selected lines of an index to compute a concordance. |
|
| 44 |
* |
|
| 45 |
* @author mdecorde |
|
| 46 |
* @author sjacquot |
|
| 47 |
* |
|
| 48 |
*/ |
|
| 49 |
public class SendToConcordance extends BaseAbstractHandler {
|
|
| 50 |
|
|
| 51 |
|
|
| 52 |
@Override |
|
| 53 |
public Object execute(ExecutionEvent event) throws ExecutionException {
|
|
| 54 |
|
|
| 55 |
IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event); |
|
| 56 |
|
|
| 57 |
if (selection != null && selection.getFirstElement() instanceof Line) {
|
|
| 58 |
|
|
| 59 |
String query = Index.createQuery(selection.toList()); |
|
| 60 |
|
|
| 61 |
TXMEditor editor = (TXMEditor) HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActivePart(); |
|
| 62 |
|
|
| 63 |
// create local result node, store it some parameters and call the linked command |
|
| 64 |
String uuid = TXMResult.createUUID(); |
|
| 65 |
TXMResult parentCorpus = Corpus.getFirstParentCorpus(editor.getResult()); |
|
| 66 |
TXMPreferences.put(uuid, TXMPreferences.PARENT_UUID, parentCorpus.getUUID()); |
|
| 67 |
TXMPreferences.put(uuid, TXMPreferences.QUERY, query); |
|
| 68 |
BaseAbstractHandler.executeCommand("org.txm.concordance.rcp.handlers.ComputeConcordance", uuid); //$NON-NLS-1$
|
|
| 69 |
} |
|
| 70 |
else {
|
|
| 71 |
this.logCanNotCompute(selection); |
|
| 72 |
} |
|
| 73 |
return null; |
|
| 74 |
} |
|
| 75 |
|
|
| 76 |
// FIXME: not used anymore? |
|
| 77 |
// /** |
|
| 78 |
// * Link. |
|
| 79 |
// * |
|
| 80 |
// * @param voceditor the voceditor |
|
| 81 |
// * @param selection the selection |
|
| 82 |
// * @return the object |
|
| 83 |
// */ |
|
| 84 |
// public static Object link(IndexEditor voceditor, |
|
| 85 |
// IStructuredSelection selection) {
|
|
| 86 |
// assert (selection.getFirstElement() instanceof Line); |
|
| 87 |
// String query = getQuery(selection); |
|
| 88 |
// if (query.length() == 0) |
|
| 89 |
// return null; |
|
| 90 |
// Corpus corpus = voceditor.getCorpus(); |
|
| 91 |
// Concordance concordance = new Concordance(corpus); |
|
| 92 |
// concordance.setParameters(new Query(query), null, null, null, null, null, null, null, null, null, null); |
|
| 93 |
// TXMResultEditorInput editorInput = new TXMResultEditorInput(concordance); |
|
| 94 |
//// try {
|
|
| 95 |
//// System.out.println("Compute indexResult query: "+voceditor.getQuery());
|
|
| 96 |
//// QueryResult indexResult = corpus.query(voceditor.getQuery(), "Index", false); |
|
| 97 |
//// System.out.println("N result: "+indexResult.getNMatch());
|
|
| 98 |
//// |
|
| 99 |
//// System.out.println("Compute indexOccResult query: "+query);
|
|
| 100 |
//// QueryResult indexOccResult = corpus.query(new Query(query), "IndexOcc", false); |
|
| 101 |
//// System.out.println("N result: "+indexOccResult.getNMatch());
|
|
| 102 |
//// |
|
| 103 |
//// String queryname = "Q"+Corpus.getNextQueryCounter(); |
|
| 104 |
//// String interQueryString = queryname+"=intersect "+indexResult.getQualifiedCqpId()+" "+indexOccResult.getQualifiedCqpId()+";"; |
|
| 105 |
//// System.out.println("Compute inter query: "+interQueryString);
|
|
| 106 |
//// ((MemCqiClient)CQPSearchEngine.getCqiClient()).query(interQueryString); |
|
| 107 |
//// |
|
| 108 |
//// QueryResult inter = new QueryResult(queryname, queryname, corpus, new Query(interQueryString)); |
|
| 109 |
//// System.out.println("indexResult size: "+indexResult.getNMatch());
|
|
| 110 |
//// System.out.println("indexOccResult size: "+indexOccResult.getNMatch());
|
|
| 111 |
//// System.out.println("inter size: "+inter.getNMatch());
|
|
| 112 |
//// |
|
| 113 |
//// QueryResult inter2 = corpus.query(new Query("intersect "+indexResult.getQualifiedCqpId()+" "+indexOccResult.getQualifiedCqpId()), "Q"+Corpus.getNextQueryCounter(),false);
|
|
| 114 |
//// System.out.println("inter2 size: "+inter2.getNMatch());
|
|
| 115 |
//// } catch (Exception e) {
|
|
| 116 |
//// e.printStackTrace(); |
|
| 117 |
//// try {
|
|
| 118 |
//// System.out.println("CQP error: "+CQPSearchEngine.getCqiClient().getLastError());
|
|
| 119 |
//// } catch (Exception e1) {
|
|
| 120 |
//// e1.printStackTrace(); |
|
| 121 |
//// } |
|
| 122 |
//// } |
|
| 123 |
//// |
|
| 124 |
//// return null; |
|
| 125 |
// |
|
| 126 |
// IWorkbenchPage page = voceditor.getEditorSite().getWorkbenchWindow() |
|
| 127 |
// .getActivePage(); |
|
| 128 |
// try {
|
|
| 129 |
// ConcordanceEditor conceditor = (ConcordanceEditor) page |
|
| 130 |
// .openEditor(editorInput, ConcordanceEditor.ID); //$NON-NLS-1$ |
|
| 131 |
// } catch (PartInitException e) {
|
|
| 132 |
// System.err.println("Error: "+e.getLocalizedMessage());
|
|
| 133 |
// } |
|
| 134 |
// |
|
| 135 |
// return null; |
|
| 136 |
// } |
|
| 137 |
|
|
| 138 |
|
|
| 139 |
} |
|
| tmp/org.txm.index.rcp/src/org/txm/index/rcp/handlers/ComputeLexicon.java (revision 845) | ||
|---|---|---|
| 28 | 28 |
return false; |
| 29 | 29 |
} |
| 30 | 30 |
|
| 31 |
Object selection = this.getSelection(event);
|
|
| 31 |
Object selection = this.getCorporaViewSelectedObject(event);
|
|
| 32 | 32 |
|
| 33 | 33 |
Index index = null; |
| 34 | 34 |
|
| tmp/org.txm.index.rcp/src/org/txm/index/rcp/handlers/ComputeIndex.java (revision 845) | ||
|---|---|---|
| 62 | 62 |
} |
| 63 | 63 |
// From view result node |
| 64 | 64 |
else {
|
| 65 |
Object selection = this.getSelection(event);
|
|
| 65 |
Object selection = this.getCorporaViewSelectedObject(event);
|
|
| 66 | 66 |
|
| 67 | 67 |
// New editor from corpus |
| 68 | 68 |
if (selection instanceof Corpus) {
|
| tmp/org.txm.index.rcp/src/org/txm/index/rcp/handlers/IndexToLexicalTable.java (revision 845) | ||
|---|---|---|
| 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.index.rcp.handlers; |
|
| 29 |
|
|
| 30 |
import java.util.ArrayList; |
|
| 31 |
|
|
| 32 |
import org.apache.batik.util.gui.CSSMediaPanel.Dialog; |
|
| 33 |
import org.eclipse.core.commands.ExecutionEvent; |
|
| 34 |
import org.eclipse.core.commands.ExecutionException; |
|
| 35 |
import org.eclipse.jface.viewers.ArrayContentProvider; |
|
| 36 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
| 37 |
import org.eclipse.jface.viewers.LabelProvider; |
|
| 38 |
import org.eclipse.swt.widgets.Shell; |
|
| 39 |
import org.eclipse.ui.IWorkbenchPage; |
|
| 40 |
import org.eclipse.ui.IWorkbenchWindow; |
|
| 41 |
import org.eclipse.ui.PartInitException; |
|
| 42 |
import org.eclipse.ui.PlatformUI; |
|
| 43 |
import org.eclipse.ui.dialogs.ListSelectionDialog; |
|
| 44 |
import org.eclipse.ui.handlers.HandlerUtil; |
|
| 45 |
import org.txm.index.core.functions.Index; |
|
| 46 |
import org.txm.lexicaltable.core.functions.LexicalTable; |
|
| 47 |
import org.txm.lexicaltable.rcp.editors.___LexicalTableEditorInput; |
|
| 48 |
import org.txm.lexicaltable.rcp.messages.LexicalTableUIMessages; |
|
| 49 |
import org.txm.rcp.StatusLine; |
|
| 50 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
|
| 51 |
import org.txm.rcp.messages.TXMUIMessages; |
|
| 52 |
// TODO: Auto-generated Javadoc |
|
| 53 |
/** |
|
| 54 |
* The Class IndexToLexicalTable. |
|
| 55 |
*/ |
|
| 56 |
public class IndexToLexicalTable extends BaseAbstractHandler {
|
|
| 57 |
|
|
| 58 |
/** The window. */ |
|
| 59 |
private IWorkbenchWindow window; |
|
| 60 |
|
|
| 61 |
/** The selection. */ |
|
| 62 |
private IStructuredSelection selection; |
|
| 63 |
private static Shell shell; |
|
| 64 |
/* (non-Javadoc) |
|
| 65 |
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
|
| 66 |
*/ |
|
| 67 |
@Override |
|
| 68 |
public Object execute(ExecutionEvent event) throws ExecutionException {
|
|
| 69 |
|
|
| 70 |
if(!this.checkStatsEngine()) {
|
|
| 71 |
return null; |
|
| 72 |
} |
|
| 73 |
|
|
| 74 |
|
|
| 75 |
// TODO Auto-generated method stub |
|
| 76 |
window = HandlerUtil.getActiveWorkbenchWindow(event); |
|
| 77 |
selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event); |
|
| 78 |
shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell(); |
|
| 79 |
return null; |
|
| 80 |
} |
|
| 81 |
|
|
| 82 |
/** |
|
| 83 |
* Builds the lexical table. |
|
| 84 |
* |
|
| 85 |
* @param voc the voc |
|
| 86 |
* @param from the from |
|
| 87 |
* @param to the to |
|
| 88 |
* @return true, if successful |
|
| 89 |
*/ |
|
| 90 |
public boolean buildLexicalTable(Index voc, int from, int to) {
|
|
| 91 |
LexicalTable table; |
|
| 92 |
|
|
| 93 |
if (!voc.isComputedWithPartition()) {
|
|
| 94 |
|
|
| 95 |
System.out.println(TXMUIMessages.IndexToLexicalTable_0); |
|
| 96 |
StatusLine.setMessage(TXMUIMessages.IndexToLexicalTable_0); |
|
| 97 |
return false; |
|
| 98 |
} |
|
| 99 |
|
|
| 100 |
System.out.println(LexicalTableUIMessages.ComputeLexicalTable_3); |
|
| 101 |
ArrayList<String> choices = new ArrayList<String>(); |
|
| 102 |
choices.add(LexicalTableUIMessages.ComputeLexicalTable_16); |
|
| 103 |
choices.add(LexicalTableUIMessages.ComputeLexicalTable_12); |
|
| 104 |
ListSelectionDialog dialog = new ListSelectionDialog(shell, |
|
| 105 |
choices, new ArrayContentProvider(), new LabelProvider(), |
|
| 106 |
LexicalTableUIMessages.ComputeLexicalTable_13); |
|
| 107 |
|
|
| 108 |
int ret = dialog.open(); |
|
| 109 |
//System.out.println("ret= "+ret);
|
|
| 110 |
if (ret == Dialog.OK_OPTION) {
|
|
| 111 |
|
|
| 112 |
} else {
|
|
| 113 |
return false; |
|
| 114 |
} |
|
| 115 |
|
|
| 116 |
try {
|
|
| 117 |
table = new LexicalTable(voc); |
|
| 118 |
} catch (Exception e) {
|
|
| 119 |
// TODO Auto-generated catch block |
|
| 120 |
org.txm.rcp.utils.Logger.printStackTrace(e); |
|
| 121 |
return false; |
|
| 122 |
} |
|
| 123 |
|
|
| 124 |
try {
|
|
| 125 |
IWorkbenchWindow window = PlatformUI.getWorkbench() |
|
| 126 |
.getActiveWorkbenchWindow(); |
|
| 127 |
IWorkbenchPage page = window.getActivePage(); |
|
| 128 |
___LexicalTableEditorInput editorInput = new ___LexicalTableEditorInput(table); |
|
| 129 |
StatusLine.setMessage(LexicalTableUIMessages.ComputeLexicalTable_10); |
|
| 130 |
page.openEditor(editorInput, "org.txm.rcp.editors.lexicaltable.LexicalTableEditor"); //$NON-NLS-1$ |
|
| 131 |
} catch (PartInitException e) {
|
|
| 132 |
org.txm.rcp.utils.Logger.printStackTrace(e); |
|
| 133 |
} |
|
| 134 |
|
|
| 135 |
return true; |
|
| 136 |
} |
|
| 137 |
|
|
| 138 |
} |
|
| 0 | 139 | |
| tmp/org.txm.index.rcp/src/org/txm/index/rcp/handlers/SendIndexTo.java (revision 845) | ||
|---|---|---|
| 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.index.rcp.handlers; |
|
| 29 |
|
|
| 30 |
import org.eclipse.core.commands.ExecutionEvent; |
|
| 31 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
| 32 |
import org.eclipse.ui.handlers.HandlerUtil; |
|
| 33 |
import org.txm.core.results.TXMResult; |
|
| 34 |
import org.txm.index.core.functions.Index; |
|
| 35 |
import org.txm.links.rcp.handlers.SendSelectionToQueryable; |
|
| 36 |
import org.txm.rcp.editors.TXMEditor; |
|
| 37 |
import org.txm.searchengine.cqp.corpus.Corpus; |
|
| 38 |
import org.txm.searchengine.cqp.corpus.query.Query; |
|
| 39 |
|
|
| 40 |
/** |
|
| 41 |
* Sends the selected lines of an index or lexicon to compute another command. |
|
| 42 |
* |
|
| 43 |
* @author sjacquot |
|
| 44 |
* |
|
| 45 |
*/ |
|
| 46 |
public class SendIndexTo extends SendSelectionToQueryable {
|
|
| 47 |
|
|
| 48 |
|
|
| 49 |
@Override |
|
| 50 |
public String createQuery(ExecutionEvent event, IStructuredSelection selection) {
|
|
| 51 |
return Index.createQuery(selection.toList()); |
|
| 52 |
} |
|
| 53 |
|
|
| 54 |
@Override |
|
| 55 |
public String createQueries(ExecutionEvent event, IStructuredSelection selection) {
|
|
| 56 |
return Query.queriesToString(Index.createQueries(selection.toList())); |
|
| 57 |
} |
|
| 58 |
|
|
| 59 |
|
|
| 60 |
|
|
| 61 |
@Override |
|
| 62 |
public TXMResult getResultParent(ExecutionEvent event) {
|
|
| 63 |
TXMEditor editor = (TXMEditor) HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActivePart(); |
|
| 64 |
return Corpus.getFirstParentCorpus(editor.getResult()); |
|
| 65 |
} |
|
| 66 |
|
|
| 67 |
|
|
| 68 |
|
|
| 69 |
} |
|
| 0 | 70 | |
| tmp/org.txm.index.rcp/src/org/txm/index/rcp/editors/IndexEditor.java (revision 845) | ||
|---|---|---|
| 500 | 500 |
paramArea.pack(); |
| 501 | 501 |
|
| 502 | 502 |
// Add double click, "Send to" command |
| 503 |
TXMEditor.addDoubleClickCommandListener(viewer.getTable(), "org.txm.links.rcp.commands.SendToConcordance"); //$NON-NLS-1$
|
|
| 503 |
TXMEditor.addDoubleClickCommandListener(viewer.getTable(), "org.txm.concordance.rcp.commands.SendToConcordance", "org.txm.concordance.rcp.handlers.ComputeConcordance"); //$NON-NLS-1$
|
|
| 504 | 504 |
|
| 505 | 505 |
// Register the context menu |
| 506 | 506 |
TXMEditor.initContextMenu(this.viewer.getTable(), this.getSite(), this.viewer); |
| 507 |
|
|
| 507 | 508 |
|
| 508 |
|
|
| 509 | 509 |
if (queryWidget != null && !queryWidget.isDisposed()) {
|
| 510 | 510 |
queryWidget.setFocus(); |
| 511 | 511 |
} |
| tmp/org.txm.index.rcp/OSGI-INF/l10n/bundle_fr.properties (revision 845) | ||
|---|---|---|
| 3 | 3 |
|
| 4 | 4 |
command.name.0 = Lexique |
| 5 | 5 |
|
| 6 |
command.name.2 = Envoyer vers l'index |
|
| 7 |
|
|
| 6 | 8 |
command.tooltip = Calculer le lexique d'une requ\u00EAte |
| 7 | 9 |
|
| 8 | 10 |
editor.name = Index |
Formats disponibles : Unified diff