Révision 917
| tmp/org.txm.groovy.core/src/java/org/txm/groovy/core/InstallGroovyFiles.java (revision 917) | ||
|---|---|---|
| 21 | 21 |
new File(txmhomedir, folder).mkdirs(); |
| 22 | 22 |
} |
| 23 | 23 |
File scriptsDirectory = new File(txmhomedir, "scripts"); |
| 24 |
File userDirectory = new File(scriptsDirectory, "user"); |
|
| 24 | 25 |
File importDirectory = new File(scriptsDirectory, "import"); |
| 25 | 26 |
File macroDirectory = new File(scriptsDirectory, "macro/org/txm"); |
| 26 | 27 |
File samplesDirectory = new File(scriptsDirectory, "samples/groovy"); |
| ... | ... | |
| 58 | 59 |
BundleUtils.copyFiles(bundle_id, "src/", "groovy/org/txm", "importer/", samplesDirectory); |
| 59 | 60 |
BundleUtils.copyFiles(bundle_id, "src/", "groovy/org/txm", "sw/", samplesDirectory); |
| 60 | 61 |
BundleUtils.copyFiles(bundle_id, "src/", "groovy/org/txm", "tal/", samplesDirectory); |
| 61 |
|
|
| 62 |
|
|
| 63 |
BundleUtils.copyFiles(bundle_id, "src/", "groovy", "", userDirectory); |
|
| 64 |
|
|
| 62 | 65 |
return scriptsDirectory.exists(); |
| 63 | 66 |
} |
| 64 | 67 |
|
| ... | ... | |
| 66 | 69 |
public String getName() {
|
| 67 | 70 |
return "Groovy (org.txm.groovy.core)"; |
| 68 | 71 |
} |
| 69 |
|
|
| 70 | 72 |
} |
| tmp/org.txm.core/src/java/org/txm/Toolbox.java (revision 917) | ||
|---|---|---|
| 504 | 504 |
state = false; |
| 505 | 505 |
|
| 506 | 506 |
//save preferences |
| 507 |
IPreferencesService service = Platform.getPreferencesService(); |
|
| 508 |
try {
|
|
| 509 |
|
|
| 510 |
|
|
| 511 |
|
|
| 512 |
service.getRootNode().flush(); |
|
| 513 |
// .childrenNames()) {
|
|
| 514 |
// System.out.println("********************************************************************************************************"); //$NON-NLS-1$
|
|
| 515 |
// System.out.println(" scope: " + children); //$NON-NLS-1$
|
|
| 516 |
// String[] subchildren = service.getRootNode().node(children).childrenNames(); |
|
| 517 |
// Arrays.sort(subchildren); |
|
| 518 |
// for (String children2 : subchildren) {
|
|
| 519 |
// System.out.println(" node: "+ children2); //$NON-NLS-1$
|
|
| 520 |
// service.getRootNode().node(children).node(children2).keys(); |
|
| 521 |
// Arrays.sort(keys); |
|
| 522 |
// for (String key2 : keys) {
|
|
| 523 |
// System.out.println(" " + key2 + " = " + service.getRootNode().node(children).node(children2).get(key2, null)); //$NON-NLS-1$ //$NON-NLS-2$
|
|
| 524 |
// } |
|
| 525 |
// } |
|
| 526 |
// } |
|
| 527 |
} catch(Exception e) {
|
|
| 528 |
Log.severe("Error while saving preferences and session results.");
|
|
| 529 |
e.printStackTrace(); |
|
| 530 |
} |
|
| 507 |
TXMPreferences.saveAll(); |
|
| 531 | 508 |
} |
| 532 | 509 |
|
| 533 | 510 |
/** |
| ... | ... | |
| 591 | 568 |
return false; |
| 592 | 569 |
} |
| 593 | 570 |
|
| 594 |
String location = txmhomedir + "/workspaces/default.xml"; |
|
| 595 |
|
|
| 571 |
File workspaceFile = new File(txmhomedir, "workspaces/default.xml"); |
|
| 596 | 572 |
Version currentVersion = BundleUtils.getBundleVersion("org.txm.core");
|
| 597 | 573 |
Log.info("Current toolbox version: " + currentVersion + ".");
|
| 598 | 574 |
String installedVersionString = getPreference(TBXPreferences.VERSION); |
| ... | ... | |
| 608 | 584 |
boolean doUpdateworkspace = currentVersion.compareTo(installedVersion) > 0; |
| 609 | 585 |
|
| 610 | 586 |
// no directory |
| 611 |
if (!new File(location).exists()) {
|
|
| 587 |
if (!workspaceFile.exists()) {
|
|
| 612 | 588 |
|
| 613 |
Log.info(TXMCoreMessages.Toolbox_10 + location);
|
|
| 589 |
Log.info(TXMCoreMessages.Toolbox_10 + workspaceFile);
|
|
| 614 | 590 |
|
| 615 | 591 |
// create or update the workspace & create TXM default.xml workspace file |
| 616 | 592 |
Toolbox.workspace = Workspace.createOrUpdate(new File(txmhomedir)); //$NON-NLS-1$ |
| ... | ... | |
| 637 | 613 |
} |
| 638 | 614 |
setPreference(TBXPreferences.VERSION, currentVersion.toString()); |
| 639 | 615 |
} else { // already existing workspace
|
| 640 |
workspace = new Workspace(new File(location));
|
|
| 616 |
workspace = new Workspace(workspaceFile);
|
|
| 641 | 617 |
} |
| 642 | 618 |
|
| 643 |
Log.info(TXMCoreMessages.Toolbox_12 + location);
|
|
| 619 |
Log.info(TXMCoreMessages.Toolbox_12 + workspaceFile);
|
|
| 644 | 620 |
state = true; |
| 645 | 621 |
|
| 646 | 622 |
if (workspace == null || workspace.getProject("default") == null) { //$NON-NLS-1$
|
| 647 |
Log.severe(TXMCoreMessages.Toolbox_14 + location);
|
|
| 623 |
Log.severe(TXMCoreMessages.Toolbox_14 + workspaceFile);
|
|
| 648 | 624 |
state = false; |
| 649 | 625 |
//System.out.println(TXMCoreMessages.FAILED); |
| 650 | 626 |
return false; |
| ... | ... | |
| 652 | 628 |
//System.out.println(TXMCoreMessages.DONE); |
| 653 | 629 |
} |
| 654 | 630 |
} catch (Exception e) {
|
| 655 |
Log.severe(TXMCoreMessages.Toolbox_workspace_init_failed + location);
|
|
| 631 |
Log.severe(TXMCoreMessages.Toolbox_workspace_init_failed + workspaceFile);
|
|
| 656 | 632 |
Log.severe(TXMCoreMessages.Toolbox_15 + Log.toString(e)); |
| 657 | 633 |
Log.printStackTrace(e); |
| 658 | 634 |
state = false; |
| tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java (revision 917) | ||
|---|---|---|
| 52 | 52 |
// we'll use the ProjectScope. |
| 53 | 53 |
public abstract class TXMPreferences extends AbstractPreferenceInitializer {
|
| 54 | 54 |
|
| 55 |
|
|
| 55 |
|
|
| 56 | 56 |
// FIXME: here we must use a ProjectScope when we'll use IProject for TXM corpora |
| 57 | 57 |
public static IScopeContext scope = InstanceScope.INSTANCE; |
| 58 | 58 |
|
| ... | ... | |
| 60 | 60 |
* Alternative nodes to look up when getting a preference. |
| 61 | 61 |
*/ |
| 62 | 62 |
public static ArrayList<String> alternativeNodesQualifiers = new ArrayList<String>(); |
| 63 |
|
|
| 63 |
|
|
| 64 | 64 |
/** |
| 65 | 65 |
* Default unit/token property String. |
| 66 | 66 |
*/ |
| 67 | 67 |
public final static String DEFAULT_UNIT_PROPERTY = "word"; //$NON-NLS-1$ |
| 68 |
|
|
| 68 |
|
|
| 69 | 69 |
/** |
| 70 | 70 |
* Default structural unit String. |
| 71 | 71 |
*/ |
| ... | ... | |
| 76 | 76 |
*/ |
| 77 | 77 |
public final static String DEFAULT_STRUCTURAL_UNIT_PROPERTY = "text_id"; //$NON-NLS-1$ |
| 78 | 78 |
|
| 79 |
|
|
| 80 |
|
|
| 79 |
|
|
| 80 |
|
|
| 81 | 81 |
// essentially for Links and Persistence |
| 82 | 82 |
public final static String RESULT_UUID = "result_uuid"; //$NON-NLS-1$ |
| 83 | 83 |
public final static String PARENT_UUID = "parent_uuid"; //$NON-NLS-1$ |
| ... | ... | |
| 89 | 89 |
* Queries. |
| 90 | 90 |
*/ |
| 91 | 91 |
public static final String QUERIES = "queries"; //$NON-NLS-1$ |
| 92 |
|
|
| 92 |
|
|
| 93 | 93 |
/** |
| 94 | 94 |
* Query. |
| 95 | 95 |
*/ |
| 96 | 96 |
public static final String QUERY = "query"; //$NON-NLS-1$ |
| 97 |
|
|
| 97 |
|
|
| 98 | 98 |
/** |
| 99 | 99 |
* Structural unit. |
| 100 | 100 |
*/ |
| 101 | 101 |
public static final String STRUCTURAL_UNIT = "structural_unit"; //$NON-NLS-1$ |
| 102 |
|
|
| 102 |
|
|
| 103 | 103 |
/*** |
| 104 | 104 |
* Structural unit property. |
| 105 | 105 |
*/ |
| 106 | 106 |
public static final String STRUCTURAL_UNIT_PROPERTY = "structural_unit_property"; //$NON-NLS-1$ |
| 107 |
|
|
| 108 |
|
|
| 107 |
|
|
| 108 |
|
|
| 109 | 109 |
/** |
| 110 | 110 |
* Structural unit properties. |
| 111 | 111 |
*/ |
| 112 | 112 |
public static final String STRUCTURAL_UNIT_PROPERTIES = "structural_unit_properties"; //$NON-NLS-1$ |
| 113 |
|
|
| 114 | 113 |
|
| 114 |
|
|
| 115 | 115 |
/** |
| 116 | 116 |
* Unit property. |
| 117 | 117 |
*/ |
| 118 | 118 |
public static final String UNIT_PROPERTY = "unit_property"; //$NON-NLS-1$ |
| 119 | 119 |
|
| 120 |
|
|
| 120 |
|
|
| 121 | 121 |
/** |
| 122 | 122 |
* Unit properties. |
| 123 | 123 |
*/ |
| 124 | 124 |
public static final String UNIT_PROPERTIES = "unit_properties"; //$NON-NLS-1$ |
| 125 | 125 |
|
| 126 |
|
|
| 126 |
|
|
| 127 | 127 |
/** |
| 128 | 128 |
* Minimum frequency filter value. |
| 129 | 129 |
*/ |
| 130 | 130 |
public static final String F_MIN = "f_min"; //$NON-NLS-1$ |
| 131 |
|
|
| 131 |
|
|
| 132 | 132 |
/** |
| 133 | 133 |
* Maximum frequency filter value. |
| 134 | 134 |
*/ |
| 135 | 135 |
public static final String F_MAX = "f_max"; //$NON-NLS-1$ |
| 136 |
|
|
| 136 |
|
|
| 137 | 137 |
/** |
| 138 | 138 |
* V max filter (max number of lines). |
| 139 | 139 |
*/ |
| 140 | 140 |
public static final String V_MAX = "v_max"; //$NON-NLS-1$ |
| 141 |
|
|
| 142 | 141 |
|
| 143 |
|
|
| 142 |
|
|
| 143 |
|
|
| 144 | 144 |
/** |
| 145 | 145 |
* Separator used when converting list from and to string. |
| 146 | 146 |
*/ |
| 147 | 147 |
public static final String LIST_SEPARATOR = "\t"; //$NON-NLS-1$ |
| 148 | 148 |
|
| 149 | 149 |
public static final String MATCHES = "matches"; |
| 150 |
|
|
| 151 |
|
|
| 152 |
|
|
| 150 |
|
|
| 151 |
|
|
| 152 |
|
|
| 153 | 153 |
/** |
| 154 | 154 |
* Stores a pairs of key / value in a local node dedicated to the specified result. The node qualifier is generated by the <code>Object.toString()</code> method. |
| 155 | 155 |
* |
| ... | ... | |
| 161 | 161 |
} |
| 162 | 162 |
|
| 163 | 163 |
/** |
| 164 |
* Save all preferences in the default app directory |
|
| 165 |
*/ |
|
| 166 |
public static void saveAll() {
|
|
| 167 |
IPreferencesService service = Platform.getPreferencesService(); |
|
| 168 |
try {
|
|
| 169 |
service.getRootNode().flush(); |
|
| 170 |
} catch(Exception e) {
|
|
| 171 |
Log.severe("Error while saving preferences and session results.");
|
|
| 172 |
e.printStackTrace(); |
|
| 173 |
} |
|
| 174 |
} |
|
| 175 |
|
|
| 176 |
/** |
|
| 164 | 177 |
* Looks for the value of the specified <code>key</code> in the specified parameters and preference nodes. |
| 165 | 178 |
* Returns the value of a key in the specified parameters if exists. |
| 166 | 179 |
* Otherwise try to get it from the local result node if exists. |
| ... | ... | |
| 204 | 217 |
if (data_default.length() == 0) {
|
| 205 | 218 |
return null; |
| 206 | 219 |
} |
| 207 |
|
|
| 220 |
|
|
| 208 | 221 |
try {
|
| 209 | 222 |
defaultValue = fromString(data_default); |
| 210 | 223 |
} catch (Exception e) {
|
| ... | ... | |
| 951 | 964 |
e.printStackTrace(); |
| 952 | 965 |
} |
| 953 | 966 |
} |
| 954 |
|
|
| 955 |
|
|
| 967 |
|
|
| 968 |
|
|
| 956 | 969 |
/** |
| 957 | 970 |
* Dumps the keys and values of the specified node of the instance and default scopes. |
| 958 | 971 |
* @param nodeQualifier |
| ... | ... | |
| 982 | 995 |
} |
| 983 | 996 |
|
| 984 | 997 |
public static HashMap<String, Object> getKeysAndValuesAsMap(IScopeContext scope, String nodeQualifier) {
|
| 985 |
|
|
| 998 |
|
|
| 986 | 999 |
HashMap<String, Object> str = new HashMap<String, Object>(); |
| 987 |
|
|
| 1000 |
|
|
| 988 | 1001 |
IEclipsePreferences preferences = scope.getNode(nodeQualifier); |
| 989 |
|
|
| 1002 |
|
|
| 990 | 1003 |
try {
|
| 991 | 1004 |
String[] keys = preferences.keys(); |
| 992 | 1005 |
Arrays.sort(keys); |
| ... | ... | |
| 998 | 1011 |
// TODO Auto-generated catch block |
| 999 | 1012 |
e.printStackTrace(); |
| 1000 | 1013 |
} |
| 1001 |
|
|
| 1014 |
|
|
| 1002 | 1015 |
return str; |
| 1003 | 1016 |
} |
| 1004 |
|
|
| 1017 |
|
|
| 1005 | 1018 |
public static String getKeysAndValues(IScopeContext scope, String nodeQualifier) {
|
| 1006 |
|
|
| 1019 |
|
|
| 1007 | 1020 |
StringBuilder str = new StringBuilder(); |
| 1008 |
|
|
| 1021 |
|
|
| 1009 | 1022 |
IEclipsePreferences preferences = scope.getNode(nodeQualifier); |
| 1010 |
|
|
| 1023 |
|
|
| 1011 | 1024 |
str.append("Path = " + preferences.absolutePath() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
|
| 1012 |
|
|
| 1025 |
|
|
| 1013 | 1026 |
try {
|
| 1014 | 1027 |
String[] keys = preferences.keys(); |
| 1015 | 1028 |
Arrays.sort(keys); |
| ... | ... | |
| 1021 | 1034 |
// TODO Auto-generated catch block |
| 1022 | 1035 |
e.printStackTrace(); |
| 1023 | 1036 |
} |
| 1024 |
|
|
| 1037 |
|
|
| 1025 | 1038 |
return str.toString(); |
| 1026 | 1039 |
} |
| 1027 |
|
|
| 1028 |
|
|
| 1029 |
|
|
| 1030 | 1040 |
|
| 1041 |
|
|
| 1042 |
|
|
| 1043 |
|
|
| 1031 | 1044 |
/** |
| 1032 | 1045 |
* Dumps the keys and values of the specified node, of the specified result node and also of the alternative nodes. |
| 1033 | 1046 |
* @param nodeQualifier |
| ... | ... | |
| 1105 | 1118 |
} |
| 1106 | 1119 |
} |
| 1107 | 1120 |
|
| 1108 |
|
|
| 1121 |
|
|
| 1109 | 1122 |
/** |
| 1110 | 1123 |
* Deletes all the result nodes from the preferences and files that are not set as persistable. |
| 1111 | 1124 |
*/ |
| ... | ... | |
| 1119 | 1132 |
} |
| 1120 | 1133 |
} |
| 1121 | 1134 |
|
| 1122 |
|
|
| 1135 |
|
|
| 1123 | 1136 |
/** |
| 1124 | 1137 |
* Deletes all the result nodes from the preferences and files. |
| 1125 | 1138 |
*/ |
| ... | ... | |
| 1130 | 1143 |
delete(scope.getNode(resultsNodesQualifier.get(i))); |
| 1131 | 1144 |
} |
| 1132 | 1145 |
} |
| 1133 |
|
|
| 1134 |
|
|
| 1146 |
|
|
| 1147 |
|
|
| 1135 | 1148 |
/** |
| 1136 | 1149 |
* Gets all the result nodes qualifiers (from scope or *.prefs files starting with TXMResult.UUID_PREFIX, eg.: "txm_res_"). |
| 1137 | 1150 |
* @return |
| ... | ... | |
| 1144 | 1157 |
if(scopeName != TXMPreferences.scope.getName()) {
|
| 1145 | 1158 |
continue; |
| 1146 | 1159 |
} |
| 1147 |
|
|
| 1160 |
|
|
| 1148 | 1161 |
String[] nodesNames = service.getRootNode().node(scopeName).childrenNames(); |
| 1149 | 1162 |
Arrays.sort(nodesNames); |
| 1150 | 1163 |
for (String nodeName : nodesNames) {
|
| ... | ... | |
| 1159 | 1172 |
|
| 1160 | 1173 |
return resultsNodesQualifiers; |
| 1161 | 1174 |
} |
| 1162 |
|
|
| 1163 | 1175 |
|
| 1164 |
|
|
| 1165 |
|
|
| 1176 |
|
|
| 1177 |
|
|
| 1178 |
|
|
| 1166 | 1179 |
/** |
| 1167 | 1180 |
* Internal method to find the node qualifier of a result otherwise look in instance, default scopes and in alternatives nodes qualifiers. |
| 1168 | 1181 |
* @param result |
| ... | ... | |
| 1216 | 1229 |
} |
| 1217 | 1230 |
} |
| 1218 | 1231 |
|
| 1219 |
|
|
| 1220 |
|
|
| 1232 |
|
|
| 1233 |
|
|
| 1221 | 1234 |
/** |
| 1222 | 1235 |
* |
| 1223 | 1236 |
* @param nodeQualifier |
| ... | ... | |
| 1225 | 1238 |
* @param value |
| 1226 | 1239 |
*/ |
| 1227 | 1240 |
public static void put(String nodeQualifier, String key, Object value) {
|
| 1228 |
|
|
| 1241 |
|
|
| 1229 | 1242 |
if (Integer.class.isInstance(value)) {
|
| 1230 | 1243 |
scope.getNode(nodeQualifier).putInt(key, (Integer) value); |
| 1231 | 1244 |
} |
| ... | ... | |
| 1252 | 1265 |
e.printStackTrace(); |
| 1253 | 1266 |
} |
| 1254 | 1267 |
} |
| 1255 |
// // FIXME: to do, MD: not for now |
|
| 1256 |
// // FIXME: SJ: need to prove/validate this method |
|
| 1257 |
// else if (byte.class.isAssignableFrom(value.getClass().getComponentType())) {
|
|
| 1258 |
// System.err.println("TXMPreferences.put(): byte array -> need to prove/validate this method.");
|
|
| 1259 |
// scope.getNode(nodeQualifier).putByteArray(key, (byte[]) value); |
|
| 1260 |
// } |
|
| 1268 |
// // FIXME: to do, MD: not for now
|
|
| 1269 |
// // FIXME: SJ: need to prove/validate this method
|
|
| 1270 |
// else if (byte.class.isAssignableFrom(value.getClass().getComponentType())) {
|
|
| 1271 |
// System.err.println("TXMPreferences.put(): byte array -> need to prove/validate this method.");
|
|
| 1272 |
// scope.getNode(nodeQualifier).putByteArray(key, (byte[]) value);
|
|
| 1273 |
// }
|
|
| 1261 | 1274 |
else if(value != null) {
|
| 1262 | 1275 |
scope.getNode(nodeQualifier).put(key, value.toString()); |
| 1263 |
|
|
| 1264 |
|
|
| 1265 |
// FIXME: to do if needed |
|
| 1276 |
|
|
| 1277 |
|
|
| 1278 |
// FIXME: to do if needed
|
|
| 1266 | 1279 |
//FIXME: Debug |
| 1267 | 1280 |
//System.err.println("TXMPreferences.put(): error, can't find a put method that matches the value type: " + value.getClass() + "=" + value + ".");
|
| 1268 | 1281 |
} |
| 1269 | 1282 |
} |
| 1270 | 1283 |
|
| 1271 |
|
|
| 1272 |
|
|
| 1284 |
|
|
| 1285 |
|
|
| 1273 | 1286 |
/** |
| 1274 | 1287 |
* Stores the specified parameters pairs of key/value in a local node dedicated to the specified result. The node qualifier is generated by the <code>TXMResult.getUUID</code> method. |
| 1275 | 1288 |
* @param result |
| ... | ... | |
| 1280 | 1293 |
put(result.getUUID(), key, value);; |
| 1281 | 1294 |
} |
| 1282 | 1295 |
|
| 1283 |
|
|
| 1296 |
|
|
| 1284 | 1297 |
// FIXME: TO do if needed |
| 1285 | 1298 |
private static void putLocalSerializable(TXMResult result, String key, Serializable value) {
|
| 1286 | 1299 |
byte[] b = toByteArray(value); |
| 1287 | 1300 |
scope.getNode(result.getUUID()).putByteArray(key, b); |
| 1288 | 1301 |
} |
| 1289 | 1302 |
|
| 1290 |
|
|
| 1291 |
|
|
| 1292 |
|
|
| 1293 |
|
|
| 1294 |
|
|
| 1303 |
|
|
| 1304 |
|
|
| 1305 |
|
|
| 1306 |
|
|
| 1307 |
|
|
| 1295 | 1308 |
/** Read the object from Base64 string. */ |
| 1296 | 1309 |
private static Serializable fromString( String s ) throws IOException , |
| 1297 | 1310 |
ClassNotFoundException {
|
| ... | ... | |
| 1312 | 1325 |
oos.close(); |
| 1313 | 1326 |
return Base64.getEncoder().encodeToString(baos.toByteArray()); |
| 1314 | 1327 |
} |
| 1315 |
|
|
| 1316 |
// |
|
| 1317 |
// /** |
|
| 1318 |
// * |
|
| 1319 |
// * @param nodeQualifier |
|
| 1320 |
// * @param key |
|
| 1321 |
// * @param value |
|
| 1322 |
// */ |
|
| 1323 |
// public static void putByteArray(String nodeQualifier, String key, byte[] value) {
|
|
| 1324 |
// scope.getNode(nodeQualifier).putByteArray(key, value); |
|
| 1325 |
// } |
|
| 1326 | 1328 |
|
| 1327 |
|
|
| 1328 |
|
|
| 1329 |
|
|
| 1329 |
// |
|
| 1330 |
// /** |
|
| 1331 |
// * |
|
| 1332 |
// * @param nodeQualifier |
|
| 1333 |
// * @param key |
|
| 1334 |
// * @param value |
|
| 1335 |
// */ |
|
| 1336 |
// public static void putByteArray(String nodeQualifier, String key, byte[] value) {
|
|
| 1337 |
// scope.getNode(nodeQualifier).putByteArray(key, value); |
|
| 1338 |
// } |
|
| 1339 |
|
|
| 1340 |
|
|
| 1341 |
|
|
| 1342 |
|
|
| 1330 | 1343 |
public static byte[] toByteArray(Serializable s) {
|
| 1331 | 1344 |
try {
|
| 1332 | 1345 |
ByteArrayOutputStream bwriter = new ByteArrayOutputStream(); |
| ... | ... | |
| 1340 | 1353 |
return null; |
| 1341 | 1354 |
} |
| 1342 | 1355 |
|
| 1343 |
|
|
| 1356 |
|
|
| 1344 | 1357 |
/** |
| 1345 | 1358 |
* Clones nodes. Creates a local node for the destination result and copy it all the source result parameters. |
| 1346 | 1359 |
* @param srcResult |
| tmp/org.txm.core/src/java/org/txm/objects/Workspace.java (revision 917) | ||
|---|---|---|
| 117 | 117 |
for (String folder : createfolders) {
|
| 118 | 118 |
new File(txmhomedir, folder).mkdir(); |
| 119 | 119 |
} |
| 120 |
if (!xmlfile.exists()) {
|
|
| 121 |
if (!writeEmptyWorkspaceFile(xmlfile)) {
|
|
| 122 |
System.out.println("Error while creating workspace definition file: "+xmlfile);
|
|
| 123 |
} |
|
| 124 |
} |
|
| 120 | 125 |
|
| 121 |
if (!writeEmptyWorkspaceFile(xmlfile)) {
|
|
| 122 |
System.out.println("Error while creating workspace definition file: "+xmlfile);
|
|
| 123 |
} |
|
| 124 |
|
|
| 125 | 126 |
String path = TXMPreferences.getString(TBXPreferences.INSTALL_DIR, TBXPreferences.PREFERENCES_NODE); |
| 126 | 127 |
File installDirectory = new File(path); |
| 127 | 128 |
if (!installDirectory.exists()) {
|
| 128 | 129 |
System.out.println("Error: Workspace cannot found install directory: "+installDirectory.getAbsolutePath());
|
| 129 | 130 |
return null; |
| 130 | 131 |
} |
| 131 |
|
|
| 132 |
|
|
| 132 | 133 |
File redistDirectory = new File(installDirectory, "redist"); |
| 133 | 134 |
if (!redistDirectory.exists()) {
|
| 134 | 135 |
System.out.println("Warning: Workspace cannot found redist directory: "+redistDirectory.getAbsolutePath());
|
| ... | ... | |
| 136 | 137 |
FileCopy.copyFiles(redistDirectory, txmhomedir); |
| 137 | 138 |
} |
| 138 | 139 |
|
| 139 |
// // the folders to copy from TXM install dir |
|
| 140 |
// BundleUtils.copyFiles("org.txm.core", "res", "org/txm/xml", "xsl", txmhomedir);
|
|
| 141 |
// BundleUtils.copyFiles("org.txm.core", "res", "org/txm/xml", "schema", txmhomedir);
|
|
| 142 |
// BundleUtils.copyFiles("org.txm.core", "res", "org/txm", "css", txmhomedir);
|
|
| 140 |
// // the folders to copy from TXM install dir
|
|
| 141 |
// BundleUtils.copyFiles("org.txm.core", "res", "org/txm/xml", "xsl", txmhomedir);
|
|
| 142 |
// BundleUtils.copyFiles("org.txm.core", "res", "org/txm/xml", "schema", txmhomedir);
|
|
| 143 |
// BundleUtils.copyFiles("org.txm.core", "res", "org/txm", "css", txmhomedir);
|
|
| 143 | 144 |
|
| 144 | 145 |
Workspace workspace = new Workspace(xmlfile); |
| 145 | 146 |
workspace.save(); |
| 146 |
|
|
| 147 |
|
|
| 147 | 148 |
IConfigurationElement[] contributions = Platform.getExtensionRegistry().getConfigurationElementsFor(PostTXMHOMEInstallationStep.EXTENSION_ID); |
| 148 | 149 |
//System.out.println("contributions: "+Arrays.toString(contributions));
|
| 149 | 150 |
for (int i = 0; i < contributions.length; i++) {
|
| ... | ... | |
| 157 | 158 |
e.printStackTrace(); |
| 158 | 159 |
} |
| 159 | 160 |
} |
| 160 |
|
|
| 161 |
|
|
| 161 | 162 |
return workspace; |
| 162 | 163 |
} catch (Exception e) {
|
| 163 | 164 |
Log.severe(NLS.bind(TXMCoreMessages.ApplicationWorkbenchAdvisor_40, e.getLocalizedMessage())); |
| tmp/org.txm.annotation.kr.core/build.properties (revision 917) | ||
|---|---|---|
| 1 | 1 |
source.. = src/ |
| 2 | 2 |
output.. = bin/ |
| 3 | 3 |
bin.includes = META-INF/,\ |
| 4 |
. |
|
| 4 |
.,\ |
|
| 5 |
plugin.xml |
|
| tmp/org.txm.setups/shared/debian/DEBIAN/postinst (revision 917) | ||
|---|---|---|
| 56 | 56 |
fi |
| 57 | 57 |
|
| 58 | 58 |
#db_stop |
| 59 |
echo "** TXM install: done, type TXM& in a terminal to launch the application"
|
|
| 59 |
echo "** TXM install: done, type TXM${VERSION}& in a terminal to launch the application or use your desktop application launcher."
|
|
| 60 | 60 |
exit 0 |
| tmp/org.txm.setups/shared/debian/usr/bin/TXM (revision 917) | ||
|---|---|---|
| 9 | 9 |
exec 3>$HOME/TXM_PostInstallOutputLogs.txt |
| 10 | 10 |
exec 4>$HOME/TXM_PostInstallErrorLogs.txt |
| 11 | 11 |
|
| 12 |
TXMINSTALL="/usr/lib/TXM${VERSION}"
|
|
| 13 |
TXMHOME="$HOME/TXM${VERSION}"
|
|
| 14 |
DOTTXMHOME="$TXMHOME/.txm" |
|
| 15 |
|
|
| 12 | 16 |
( |
| 13 | 17 |
echo "TXM: $HOME is '$HOME'" |
| 14 | 18 |
|
| ... | ... | |
| 20 | 24 |
|
| 21 | 25 |
echo "TXM: Creating all necessary directories." |
| 22 | 26 |
|
| 23 |
TXMINSTALL="/usr/lib/TXM${VERSION}"
|
|
| 24 |
TXMHOME="$HOME/TXM${VERSION}"
|
|
| 25 |
DOTTXMHOME="$TXMHOME/.txm" |
|
| 26 |
|
|
| 27 | 27 |
echo "TXMHOME='$TXMHOME'" |
| 28 | 28 |
if [ ! -d "$TXMHOME" ]; then |
| 29 | 29 |
mkdir "$TXMHOME" |
| ... | ... | |
| 119 | 119 |
exit 1 |
| 120 | 120 |
fi |
| 121 | 121 |
|
| 122 |
echo "TXM: getting '$TXMISNTALL/TXM.ini' and setting write permissions to '$DOTTXMHOME/TXM.ini'"
|
|
| 123 |
cp "$TXMISNTALL/TXM.ini" "$DOTTXMHOME/TXM.ini" &&
|
|
| 122 |
echo "TXM: getting '$TXMINSTALL/TXM.ini' and setting write permissions to '$DOTTXMHOME/TXM.ini'"
|
|
| 123 |
cp "$TXMINSTALL/TXM.ini" "$DOTTXMHOME/TXM.ini" &&
|
|
| 124 | 124 |
chmod +w "$DOTTXMHOME/TXM.ini" |
| 125 | 125 |
|
| 126 | 126 |
if [ $? != 0 ]; then |
| ... | ... | |
| 150 | 150 |
## uncomment next lien to enable full debug |
| 151 | 151 |
#DEBUGOPTIONS="-log -consolelog -clean -debug -console -noexit" |
| 152 | 152 |
|
| 153 |
UBUNTU_MENUPROXY=0 exec "$TXMINSTALL/TXM" -run --launcher.ini "$DOTTXMHOME/TXM.ini" $DEBUGOPTIONS -data "$DOTTXMHOME/data" -user "$DOTTXMHOME/user" -install "$TXMINSTALL" |
|
| 153 |
UBUNTU_MENUPROXY=0 exec "${TXMINSTALL}/TXM" -run --launcher.ini "$DOTTXMHOME/TXM.ini" $DEBUGOPTIONS -data "$DOTTXMHOME/data" -user "$DOTTXMHOME/user" -install "$TXMINSTALL"
|
|
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/utils/GSERunner.java (revision 917) | ||
|---|---|---|
| 81 | 81 |
} |
| 82 | 82 |
|
| 83 | 83 |
ImportCustomizer imports = new ImportCustomizer(); |
| 84 |
imports.addStarImports("org.txm.rcp.utils", "org.txm.utils", "org.txm", "org.kohsuke.args4j", "org.txm.rcp.swt.widget.parameters");
|
|
| 84 |
imports.addStarImports("org.txm.rcp.utils",
|
|
| 85 |
"org.txm.utils", |
|
| 86 |
"org.txm", |
|
| 87 |
"org.kohsuke.args4j", |
|
| 88 |
"org.txm.rcp.swt.widget.parameters"); |
|
| 85 | 89 |
imports.addImports("groovy.transform.Field");
|
| 86 | 90 |
CompilerConfiguration configuration = new CompilerConfiguration(); |
| 87 | 91 |
configuration.addCompilationCustomizers(imports); |
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchAdvisor.java (revision 917) | ||
|---|---|---|
| 117 | 117 |
private boolean installPreferenceRestored; |
| 118 | 118 |
private IOConsoleOutputStream stream; |
| 119 | 119 |
private IOConsoleInputStream streamInput; |
| 120 |
|
|
| 120 |
|
|
| 121 | 121 |
/* (non-Javadoc) |
| 122 | 122 |
* @see org.eclipse.ui.application.WorkbenchAdvisor#createWorkbenchWindowAdvisor(org.eclipse.ui.application.IWorkbenchWindowConfigurer) |
| 123 | 123 |
*/ |
| ... | ... | |
| 180 | 180 |
|
| 181 | 181 |
engine.setTheme(theme, true); |
| 182 | 182 |
} |
| 183 |
|
|
| 183 |
|
|
| 184 | 184 |
private void openCGU() {
|
| 185 | 185 |
String cgu = TxmPreferences.get("cgu");
|
| 186 | 186 |
if (!"true".equals(cgu)) {
|
| ... | ... | |
| 221 | 221 |
JobsTimer.start(); |
| 222 | 222 |
this.runInit(monitor); |
| 223 | 223 |
try {
|
| 224 |
|
|
| 224 |
|
|
| 225 | 225 |
// CGU popup |
| 226 | 226 |
this.syncExec(new Runnable() {
|
| 227 | 227 |
@Override |
| ... | ... | |
| 230 | 230 |
printTXMVersion(); // print TXM version in the console |
| 231 | 231 |
} |
| 232 | 232 |
}); |
| 233 |
|
|
| 233 |
|
|
| 234 | 234 |
monitor.beginTask("Starting TXM", 100);
|
| 235 | 235 |
|
| 236 | 236 |
monitor.setTaskName(TXMUIMessages.ApplicationWorkbenchAdvisor_2); |
| ... | ... | |
| 257 | 257 |
monitor.done(); |
| 258 | 258 |
return Status.CANCEL_STATUS; |
| 259 | 259 |
} |
| 260 |
|
|
| 260 |
|
|
| 261 | 261 |
// restore corpora if TXMHOME has been created |
| 262 | 262 |
if (txmHomeRestored) {
|
| 263 | 263 |
createBackUpDirectory(monitor); |
| ... | ... | |
| 273 | 273 |
// TODO Auto-generated catch block |
| 274 | 274 |
e.printStackTrace(); |
| 275 | 275 |
} |
| 276 |
|
|
| 276 |
|
|
| 277 | 277 |
} |
| 278 | 278 |
}); |
| 279 | 279 |
} |
| ... | ... | |
| 285 | 285 |
} catch(ThreadDeath td) {
|
| 286 | 286 |
System.out.println("TXM initialization has been canceled by user. Please restart TXM.");
|
| 287 | 287 |
} |
| 288 |
|
|
| 288 |
|
|
| 289 | 289 |
if (Toolbox.isInitialized()) {
|
| 290 | 290 |
StatusLine.setMessage(TXMUIMessages.ApplicationWorkbenchAdvisor_ready); |
| 291 | 291 |
System.out.println(TXMUIMessages.ApplicationWorkbenchAdvisor_ready); |
| ... | ... | |
| 293 | 293 |
StatusLine.setMessage(TXMUIMessages.ApplicationWorkbenchAdvisor_init_failed); |
| 294 | 294 |
System.out.println(TXMUIMessages.ApplicationWorkbenchAdvisor_init_failed); |
| 295 | 295 |
} |
| 296 |
|
|
| 296 |
|
|
| 297 | 297 |
JobsTimer.stopAndPrint(); |
| 298 | 298 |
return Status.OK_STATUS; |
| 299 | 299 |
} |
| ... | ... | |
| 423 | 423 |
System.out.println("Update canceled.");
|
| 424 | 424 |
} |
| 425 | 425 |
} |
| 426 |
|
|
| 426 |
|
|
| 427 | 427 |
public static boolean testTXMHOMEPreferenceAndDirectory() {
|
| 428 | 428 |
String path = TXMPreferences.getString(TBXPreferences.USER_TXM_HOME, TBXPreferences.PREFERENCES_NODE); |
| 429 |
|
|
| 429 |
|
|
| 430 | 430 |
if (path == null || path.trim().equals("")) {
|
| 431 | 431 |
Log.warning("TXM user directory is not set ('"+TBXPreferences.USER_TXM_HOME+"' preference is not set).");
|
| 432 | 432 |
return true; |
| ... | ... | |
| 447 | 447 |
} |
| 448 | 448 |
|
| 449 | 449 |
public static boolean testTXMINSTALLPreferenceAndDirectory() {
|
| 450 |
// TxmPreferences.dump(); |
|
| 450 |
// TxmPreferences.dump();
|
|
| 451 | 451 |
if (TXMPreferences.getString(TBXPreferences.INSTALL_DIR, TBXPreferences.PREFERENCES_NODE) == null) {
|
| 452 | 452 |
Log.warning("TXM install directory is not set ('"+TBXPreferences.INSTALL_DIR+"' preference is not set).");
|
| 453 | 453 |
return true; |
| ... | ... | |
| 477 | 477 |
public void postShutdown() {
|
| 478 | 478 |
callStopScript(); |
| 479 | 479 |
Toolbox.shutdown(); |
| 480 |
|
|
| 480 |
|
|
| 481 | 481 |
} |
| 482 | 482 |
|
| 483 | 483 |
/* (non-Javadoc) |
| ... | ... | |
| 520 | 520 |
public void setConsoleOutputColor(Color newColor) {
|
| 521 | 521 |
if (stream != null) stream.setColor(newColor); |
| 522 | 522 |
} |
| 523 |
|
|
| 523 |
|
|
| 524 | 524 |
/** |
| 525 | 525 |
* if INSTALLDIR preference is not set or empty, read the install.prefs file and set the |
| 526 | 526 |
* |
| ... | ... | |
| 553 | 553 |
String installpath = Platform.getInstallLocation().getURL().getFile(); // the TXM.exe file path |
| 554 | 554 |
File installDirectory = new File(installpath); |
| 555 | 555 |
//installDirectory = installDirectory.getCanonicalFile(); |
| 556 |
|
|
| 556 |
|
|
| 557 | 557 |
//TODO: ensure all preferences of install.prefs file are now stored in the default preferences |
| 558 |
// File preferenceFile = new File(installDirectory, "install.prefs"); //$NON-NLS-1$ |
|
| 559 |
// if (preferenceFile.exists()) {
|
|
| 560 |
// System.out.println(NLS.bind(RCPMessages.ApplicationWorkbenchAdvisor_25, preferenceFile)); |
|
| 561 |
// if (Util.isWindows()) //NSIS has generated ISO-8859-1 preference file |
|
| 562 |
// TxmPreferences.importFromFile(preferenceFile, "ISO-8859-1", false); //$NON-NLS-1$ |
|
| 563 |
// else |
|
| 564 |
// TxmPreferences.importFromFile(preferenceFile); |
|
| 565 |
// } else {
|
|
| 566 |
// System.out.println("No installation preference file found in the installation directory: "+preferenceFile);
|
|
| 567 |
// installPreferenceRestored = false; |
|
| 568 |
// return true; |
|
| 569 |
// } |
|
| 570 |
// // restore previous TreeTagger preferences |
|
| 571 |
// File previousPreferenceFile = new File(System.getProperty("java.io.tmpdir"), //$NON-NLS-1$
|
|
| 572 |
// "org.txm.rcp.prefs"); //$NON-NLS-1$ |
|
| 573 |
// |
|
| 574 |
// if (System.getProperty("os.name").indexOf("Mac") >= 0) { //$NON-NLS-1$ //$NON-NLS-2$
|
|
| 575 |
// previousPreferenceFile = new File("/tmp/org.txm.rcp.prefs"); //$NON-NLS-1$
|
|
| 576 |
// } |
|
| 577 |
// |
|
| 578 |
// if (previousPreferenceFile.exists()) {
|
|
| 579 |
// System.out.println("Restoring preferences (from "+previousPreferenceFile+").");
|
|
| 580 |
// Properties previousProperties = new Properties(); |
|
| 581 |
// BufferedReader reader = IOUtils.getReader(previousPreferenceFile, "ISO-8859-1"); |
|
| 582 |
// previousProperties.load(reader); |
|
| 583 |
// String [] keys= {TBXPreferences.TREETAGGER_INSTALL_PATH,
|
|
| 584 |
// TBXPreferences.TREETAGGER_MODELS_PATH, |
|
| 585 |
// TBXPreferences.TREETAGGER_APOSTROPHE, |
|
| 586 |
// TBXPreferences.TREETAGGER_OPTIONS}; |
|
| 587 |
// for (String k : keys) {
|
|
| 588 |
// if (previousProperties.getProperty(k) != null) {
|
|
| 589 |
// TxmPreferences.set(k, previousProperties.getProperty(k)); |
|
| 590 |
// } |
|
| 591 |
// } |
|
| 592 |
// } |
|
| 558 |
// File preferenceFile = new File(installDirectory, "install.prefs"); //$NON-NLS-1$
|
|
| 559 |
// if (preferenceFile.exists()) {
|
|
| 560 |
// System.out.println(NLS.bind(RCPMessages.ApplicationWorkbenchAdvisor_25, preferenceFile));
|
|
| 561 |
// if (Util.isWindows()) //NSIS has generated ISO-8859-1 preference file
|
|
| 562 |
// TxmPreferences.importFromFile(preferenceFile, "ISO-8859-1", false); //$NON-NLS-1$
|
|
| 563 |
// else
|
|
| 564 |
// TxmPreferences.importFromFile(preferenceFile);
|
|
| 565 |
// } else {
|
|
| 566 |
// System.out.println("No installation preference file found in the installation directory: "+preferenceFile);
|
|
| 567 |
// installPreferenceRestored = false;
|
|
| 568 |
// return true;
|
|
| 569 |
// }
|
|
| 570 |
// // restore previous TreeTagger preferences
|
|
| 571 |
// File previousPreferenceFile = new File(System.getProperty("java.io.tmpdir"), //$NON-NLS-1$
|
|
| 572 |
// "org.txm.rcp.prefs"); //$NON-NLS-1$
|
|
| 573 |
//
|
|
| 574 |
// if (System.getProperty("os.name").indexOf("Mac") >= 0) { //$NON-NLS-1$ //$NON-NLS-2$
|
|
| 575 |
// previousPreferenceFile = new File("/tmp/org.txm.rcp.prefs"); //$NON-NLS-1$
|
|
| 576 |
// }
|
|
| 577 |
//
|
|
| 578 |
// if (previousPreferenceFile.exists()) {
|
|
| 579 |
// System.out.println("Restoring preferences (from "+previousPreferenceFile+").");
|
|
| 580 |
// Properties previousProperties = new Properties();
|
|
| 581 |
// BufferedReader reader = IOUtils.getReader(previousPreferenceFile, "ISO-8859-1");
|
|
| 582 |
// previousProperties.load(reader);
|
|
| 583 |
// String [] keys= {TBXPreferences.TREETAGGER_INSTALL_PATH,
|
|
| 584 |
// TBXPreferences.TREETAGGER_MODELS_PATH,
|
|
| 585 |
// TBXPreferences.TREETAGGER_APOSTROPHE,
|
|
| 586 |
// TBXPreferences.TREETAGGER_OPTIONS};
|
|
| 587 |
// for (String k : keys) {
|
|
| 588 |
// if (previousProperties.getProperty(k) != null) {
|
|
| 589 |
// TxmPreferences.set(k, previousProperties.getProperty(k));
|
|
| 590 |
// }
|
|
| 591 |
// }
|
|
| 592 |
// }
|
|
| 593 | 593 |
|
| 594 | 594 |
installPreferenceRestored = true; |
| 595 |
|
|
| 595 |
|
|
| 596 | 596 |
if (installDirectory == null || !installDirectory.exists()) {
|
| 597 | 597 |
Log.severe("Error: The provided install directory does not exists. Aborting.");
|
| 598 | 598 |
return false; |
| 599 | 599 |
} |
| 600 |
|
|
| 600 |
|
|
| 601 | 601 |
TXMPreferences.put(TBXPreferences.PREFERENCES_NODE, TBXPreferences.INSTALL_DIR, installDirectory.getAbsolutePath()); |
| 602 |
|
|
| 602 |
TXMPreferences.saveAll(); |
|
| 603 | 603 |
return true; |
| 604 | 604 |
} |
| 605 | 605 |
} catch (Exception e) {
|
| ... | ... | |
| 682 | 682 |
Log.addHandler(severeDialobBoxHandler); |
| 683 | 683 |
severeDialobBoxHandler.setLevel(Level.SEVERE); |
| 684 | 684 |
} |
| 685 |
|
|
| 685 |
|
|
| 686 | 686 |
private boolean checkTXMHOME(JobHandler jobHandler, IProgressMonitor monitor) {
|
| 687 | 687 |
txmhomedir = null; |
| 688 | 688 |
installDirectory = null; |
| 689 |
|
|
| 689 |
|
|
| 690 | 690 |
// check if TXMHOME of the user is set and exists |
| 691 | 691 |
needToRestoreTXMHOME = testTXMHOMEPreferenceAndDirectory(); |
| 692 |
|
|
| 692 |
|
|
| 693 | 693 |
if (needToRestoreTXMHOME || installPreferenceRestored) {
|
| 694 |
|
|
| 694 |
|
|
| 695 | 695 |
System.out.println(TXMUIMessages.ApplicationWorkbenchAdvisor_7); |
| 696 | 696 |
|
| 697 | 697 |
try {
|
| ... | ... | |
| 700 | 700 |
Log.info("Checking TXM user directory.");
|
| 701 | 701 |
if (TXMPreferences.getString(TBXPreferences.USER_TXM_HOME, TBXPreferences.PREFERENCES_NODE).trim().isEmpty()) {
|
| 702 | 702 |
Version v = BundleUtils.getBundleVersion("org.txm.rcp");
|
| 703 |
|
|
| 703 |
|
|
| 704 | 704 |
String version = v.getMajor()+"."+v.getMinor()+"."+v.getMicro(); |
| 705 | 705 |
if ("qualifier".equals(v.getQualifier())) {
|
| 706 | 706 |
System.out.println("RUNNING TXM FROM ECLIPSE - DEV MODE ACTIVATED");
|
| ... | ... | |
| 710 | 710 |
} else {
|
| 711 | 711 |
txmhomedir = new File(TXMPreferences.getString(TBXPreferences.USER_TXM_HOME, TBXPreferences.PREFERENCES_NODE).trim()); |
| 712 | 712 |
} |
| 713 |
|
|
| 713 |
|
|
| 714 | 714 |
txmhomedir.mkdirs(); // creates the directory if needed |
| 715 |
|
|
| 715 |
|
|
| 716 | 716 |
if (!txmhomedir.exists()) {
|
| 717 | 717 |
Log.severe("Error: The provided TXMHOME directory does not exists: "+txmhomedir+". Aborting");
|
| 718 | 718 |
return false; |
| 719 | 719 |
} |
| 720 |
|
|
| 720 |
|
|
| 721 | 721 |
// save preference if USER_TXM_HOME has changed |
| 722 | 722 |
TXMPreferences.put(TBXPreferences.PREFERENCES_NODE, |
| 723 |
TBXPreferences.USER_TXM_HOME, txmhomedir.getAbsolutePath());
|
|
| 724 |
|
|
| 725 |
|
|
| 723 |
TBXPreferences.USER_TXM_HOME, txmhomedir.getAbsolutePath()); |
|
| 724 |
TXMPreferences.saveAll(); |
|
| 725 |
|
|
| 726 | 726 |
Log.info("TXM User directory is set to: "+txmhomedir);
|
| 727 |
|
|
| 727 |
|
|
| 728 | 728 |
txmHomeRestored = true; |
| 729 | 729 |
} catch (Exception e) {
|
| 730 | 730 |
org.txm.rcp.utils.Logger.printStackTrace(e); |
| ... | ... | |
| 734 | 734 |
} |
| 735 | 735 |
|
| 736 | 736 |
|
| 737 |
|
|
| 738 | 737 |
|
| 739 |
|
|
| 738 |
|
|
| 739 |
|
|
| 740 | 740 |
} // end if |
| 741 |
|
|
| 741 |
|
|
| 742 | 742 |
return true; |
| 743 | 743 |
} |
| 744 | 744 |
|
| 745 | 745 |
private void createBackUpDirectory(IProgressMonitor monitor) {
|
| 746 |
|
|
| 746 |
|
|
| 747 | 747 |
backup = new File(txmhomedir, "corpus-backup"); //$NON-NLS-1$ |
| 748 | 748 |
oldbackup = new File(txmhomedir, "corpus-backup-old"); //$NON-NLS-1$ |
| 749 | 749 |
errorbackup = new File(txmhomedir, "corpus-backup-error"); //$NON-NLS-1$ |
| 750 |
|
|
| 750 |
|
|
| 751 | 751 |
corporaDir = new File(txmhomedir, "corpora"); //$NON-NLS-1$ |
| 752 |
|
|
| 752 |
|
|
| 753 | 753 |
File[] corporaDirFiles = corporaDir.listFiles(); |
| 754 | 754 |
if (corporaDir.exists() && corporaDirFiles != null && corporaDirFiles.length > 0) { // if the txmhomedir is not empty, try to restore its content
|
| 755 | 755 |
Display.getDefault().syncExec(new Runnable() {
|
| ... | ... | |
| 813 | 813 |
private void reloadCorporaFromBackUpDirectory(IProgressMonitor monitor) {
|
| 814 | 814 |
ArrayList<String> basenames = new ArrayList<String>(); |
| 815 | 815 |
ArrayList<String> sampleCorpusLoaded = new ArrayList<String>(); |
| 816 |
|
|
| 816 |
|
|
| 817 | 817 |
String installdirpath = TXMPreferences.getString(TBXPreferences.INSTALL_DIR, TBXPreferences.PREFERENCES_NODE); |
| 818 | 818 |
File sampleCorporaDirectory = new File(installdirpath, "samples"); |
| 819 | 819 |
// load corpora from the install directory |
| ... | ... | |
| 962 | 962 |
* Called just after Toolbox is initialized |
| 963 | 963 |
*/ |
| 964 | 964 |
private void callStartScript() {
|
| 965 |
File startupScript = new File(TXMPreferences.getString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.USER_TXM_HOME), "scripts/user/start.groovy");
|
|
| 966 |
if (startupScript.exists() && startupScript.canRead()) {
|
|
| 967 |
try {
|
|
| 965 |
try {
|
|
| 966 |
File startupScript = new File(TXMPreferences.getString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.USER_TXM_HOME), "scripts/user/start.groovy");
|
|
| 967 |
if (startupScript.exists() && startupScript.canRead()) {
|
|
| 968 | 968 |
ExecuteGroovyScript.executeScript(startupScript.getAbsolutePath(), null, null, true); |
| 969 |
} catch(Exception e) {
|
|
| 970 |
System.out.println("Fail to execute 'start.groovy' script: "+e);
|
|
| 971 |
Log.printStackTrace(e); |
|
| 972 | 969 |
} |
| 970 |
} catch(Exception e) {
|
|
| 971 |
System.out.println("Fail to execute 'start.groovy' script: "+e);
|
|
| 972 |
Log.printStackTrace(e); |
|
| 973 | 973 |
} |
| 974 | 974 |
} |
| 975 | 975 |
|
| ... | ... | |
| 977 | 977 |
* Called just after Toolbox is stop call |
| 978 | 978 |
*/ |
| 979 | 979 |
private void callStopScript() {
|
| 980 |
File stopScript = new File(TXMPreferences.getString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.USER_TXM_HOME), "scripts/user/stop.groovy"); |
|
| 981 |
if (stopScript.exists() && stopScript.canRead()) {
|
|
| 982 |
try {
|
|
| 980 |
try {
|
|
| 981 |
File stopScript = new File(TXMPreferences.getString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.USER_TXM_HOME), "scripts/user/stop.groovy"); |
|
| 982 |
if (stopScript.exists() && stopScript.canRead()) {
|
|
| 983 |
|
|
| 983 | 984 |
ExecuteGroovyScript.executeScript(stopScript.getAbsolutePath(), null, null, true); |
| 984 |
} catch(Exception e) {
|
|
| 985 |
System.out.println("Fail to execute 'stop.groovy' script: "+e);
|
|
| 986 |
Log.printStackTrace(e); |
|
| 987 | 985 |
} |
| 986 |
} catch(Exception e) {
|
|
| 987 |
System.out.println("Fail to execute 'stop.groovy' script: "+e);
|
|
| 988 |
Log.printStackTrace(e); |
|
| 988 | 989 |
} |
| 989 | 990 |
} |
| 990 | 991 |
|
| ... | ... | |
| 996 | 997 |
*/ |
| 997 | 998 |
// FIXME: see if this code is still useful => if yes, split it and move it to org.txm.treetagger.core for the test and org.txm.treetagger.rcp for the UI alert |
| 998 | 999 |
// FIXME: put it in an activator if needed |
| 999 |
// private boolean checkTreeTagger(JobHandler job) {
|
|
| 1000 |
// try {
|
|
| 1001 |
// // check TreeTagger installation |
|
| 1002 |
// String ttDir = TxmPreferences.get(TBXPreferences.TREETAGGER_INSTALL_PATH); |
|
| 1003 |
// String ttModelsDir = TxmPreferences.get(TBXPreferences.TREETAGGER_MODELS_PATH); |
|
| 1004 |
// boolean showTTHelp = false; |
|
| 1005 |
// |
|
| 1006 |
// if (ttDir != null || ttModelsDir != null) {
|
|
| 1007 |
// if (!(new File(ttDir).exists() && new File(ttModelsDir).exists())) {
|
|
| 1008 |
// System.err.println(TXMUIMessages.ApplicationWorkbenchAdvisor_32); |
|
| 1009 |
// showTTHelp = true; |
|
| 1010 |
// } |
|
| 1011 |
// } |
|
| 1012 |
// else {
|
|
| 1013 |
// System.err.println(TXMUIMessages.ApplicationWorkbenchAdvisor_33); |
|
| 1014 |
// showTTHelp = true; |
|
| 1015 |
// } |
|
| 1016 |
// |
|
| 1017 |
// if (showTTHelp) {
|
|
| 1018 |
// job.syncExec(new Runnable() {
|
|
| 1019 |
// @Override |
|
| 1020 |
// public void run() {
|
|
| 1021 |
// String lang = TxmPreferences.get(RCPPreferences.UI_LOCALE); |
|
| 1022 |
// if (lang == null) {
|
|
| 1023 |
// lang = Locale.getDefault().getCountry().toLowerCase(); |
|
| 1024 |
// if (lang.equals("fr") || lang.equals("en")) { //$NON-NLS-1$ //$NON-NLS-2$
|
|
| 1025 |
// TxmPreferences.set(RCPPreferences.UI_LOCALE, lang); |
|
| 1026 |
// } |
|
| 1027 |
// } |
|
| 1028 |
// if (TxmPreferences.get(RCPPreferences.UI_LOCALE) != null && !TxmPreferences.get(RCPPreferences.UI_LOCALE).equals("")) { //$NON-NLS-1$
|
|
| 1029 |
// OpenBrowser.openfile("http://txm.sourceforge.net/installtreetagger_" + TxmPreferences.get(RCPPreferences.UI_LOCALE) + ".html"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
| 1030 |
// } |
|
| 1031 |
// else {
|
|
| 1032 |
// OpenBrowser.openfile("http://txm.sourceforge.net/installtreetagger_en.html"); //$NON-NLS-1$
|
|
| 1033 |
// } |
|
| 1034 |
// } |
|
| 1035 |
// }); |
|
| 1036 |
// } |
|
| 1037 |
// } catch (Exception e) {
|
|
| 1038 |
// Log.severe(NLS.bind(TXMUIMessages.ApplicationWorkbenchAdvisor_19, e)); |
|
| 1039 |
// Log.printStackTrace(e); |
|
| 1040 |
// return false; |
|
| 1041 |
// } |
|
| 1042 |
// return true; |
|
| 1043 |
// } |
|
| 1000 |
// private boolean checkTreeTagger(JobHandler job) {
|
|
| 1001 |
// try {
|
|
| 1002 |
// // check TreeTagger installation
|
|
| 1003 |
// String ttDir = TxmPreferences.get(TBXPreferences.TREETAGGER_INSTALL_PATH);
|
|
| 1004 |
// String ttModelsDir = TxmPreferences.get(TBXPreferences.TREETAGGER_MODELS_PATH);
|
|
| 1005 |
// boolean showTTHelp = false;
|
|
| 1006 |
//
|
|
| 1007 |
// if (ttDir != null || ttModelsDir != null) {
|
|
| 1008 |
// if (!(new File(ttDir).exists() && new File(ttModelsDir).exists())) {
|
|
| 1009 |
// System.err.println(TXMUIMessages.ApplicationWorkbenchAdvisor_32);
|
|
| 1010 |
// showTTHelp = true;
|
|
| 1011 |
// }
|
|
| 1012 |
// }
|
|
| 1013 |
// else {
|
|
| 1014 |
// System.err.println(TXMUIMessages.ApplicationWorkbenchAdvisor_33);
|
|
| 1015 |
// showTTHelp = true;
|
|
| 1016 |
// }
|
|
| 1017 |
//
|
|
| 1018 |
// if (showTTHelp) {
|
|
| 1019 |
// job.syncExec(new Runnable() {
|
|
| 1020 |
// @Override
|
|
| 1021 |
// public void run() {
|
|
| 1022 |
// String lang = TxmPreferences.get(RCPPreferences.UI_LOCALE);
|
|
| 1023 |
// if (lang == null) {
|
|
| 1024 |
// lang = Locale.getDefault().getCountry().toLowerCase();
|
|
| 1025 |
// if (lang.equals("fr") || lang.equals("en")) { //$NON-NLS-1$ //$NON-NLS-2$
|
|
| 1026 |
// TxmPreferences.set(RCPPreferences.UI_LOCALE, lang);
|
|
| 1027 |
// }
|
|
| 1028 |
// }
|
|
| 1029 |
// if (TxmPreferences.get(RCPPreferences.UI_LOCALE) != null && !TxmPreferences.get(RCPPreferences.UI_LOCALE).equals("")) { //$NON-NLS-1$
|
|
| 1030 |
// OpenBrowser.openfile("http://txm.sourceforge.net/installtreetagger_" + TxmPreferences.get(RCPPreferences.UI_LOCALE) + ".html"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
| 1031 |
// }
|
|
| 1032 |
// else {
|
|
| 1033 |
// OpenBrowser.openfile("http://txm.sourceforge.net/installtreetagger_en.html"); //$NON-NLS-1$
|
|
| 1034 |
// }
|
|
| 1035 |
// }
|
|
| 1036 |
// });
|
|
| 1037 |
// }
|
|
| 1038 |
// } catch (Exception e) {
|
|
| 1039 |
// Log.severe(NLS.bind(TXMUIMessages.ApplicationWorkbenchAdvisor_19, e));
|
|
| 1040 |
// Log.printStackTrace(e);
|
|
| 1041 |
// return false;
|
|
| 1042 |
// }
|
|
| 1043 |
// return true;
|
|
| 1044 |
// }
|
|
| 1044 | 1045 |
|
| 1045 | 1046 |
/** |
| 1046 | 1047 |
* after TXMHOME AND INSTALLDIR are ok, we start launch the Toolbox after |
| ... | ... | |
| 1067 | 1068 |
|
| 1068 | 1069 |
@Override |
| 1069 | 1070 |
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
| 1070 |
|
|
| 1071 |
|
|
| 1071 | 1072 |
if (!Toolbox.isInitialized()) {
|
| 1072 | 1073 |
try {
|
| 1073 | 1074 |
monitor.worked(1); |
| ... | ... | |
| 1091 | 1092 |
monitor.done(); |
| 1092 | 1093 |
} |
| 1093 | 1094 |
}); |
| 1094 |
|
|
| 1095 |
|
|
| 1095 | 1096 |
Log.warning(TXMUIMessages.ApplicationWorkbenchAdvisor_88); |
| 1096 | 1097 |
RestartTXM.reloadViews(); // reload views |
| 1097 |
|
|
| 1098 |
|
|
| 1098 | 1099 |
if (Toolbox.isInitialized()) {
|
| 1099 | 1100 |
StatusLine.setMessage(TXMUIMessages.ApplicationWorkbenchAdvisor_ready); |
| 1100 | 1101 |
} else {
|
| 1101 | 1102 |
StatusLine.setMessage(TXMUIMessages.ApplicationWorkbenchAdvisor_init_failed); |
| 1102 | 1103 |
} |
| 1103 |
|
|
| 1104 |
|
|
| 1104 | 1105 |
setDefaultTheme(); |
| 1105 |
|
|
| 1106 |
|
|
| 1106 | 1107 |
// CLOSE Empty&Error editors |
| 1107 | 1108 |
closeEmptyEditors(); |
| 1108 |
|
|
| 1109 |
|
|
| 1109 | 1110 |
// remove some preference pages |
| 1110 | 1111 |
setPreferencesConfiguration(); |
| 1111 |
|
|
| 1112 |
|
|
| 1112 | 1113 |
} |
| 1113 | 1114 |
catch(Exception e) {
|
| 1114 | 1115 |
System.out.println("Error during UI initialization: "+e.getLocalizedMessage());
|
| tmp/org.txm.rcp/plugin.xml (revision 917) | ||
|---|---|---|
| 76 | 76 |
id="org.txm.rcp.views.corpora.CorporaView" |
| 77 | 77 |
ratio="0.5" |
| 78 | 78 |
relationship="right" |
| 79 |
relative="org.eclipse.ui.views.TaskList"/> |
|
| 79 |
relative="org.eclipse.ui.views.TaskList" |
|
| 80 |
showTitle="true"/> |
|
| 80 | 81 |
<view |
| 81 | 82 |
closeable="true" |
| 82 | 83 |
id="org.eclipse.ui.views.ProgressView" |
| ... | ... | |
| 1470 | 1471 |
icon="icons/functions/open.png" |
| 1471 | 1472 |
label="%command.label.45" |
| 1472 | 1473 |
style="push"> |
| 1473 |
<parameter |
|
| 1474 |
name="org.txm.rcp.commands.commandParameter2" |
|
| 1475 |
value=" "> |
|
| 1476 |
</parameter> |
|
| 1477 | 1474 |
</command> |
| 1478 | 1475 |
<command |
| 1479 | 1476 |
commandId="org.eclipse.ui.file.save" |
| tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/handlers/OpenJFCChartPropertiesEditor.java (revision 917) | ||
|---|---|---|
| 20 | 20 |
*/ |
| 21 | 21 |
public class OpenJFCChartPropertiesEditor extends AbstractHandler {
|
| 22 | 22 |
|
| 23 |
static {
|
|
| 24 |
System.out.println("OpenJFCChartPropertiesEditor.enclosing_method() setting System L&F. ");
|
|
| 25 |
try {
|
|
| 26 |
// Set System L&F |
|
| 27 |
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); |
|
| 28 |
} |
|
| 29 |
catch(UnsupportedLookAndFeelException e) {
|
|
| 30 |
// handle exception |
|
| 31 |
} |
|
| 32 |
catch(ClassNotFoundException e) {
|
|
| 33 |
// handle exception |
|
| 34 |
} |
|
| 35 |
catch(InstantiationException e) {
|
|
| 36 |
// handle exception |
|
| 37 |
} |
|
| 38 |
catch(IllegalAccessException e) {
|
|
| 39 |
// handle exception |
|
| 40 |
} |
|
| 41 |
} |
|
| 23 |
// static {
|
|
| 24 |
// System.out.println("OpenJFCChartPropertiesEditor.enclosing_method() setting System L&F. ");
|
|
| 25 |
// try {
|
|
| 26 |
// // Set System L&F
|
|
| 27 |
// UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
|
| 28 |
// }
|
|
| 29 |
// catch(UnsupportedLookAndFeelException e) {
|
|
| 30 |
// // handle exception
|
|
| 31 |
// }
|
|
| 32 |
// catch(ClassNotFoundException e) {
|
|
| 33 |
// // handle exception
|
|
| 34 |
// }
|
|
| 35 |
// catch(InstantiationException e) {
|
|
| 36 |
// // handle exception
|
|
| 37 |
// }
|
|
| 38 |
// catch(IllegalAccessException e) {
|
|
| 39 |
// // handle exception
|
|
| 40 |
// }
|
|
| 41 |
// }
|
|
| 42 | 42 |
|
| 43 | 43 |
@Override |
| 44 | 44 |
public Object execute(ExecutionEvent event) throws ExecutionException {
|
| tmp/org.txm.rcp.feature/feature.xml (revision 917) | ||
|---|---|---|
| 284 | 284 |
<import plugin="org.txm.libs.cqp" version="1.0.0" match="greaterOrEqual"/> |
| 285 | 285 |
<import plugin="org.txm.statsengine.core" version="1.0.0" match="greaterOrEqual"/> |
| 286 | 286 |
<import plugin="org.txm.libs.rserve"/> |
| 287 |
<import plugin="org.eclipse.ui.themes" version="1.2.1" match="greaterOrEqual"/> |
|
| 287 | 288 |
</requires> |
| 288 | 289 |
|
| 289 | 290 |
<plugin |
| tmp/org.txm.annotation.core/plugin.xml (revision 917) | ||
|---|---|---|
| 13 | 13 |
<EngineManager |
| 14 | 14 |
class="org.txm.annotation.core.AnnotationEnginesManager" |
| 15 | 15 |
description="Annotation engines manager" |
| 16 |
name="org.txm.annotation.core.AnnotationEnginesManager">
|
|
| 16 |
name="Annotation">
|
|
| 17 | 17 |
</EngineManager> |
| 18 | 18 |
</extension> |
| 19 | 19 |
|
Formats disponibles : Unified diff