Révision 3515
TXM/trunk/org.txm.ruby.core/src/org/txm/ruby/core/RubyScriptEngine.java (revision 3515) | ||
---|---|---|
34 | 34 |
private javax.script.ScriptEngine engine; |
35 | 35 |
|
36 | 36 |
public RubyScriptEngine() { |
37 |
super("rb"); |
|
37 |
super("ruby", "rb");
|
|
38 | 38 |
} |
39 | 39 |
|
40 | 40 |
@Override |
TXM/trunk/org.txm.python.core/src/org/txm/python/core/PythonScriptEngine.java (revision 3515) | ||
---|---|---|
20 | 20 |
public class PythonScriptEngine extends ScriptEngine { |
21 | 21 |
|
22 | 22 |
public PythonScriptEngine() { |
23 |
super("py"); |
|
23 |
super("python", "py");
|
|
24 | 24 |
} |
25 | 25 |
|
26 | 26 |
@Override |
TXM/trunk/org.txm.ocaml.core/src/org/txm/ocaml/core/OcamlScriptEngine.java (revision 3515) | ||
---|---|---|
19 | 19 |
public class OcamlScriptEngine extends ScriptEngine { |
20 | 20 |
|
21 | 21 |
public OcamlScriptEngine() { |
22 |
super("ml"); |
|
22 |
super("ocaml", "ml");
|
|
23 | 23 |
} |
24 | 24 |
|
25 | 25 |
@Override |
TXM/trunk/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RScriptEngine.java (revision 3515) | ||
---|---|---|
19 | 19 |
public class RScriptEngine extends ScriptEngine { |
20 | 20 |
|
21 | 21 |
public RScriptEngine() { |
22 |
super("R"); |
|
22 |
super("R", "R");
|
|
23 | 23 |
} |
24 | 24 |
|
25 | 25 |
@Override |
TXM/trunk/org.txm.groovy.core/src/java/org/txm/groovy/core/TXMGroovyScriptEngine.java (revision 3515) | ||
---|---|---|
11 | 11 |
public class TXMGroovyScriptEngine extends ScriptEngine { |
12 | 12 |
|
13 | 13 |
public TXMGroovyScriptEngine() { |
14 |
super("groovy"); //$NON-NLS-1$ |
|
14 |
super("groovy", "groovy"); //$NON-NLS-1$
|
|
15 | 15 |
} |
16 | 16 |
|
17 | 17 |
@Override |
TXM/trunk/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/EditionPanel.java (revision 3515) | ||
---|---|---|
1 | 1 |
package org.txm.edition.rcp.editors; |
2 | 2 |
|
3 | 3 |
import java.io.File; |
4 |
|
|
5 |
import java.net.MalformedURLException; |
|
6 |
import java.net.URISyntaxException; |
|
7 | 4 |
import java.net.URL; |
8 | 5 |
import java.nio.file.Paths; |
9 | 6 |
import java.util.ArrayList; |
... | ... | |
23 | 20 |
import org.eclipse.jface.viewers.ISelectionProvider; |
24 | 21 |
import org.eclipse.swt.SWT; |
25 | 22 |
import org.eclipse.swt.browser.Browser; |
26 |
import org.eclipse.swt.browser.LocationEvent; |
|
27 |
import org.eclipse.swt.browser.LocationListener; |
|
28 | 23 |
import org.eclipse.swt.browser.ProgressEvent; |
29 | 24 |
import org.eclipse.swt.browser.ProgressListener; |
30 | 25 |
import org.eclipse.swt.events.DisposeEvent; |
... | ... | |
52 | 47 |
import org.txm.rcp.commands.ShowSelected; |
53 | 48 |
import org.txm.rcp.editors.CommandLink; |
54 | 49 |
import org.txm.rcp.utils.IOClipboard; |
55 |
import org.txm.rcp.utils.URLUtils; |
|
56 | 50 |
import org.txm.utils.io.IOUtils; |
57 | 51 |
import org.txm.utils.logger.Log; |
58 | 52 |
|
... | ... | |
461 | 455 |
Log.finest("EditionPanel " + currentEdition + " reload " + currentPage); |
462 | 456 |
if (currentPage != null && currentEdition != null) { // avoid null pointer |
463 | 457 |
|
464 |
|
|
465 | 458 |
String firstWord = currentPage.getWordId(); |
466 | 459 |
Page nextPage = currentEdition.getNextPage(currentPage); |
467 | 460 |
String lastWord = "w_999999999"; //$NON-NLS-1$ |
TXM/trunk/org.txm.core/src/java/org/txm/core/engines/ScriptEnginesManager.java (revision 3515) | ||
---|---|---|
34 | 34 |
public static ScriptEngine getPythonEngine() { |
35 | 35 |
return (ScriptEngine) Toolbox.getEngineManager(EngineType.SCRIPT).getEngine("python"); |
36 | 36 |
} |
37 |
|
|
38 |
public ScriptEngine getEngineForExtension(String ext) { |
|
39 |
|
|
40 |
for (ScriptEngine e : this.getEngines().values()) { |
|
41 |
if (ext.equals(e.getScriptExtension())) { |
|
42 |
return e; |
|
43 |
} |
|
44 |
} |
|
45 |
return null; |
|
46 |
} |
|
37 | 47 |
} |
TXM/trunk/org.txm.core/src/java/org/txm/core/engines/ScriptEngine.java (revision 3515) | ||
---|---|---|
18 | 18 |
|
19 | 19 |
protected String name; |
20 | 20 |
|
21 |
protected String scriptExtension; |
|
22 |
|
|
21 | 23 |
public boolean canExecute(File script) { |
22 | 24 |
return true; |
23 | 25 |
} |
24 | 26 |
|
25 |
public ScriptEngine(String name) { |
|
27 |
public ScriptEngine(String name, String scriptExtension) {
|
|
26 | 28 |
this.name = name; |
29 |
this.scriptExtension = scriptExtension; |
|
27 | 30 |
} |
28 | 31 |
|
29 | 32 |
public IStatus executeScript(String scriptPath) { |
... | ... | |
51 | 54 |
return name; |
52 | 55 |
} |
53 | 56 |
|
57 |
public String getScriptExtension() { |
|
58 |
return scriptExtension; |
|
59 |
} |
|
60 |
|
|
54 | 61 |
@Override |
55 | 62 |
public void notify(TXMResult r, String state) { |
56 | 63 |
//nothing to do |
TXM/trunk/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java (revision 3515) | ||
---|---|---|
1883 | 1883 |
public String getResultType() { |
1884 | 1884 |
return ConcordanceCoreMessages.RESULT_TYPE; |
1885 | 1885 |
} |
1886 |
|
|
1887 |
public void setKeywordAvailableViewProperties(List<WordProperty> availableProperties) { |
|
1888 |
|
|
1889 |
this.availableKeywordViewProperties = new ArrayList<>(availableProperties); |
|
1890 |
} |
|
1891 |
|
|
1892 |
public void setLeftAvailableViewProperties(List<WordProperty> availableProperties) { |
|
1893 |
|
|
1894 |
this.availableLeftViewProperties = new ArrayList<>(availableProperties); |
|
1895 |
} |
|
1896 |
|
|
1897 |
public void setRightAvailableViewProperties(List<WordProperty> availableProperties) { |
|
1898 |
|
|
1899 |
this.availableRightViewProperties = new ArrayList<>(availableProperties); |
|
1900 |
} |
|
1901 |
|
|
1902 |
public void setKeywordAvailableAnalysisProperties(List<WordProperty> availableProperties) { |
|
1903 |
|
|
1904 |
this.availableKeywordSortProperties = new ArrayList<>(availableProperties); |
|
1905 |
} |
|
1906 |
|
|
1907 |
public void setLeftAvailableAnalysisProperties(List<WordProperty> availableProperties) { |
|
1908 |
|
|
1909 |
this.availableLeftSortProperties = new ArrayList<>(availableProperties); |
|
1910 |
} |
|
1911 |
|
|
1912 |
public void setRightAvailableAnalysisProperties(List<WordProperty> availableProperties) { |
|
1913 |
|
|
1914 |
this.availableRightSortProperties = new ArrayList<>(availableProperties); |
|
1915 |
} |
|
1886 | 1916 |
} |
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/views/fileexplorer/MacroExplorer.java (revision 3515) | ||
---|---|---|
60 | 60 |
import org.txm.Toolbox; |
61 | 61 |
import org.txm.core.engines.EngineType; |
62 | 62 |
import org.txm.core.engines.ScriptEngine; |
63 |
import org.txm.core.engines.ScriptEnginesManager; |
|
63 | 64 |
import org.txm.rcp.TXMWindows; |
64 | 65 |
import org.txm.rcp.handlers.files.CopyFile; |
65 | 66 |
import org.txm.rcp.handlers.files.CutFile; |
... | ... | |
275 | 276 |
} |
276 | 277 |
else { |
277 | 278 |
String ext = FileUtils.getExtension(selectedItem); |
278 |
ScriptEngine se = (ScriptEngine) Toolbox.getEngineManager(EngineType.SCRIPT).getEngine(ext); |
|
279 |
ScriptEnginesManager manager = (ScriptEnginesManager) Toolbox.getEngineManager(EngineType.SCRIPT); |
|
280 |
ScriptEngine se = manager.getEngineForExtension(ext); |
|
279 | 281 |
if (se != null) { |
280 | 282 |
ExecuteScript.executeScript(selectedItem.getAbsolutePath(), page, selection, null); |
281 | 283 |
} else { |
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 3515) | ||
---|---|---|
5 | 5 |
|
6 | 6 |
import java.lang.reflect.Field; |
7 | 7 |
import java.util.ArrayList; |
8 |
import java.util.Arrays; |
|
9 | 8 |
import java.util.HashSet; |
10 | 9 |
import java.util.LinkedHashMap; |
11 | 10 |
import java.util.List; |
... | ... | |
70 | 69 |
import org.txm.core.results.BeanParameters; |
71 | 70 |
import org.txm.core.results.Parameter; |
72 | 71 |
import org.txm.core.results.TXMResult; |
73 |
import org.txm.objects.CorpusBuild; |
|
74 | 72 |
import org.txm.rcp.JobsTimer; |
75 | 73 |
import org.txm.rcp.StatusLine; |
76 | 74 |
import org.txm.rcp.TXMWindows; |
... | ... | |
1076 | 1074 |
@SuppressWarnings("unchecked") |
1077 | 1075 |
public static <T extends TXMResult> TXMEditor<T> openEditor(TXMResultEditorInput<T> editorInput, String editorId) { |
1078 | 1076 |
|
1077 |
|
|
1078 |
|
|
1079 | 1079 |
TXMEditor<T> editor = null; |
1080 | 1080 |
IWorkbenchWindow window = TXMWindows.getActiveWindow(); |
1081 | 1081 |
IWorkbenchPage page = window.getActivePage(); |
1082 | 1082 |
try { |
1083 | 1083 |
boolean wasAlreadyOpened = SWTEditorsUtils.isOpenEditor(editorInput, editorId); |
1084 |
|
|
1084 |
if (!wasAlreadyOpened) { |
|
1085 |
try {StatusLine.setMessage(NLS.bind("Opening {0}...", editorInput.getResult().getSimpleName())); } catch(Exception e) {} |
|
1086 |
} |
|
1085 | 1087 |
// since some editor fields need some values of their parent, |
1086 | 1088 |
// ensure the parents branch is ready (e.g. Sub-corpus properties in Cooccurrence editor, etc.) |
1087 | 1089 |
// show modal blocking&cancelable progression dialog |
... | ... | |
1109 | 1111 |
} |
1110 | 1112 |
} |
1111 | 1113 |
|
1114 |
|
|
1112 | 1115 |
// opening the editor |
1113 | 1116 |
IEditorPart tmpEditor = page.openEditor(editorInput, editorId, true, IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID); |
1114 | 1117 |
if (tmpEditor instanceof TXMEditor) { |
... | ... | |
1116 | 1119 |
} |
1117 | 1120 |
else if (tmpEditor instanceof TXMMultiPageEditor) { |
1118 | 1121 |
editor = (TXMEditor<T>) ((TXMMultiPageEditor) tmpEditor).getMainEditorPart(); |
1119 |
|
|
1120 | 1122 |
// If result specify a opening Area use it |
1121 |
|
|
1122 | 1123 |
} |
1123 | 1124 |
else { |
1124 | 1125 |
Log.severe(NLS.bind(TXMCoreMessages.FailedToOpenTheP0Editor, editorId)); // $NON-NLS-1$ |
... | ... | |
1137 | 1138 |
// } |
1138 | 1139 |
// else { |
1139 | 1140 |
|
1140 |
|
|
1141 | 1141 |
// editor.compute(false); // FIXME: temporary fix for the AHC SVG bug but there are 2 computing (skipped but it stays a quick'n'dirty fix) |
1142 | 1142 |
editor.refresh(false); |
1143 | 1143 |
|
... | ... | |
1146 | 1146 |
// editor.setFocus(); |
1147 | 1147 |
|
1148 | 1148 |
// } |
1149 |
StatusLine.setMessage(null); |
|
1149 | 1150 |
} |
1151 |
|
|
1150 | 1152 |
} |
1151 | 1153 |
catch (Exception e) { |
1152 | 1154 |
// TODO Auto-generated catch block |
... | ... | |
1485 | 1487 |
e.printStackTrace(); |
1486 | 1488 |
} |
1487 | 1489 |
} |
1488 |
|
|
1489 | 1490 |
} |
1490 | 1491 |
|
1491 | 1492 |
// FIXME: SJ: Updating the compute button enabled/disabled state |
TXM/trunk/org.txm.connlu.core/groovy/org/txm/scripts/importer/conllu/CallUD2TigerPerlScript.groovy (revision 3515) | ||
---|---|---|
38 | 38 |
println "Error: Perl engine not correctly set to run $perlScript" |
39 | 39 |
return false; |
40 | 40 |
} |
41 |
def status = engine.runPerl(["$perlScript", "-s", "10000", "-o", "$tigerXMLDirectory", "$f"], null) |
|
41 |
def cmd = new ArrayList() |
|
42 |
cmd.addAll(["$perlScript", "-s", "10000", "-o", "$tigerXMLDirectory", "$f"]) |
|
43 |
def status = engine.runPerl(cmd, null) |
|
42 | 44 |
subcorpusList += mainFile.readLines("UTF-8").findAll() {it.contains("<subcorpus ")}.join("\n") // tiger-xml/main.xml >> tiger-xml/subcorpus-list |
43 | 45 |
} catch (Throwable t) { println "Error: $t" } |
44 | 46 |
} |
TXM/trunk/org.txm.perl.core/plugin.xml (revision 3515) | ||
---|---|---|
5 | 5 |
point="org.txm.core.engines.ScriptEngine"> |
6 | 6 |
<ScriptEngine |
7 | 7 |
class="org.txm.perl.core.PerlScriptEngine" |
8 |
name="perl">
|
|
8 |
name="pl"> |
|
9 | 9 |
</ScriptEngine> |
10 | 10 |
</extension> |
11 | 11 |
<extension |
TXM/trunk/org.txm.perl.core/src/org/txm/perl/core/PerlScriptEngine.java (revision 3515) | ||
---|---|---|
20 | 20 |
public class PerlScriptEngine extends ScriptEngine { |
21 | 21 |
|
22 | 22 |
public PerlScriptEngine() { |
23 |
super("pl"); |
|
23 |
super("perl", "pl");
|
|
24 | 24 |
} |
25 | 25 |
|
26 | 26 |
@Override |
... | ... | |
65 | 65 |
|
66 | 66 |
public boolean canExecute(File script) { |
67 | 67 |
|
68 |
File runner = new File(PerlPreferences.getInstance().getString(PerlPreferences.HOME), |
|
69 |
PerlPreferences.getInstance().getString(PerlPreferences.EXECUTABLE_NAME)); |
|
70 |
|
|
71 |
return script.isFile() && script.canExecute() && runner.canExecute() && runner.isFile(); |
|
68 |
return script.isFile() |
|
69 |
&& script.canRead(); |
|
72 | 70 |
} |
73 | 71 |
|
74 | 72 |
private static IStatus runPerl(ArrayList<String> cmd, HashMap<String, Object> env) { |
73 |
|
|
75 | 74 |
try { |
75 |
ArrayList<String> tmp = new ArrayList<String>(); |
|
76 |
tmp.addAll(cmd); |
|
77 |
cmd = tmp; |
|
76 | 78 |
|
77 | 79 |
String additionalParametersString = PerlPreferences.getInstance().getString(PerlPreferences.ADDITIONAL_PARAMETERS); |
78 | 80 |
String[] additionalParameters = additionalParametersString.split("\t"); |
... | ... | |
82 | 84 |
|
83 | 85 |
String path = PerlPreferences.getInstance().getString(PerlPreferences.HOME); |
84 | 86 |
String perlRunner = PerlPreferences.getInstance().getString(PerlPreferences.EXECUTABLE_NAME); |
85 |
if (path != null && path.length() > 0) { |
|
86 |
cmd.add(0, new File(path, perlRunner).getAbsolutePath()); |
|
87 |
} else { |
|
88 |
cmd.add(0, perlRunner); |
|
89 |
} |
|
90 | 87 |
|
91 |
ProcessBuilder pb = new ProcessBuilder(cmd); |
|
88 |
|
|
89 |
// if (false && (OSDetector.isFamilyUnix() || OSDetector.isFamilyMac())) { |
|
90 |
// if (path != null && path.length() > 0) { |
|
91 |
// cmd.add(0, new File(path, perlRunner).getAbsolutePath()); |
|
92 |
// } else { |
|
93 |
// cmd.add(0, perlRunner); |
|
94 |
// } |
|
95 |
// |
|
96 |
// String code = "'"+StringUtils.join(cmd, "' '")+"'"; |
|
97 |
// cmd = new ArrayList(Arrays.asList("bash", "-c", code)); |
|
98 |
// } else { |
|
99 |
if (path != null && path.length() > 0) { |
|
100 |
cmd.add(0, new File(path, perlRunner).getAbsolutePath()); |
|
101 |
} else { |
|
102 |
cmd.add(0, perlRunner); |
|
103 |
} |
|
104 |
// } |
|
105 |
|
|
106 |
ProcessBuilder pb = new ProcessBuilder(new ArrayList<String>(cmd)); |
|
92 | 107 |
pb.redirectErrorStream(true); |
93 | 108 |
|
94 | 109 |
// new org.txm.utils.StreamHog(p.getInputStream(), true).setName("perl"); |
TXM/trunk/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/ViewPropertySelection.java (revision 3515) | ||
---|---|---|
36 | 36 |
import org.eclipse.ui.IWorkbenchPartSite; |
37 | 37 |
import org.eclipse.ui.IWorkbenchWindow; |
38 | 38 |
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; |
39 |
import org.txm.searchengine.cqp.corpus.Property; |
|
40 |
import org.txm.searchengine.cqp.corpus.WordProperty; |
|
41 | 39 |
import org.txm.concordance.rcp.editors.ConcordanceEditor; |
42 | 40 |
import org.txm.rcp.messages.TXMUIMessages; |
43 | 41 |
import org.txm.rcp.swt.dialog.MultiplePropertySelectionDialog; |
44 |
// TODO: Auto-generated Javadoc
|
|
42 |
import org.txm.searchengine.cqp.corpus.WordProperty;
|
|
45 | 43 |
/** |
46 |
* Action to define the view properties of each column @ author mdecorde. |
|
44 |
* Action to define the view properties of each column |
|
45 |
* |
|
46 |
* @author mdecorde |
|
47 | 47 |
*/ |
48 | 48 |
public class ViewPropertySelection extends Action implements IWorkbenchAction { |
49 | 49 |
|
TXM/trunk/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java (revision 3515) | ||
---|---|---|
1127 | 1127 |
super.widgetSelected(e); |
1128 | 1128 |
} |
1129 | 1129 |
}); |
1130 |
refViewProperties.addSelectionListener(new ComputeSelectionListener(this) { |
|
1131 |
|
|
1132 |
@Override |
|
1133 |
public void widgetSelected(SelectionEvent e) { |
|
1134 |
|
|
1135 |
concordance.setRefViewPattern(new ReferencePattern(refViewProperties.getSelectedProperties(), refViewProperties.getPattern())); |
|
1136 |
super.widgetSelected(e); |
|
1137 |
} |
|
1138 |
}); |
|
1130 |
|
|
1139 | 1131 |
leftViewProperties = new PropertiesSelector<>(propertiesPanel, SWT.NONE); |
1140 | 1132 |
leftViewProperties.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false)); |
1141 | 1133 |
leftViewProperties.setTitle(ConcordanceUIMessages.editor_21); |
... | ... | |
1146 | 1138 |
public void widgetSelected(SelectionEvent e) { |
1147 | 1139 |
|
1148 | 1140 |
concordance.setLeftViewProperties(leftViewProperties.getSelectedProperties()); |
1141 |
concordance.setLeftAvailableViewProperties(leftViewProperties.getAvailableProperties()); |
|
1149 | 1142 |
super.widgetSelected(e); |
1150 | 1143 |
} |
1151 | 1144 |
}); |
... | ... | |
1159 | 1152 |
public void widgetSelected(SelectionEvent e) { |
1160 | 1153 |
|
1161 | 1154 |
concordance.setKeywordViewProperties(keywordViewProperties.getSelectedProperties()); |
1155 |
concordance.setKeywordAvailableViewProperties(keywordViewProperties.getAvailableProperties()); |
|
1162 | 1156 |
super.widgetSelected(e); |
1163 | 1157 |
} |
1164 | 1158 |
}); |
... | ... | |
1172 | 1166 |
public void widgetSelected(SelectionEvent e) { |
1173 | 1167 |
|
1174 | 1168 |
concordance.setRightViewProperties(rightViewProperties.getSelectedProperties()); |
1169 |
concordance.setRightAvailableViewProperties(rightViewProperties.getAvailableProperties()); |
|
1175 | 1170 |
super.widgetSelected(e); |
1176 | 1171 |
} |
1177 | 1172 |
}); |
... | ... | |
1202 | 1197 |
public void widgetSelected(SelectionEvent e) { |
1203 | 1198 |
|
1204 | 1199 |
concordance.setLeftAnalysisProperties(leftSortProperties.getSelectedProperties()); |
1200 |
concordance.setLeftAvailableAnalysisProperties(leftSortProperties.getSelectedProperties()); |
|
1205 | 1201 |
super.widgetSelected(e); |
1206 | 1202 |
} |
1207 | 1203 |
}); |
... | ... | |
1215 | 1211 |
public void widgetSelected(SelectionEvent e) { |
1216 | 1212 |
|
1217 | 1213 |
concordance.setKeywordAnalysisProperties(keywordSortProperties.getSelectedProperties()); |
1214 |
concordance.setKeywordAvailableAnalysisProperties(keywordSortProperties.getSelectedProperties()); |
|
1218 | 1215 |
super.widgetSelected(e); |
1219 | 1216 |
} |
1220 | 1217 |
}); |
... | ... | |
1228 | 1225 |
public void widgetSelected(SelectionEvent e) { |
1229 | 1226 |
|
1230 | 1227 |
concordance.setRightAnalysisProperties(rightSortProperties.getSelectedProperties()); |
1228 |
concordance.setRightAvailableAnalysisProperties(rightSortProperties.getSelectedProperties()); |
|
1231 | 1229 |
super.widgetSelected(e); |
1232 | 1230 |
} |
1233 | 1231 |
}); |
Formats disponibles : Unified diff