Révision 1956
tmp/org.txm.statsengine.r.rcp/src/org/txm/statsengine/r/rcp/handlers/SendToRCommand.java (revision 1956) | ||
---|---|---|
35 | 35 |
import org.eclipse.core.runtime.IStatus; |
36 | 36 |
import org.eclipse.core.runtime.Status; |
37 | 37 |
import org.eclipse.jface.viewers.IStructuredSelection; |
38 |
import org.eclipse.osgi.util.NLS; |
|
38 | 39 |
import org.eclipse.ui.handlers.HandlerUtil; |
39 | 40 |
import org.txm.core.results.TXMResult; |
41 |
import org.txm.rcp.JobsTimer; |
|
40 | 42 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
41 |
import org.txm.rcp.JobsTimer; |
|
42 | 43 |
import org.txm.rcp.utils.JobHandler; |
43 | 44 |
import org.txm.rcp.views.corpora.CorporaView; |
45 |
import org.txm.statsengine.core.StatsEnginesManager; |
|
46 |
import org.txm.statsengine.r.core.RStatsEngine; |
|
44 | 47 |
import org.txm.statsengine.r.rcp.messages.RUIMessages; |
45 | 48 |
import org.txm.statsengine.r.rcp.views.RVariablesView; |
49 |
import org.txm.utils.logger.Log; |
|
46 | 50 |
|
47 | 51 |
/** |
48 | 52 |
* Commands that creates a R object using a TXMResult. |
... | ... | |
80 | 84 |
try { |
81 | 85 |
monitor.subTask(RUIMessages.sendingToRWorkspaceColon+ o); |
82 | 86 |
this.acquireSemaphore(); |
83 |
send((TXMResult)o); |
|
87 |
String symbol = send((TXMResult)o); |
|
88 |
if (symbol == null) { |
|
89 |
Log.info("** {0} was not transfered to the R workspace."); |
|
90 |
this.releaseSemaphore(); |
|
91 |
return Status.CANCEL_STATUS; |
|
92 |
} else { |
|
93 |
Log.info(NLS.bind("{0} has been copied in the ''{1}'' R variable.", o.toString(), symbol)); |
|
94 |
} |
|
84 | 95 |
this.releaseSemaphore(); |
85 | 96 |
|
86 | 97 |
monitor.worked(delta); |
... | ... | |
121 | 132 |
* @param o the o |
122 | 133 |
* @throws Exception the exception |
123 | 134 |
*/ |
124 |
public abstract void send(TXMResult o) throws Exception;
|
|
135 |
public String send(TXMResult o) throws Exception {
|
|
125 | 136 |
|
137 |
RStatsEngine rengine = (RStatsEngine)StatsEnginesManager.getREngine(); |
|
138 |
if (rengine.getTransformers().containsKey(o.getClass().getName())) { |
|
139 |
return rengine.getTransformers().get(o.getClass().getName()).fromTXMtoR(o); |
|
140 |
} else { |
|
141 |
Log.info(NLS.bind("{0} cannot be copied in thr R workspace", o.getSimpleName())); |
|
142 |
return null; |
|
143 |
} |
|
126 | 144 |
//TODO: MD: create the SendToRCommands commands in all plugins that manage the following TXMResult classes |
127 | 145 |
/*{ |
128 | 146 |
|
... | ... | |
161 | 179 |
} |
162 | 180 |
} |
163 | 181 |
*/ |
182 |
} |
|
164 | 183 |
} |
tmp/org.txm.statsengine.r.rcp/plugin.xml (revision 1956) | ||
---|---|---|
50 | 50 |
</command> |
51 | 51 |
<command |
52 | 52 |
defaultHandler="org.txm.statsengine.r.rcp.handlers.SendToRCommand" |
53 |
id="SendToR"
|
|
53 |
id="org.txm.statsengine.r.rcp.handlers.SendToRCommand"
|
|
54 | 54 |
name="%command.name.53"> |
55 | 55 |
</command> |
56 | 56 |
|
... | ... | |
116 | 116 |
allPopups="false" |
117 | 117 |
locationURI="menu:menu.tools?before=menu.tools.separator.misc"> |
118 | 118 |
<command |
119 |
commandId="SendToR"
|
|
119 |
commandId="org.txm.statsengine.r.rcp.handlers.SendToRCommand"
|
|
120 | 120 |
icon="icons/SendToR.png" |
121 | 121 |
style="push"> |
122 | 122 |
<visibleWhen |
... | ... | |
148 | 148 |
allPopups="false" |
149 | 149 |
locationURI="toolbar:org.txm.rcp.toolbartools"> |
150 | 150 |
<command |
151 |
commandId="SendToR"
|
|
151 |
commandId="org.txm.statsengine.r.rcp.handlers.SendToRCommand"
|
|
152 | 152 |
icon="icons/SendToR.png" |
153 | 153 |
style="push"> |
154 | 154 |
<visibleWhen |
... | ... | |
180 | 180 |
allPopups="false" |
181 | 181 |
locationURI="popup:org.txm.rcp.views.corpora.CorporaView?after=org.txm.rcp.corporaview.tools.misc"> |
182 | 182 |
<command |
183 |
commandId="SendToR"
|
|
183 |
commandId="org.txm.statsengine.r.rcp.handlers.SendToRCommand"
|
|
184 | 184 |
icon="icons/SendToR.png" |
185 | 185 |
style="push"> |
186 | 186 |
<visibleWhen |
Formats disponibles : Unified diff