| 1024 |
1024 |
|
| 1025 |
1025 |
this.setDirty(false);
|
| 1026 |
1026 |
|
| 1027 |
|
|
| 1028 |
1027 |
// FIXME: update all open editors of the children result but also of the result itself
|
| 1029 |
1028 |
// FIXME: debug
|
| 1030 |
1029 |
Log.finest("TXMEditor.refresh(): " + this.getClass().getSimpleName() + ": synchronizing and refreshing result children opened editors."); //$NON-NLS-1$ //$NON-NLS-2$
|
| 1031 |
1030 |
|
| 1032 |
1031 |
List<TXMResult> results = this.getResult().getDeepChildren();
|
| 1033 |
|
//results.add(this.getResult());
|
| 1034 |
1032 |
|
| 1035 |
1033 |
|
| 1036 |
1034 |
for (int i = 0; i < results.size(); i++) {
|
| ... | ... | |
| 1060 |
1058 |
*/
|
| 1061 |
1059 |
public abstract void updateResultFromEditor();
|
| 1062 |
1060 |
|
| 1063 |
|
// FIXME: became useless?
|
| 1064 |
|
// /**
|
| 1065 |
|
// * UI safe
|
| 1066 |
|
// *
|
| 1067 |
|
// * Synchronizes the editor with the result.
|
| 1068 |
|
// * Dedicated to dynamically change the editor components from the stored result.
|
| 1069 |
|
// * <p>
|
| 1070 |
|
// * Use this method if you need to save parameter with Type not managed by the autoUpdateEditorFieldsFromResult method
|
| 1071 |
|
// * @throws Exception
|
| 1072 |
|
// */
|
| 1073 |
|
// public final void updateFromResult(final boolean update) throws Exception {
|
| 1074 |
|
// if (this.parent != null && !this.parent.isDisposed()) {
|
| 1075 |
|
// this.parent.getDisplay().syncExec(new Runnable() {
|
| 1076 |
|
//
|
| 1077 |
|
// @Override
|
| 1078 |
|
// public void run() {
|
| 1079 |
|
// try {
|
| 1080 |
|
// refresh(update);
|
| 1081 |
|
// } catch (Exception e) {
|
| 1082 |
|
// // TODO Auto-generated catch block
|
| 1083 |
|
// e.printStackTrace();
|
| 1084 |
|
// }
|
| 1085 |
|
// }
|
| 1086 |
|
// });
|
| 1087 |
|
// }
|
| 1088 |
|
// }
|
| 1089 |
|
|
| 1090 |
1061 |
/**
|
| 1091 |
1062 |
* Synchronizes the editor widgets with the result parameters.
|
| 1092 |
1063 |
* Dedicated to dynamically change the editor components from the stored result.
|
| ... | ... | |
| 1120 |
1091 |
|
| 1121 |
1092 |
for (Field f : fields) {
|
| 1122 |
1093 |
Parameter parameter = f.getAnnotation(Parameter.class);
|
| 1123 |
|
if (parameter == null
|
| 1124 |
|
|| parameter.key().isEmpty()
|
| 1125 |
|
|
| 1126 |
|
|
| 1127 |
|
|
| 1128 |
|
// FIXME: old version but doesn't not work with CA
|
| 1129 |
|
//|| !this.getResult().hasParameterChanged(parameter.key(), this.lastComputingParameters)
|
| 1130 |
|
// FIXME: new version
|
| 1131 |
|
//|| !this.getResult().hasParameterChanged(parameter.key())
|
| 1132 |
|
|
| 1133 |
|
|
| 1134 |
|
) {
|
|
1094 |
if (parameter == null || parameter.key().isEmpty()) {
|
| 1135 |
1095 |
continue;
|
| 1136 |
1096 |
}
|
| 1137 |
1097 |
|
| ... | ... | |
| 1141 |
1101 |
try {
|
| 1142 |
1102 |
f.setAccessible(true);
|
| 1143 |
1103 |
object = f.get(this);
|
| 1144 |
|
// if (object == null) {
|
| 1145 |
|
// continue; // widget not set
|
| 1146 |
|
// }
|
| 1147 |
|
value = this.getResult().getParameter(parameter.key(), true); // propagate to all parents
|
|
1104 |
|
|
1105 |
// propagate to all parents
|
|
1106 |
value = this.getResult().getParameter(parameter.key(), true);
|
| 1148 |
1107 |
|
| 1149 |
1108 |
if (value == null) {
|
| 1150 |
1109 |
//System.out.println("Warning: "+this.getPartName()+" result "+this.getResult()+" "+parameter.key()+" is not initialized.");
|
| ... | ... | |
| 1179 |
1138 |
}
|
| 1180 |
1139 |
else if(object instanceof Viewer) {
|
| 1181 |
1140 |
if(value != null) {
|
| 1182 |
|
// FIXME: fire a new selection changed event leading to a cyclic recursion...
|
| 1183 |
|
// FIXME: became useless? since there is now a test above on !this.getResult().hasParameterChanged(parameter.key(), this.lastComputingParameters)
|
|
1141 |
// FIXME: SJ: fire a new selection changed event leading to a cyclic recursion...
|
|
1142 |
// FIXME: SJ: became useless? since there is now a test above on !this.getResult().hasParameterChanged(parameter.key(), this.lastComputingParameters)
|
| 1184 |
1143 |
((Viewer)object).setData(BaseAbstractComputeListener.IGNORE_EVENT, true);
|
| 1185 |
1144 |
if (value instanceof StructuredSelection) { // no need to create a new StructuredSelection
|
| 1186 |
1145 |
((Viewer)object).setSelection((StructuredSelection)value, true);
|
| ... | ... | |
| 1231 |
1190 |
}
|
| 1232 |
1191 |
}
|
| 1233 |
1192 |
|
| 1234 |
|
// FIXME: debug
|
|
1193 |
// Log
|
| 1235 |
1194 |
if(object != null) {
|
| 1236 |
1195 |
String message = "TXMEditor.autoUpdateEditorFieldsFromResult(): " + this.getClass().getSimpleName() + ": setting editor parameter " + parameter.key() + " = " + value; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
| 1237 |
1196 |
if(value != null) {
|
| ... | ... | |
| 1240 |
1199 |
Log.finest(message);
|
| 1241 |
1200 |
}
|
| 1242 |
1201 |
|
| 1243 |
|
// FIXME: need to extend this list of managed Widgets
|
|
1202 |
// FIXME: SJ: need to extend this list of managed Widgets if needed
|
| 1244 |
1203 |
}
|
| 1245 |
1204 |
catch (Exception e) {
|
| 1246 |
1205 |
// TODO Auto-generated catch block
|
| ... | ... | |
| 1251 |
1210 |
|
| 1252 |
1211 |
}
|
| 1253 |
1212 |
|
| 1254 |
|
// FIXME: Updating the compute button enabled/disabled state
|
|
1213 |
// FIXME: SJ: Updating the compute button enabled/disabled state
|
| 1255 |
1214 |
// the code below doesn't work as expected for text fields (as query field or other)
|
| 1256 |
1215 |
// try {
|
| 1257 |
1216 |
// this.topToolBar.getItem(0).setEnabled(this.getResult().canCompute());
|
| ... | ... | |
| 1347 |
1306 |
|
| 1348 |
1307 |
// FIXME: need to extend this list of managed Widgets if needed
|
| 1349 |
1308 |
|
| 1350 |
|
this.getResult().setParameter(parameter.key(), value, true); // propagate to all parents
|
|
1309 |
// propagate to all parents
|
|
1310 |
this.getResult().setParameter(parameter.key(), value, true);
|
| 1351 |
1311 |
}
|
| 1352 |
1312 |
catch (IllegalArgumentException e) {
|
| 1353 |
|
// TODO Auto-generated catch block
|
| 1354 |
1313 |
Log.severe("TXMEditor.autoUpdateResultFromEditorParameters(): Error with field " + parameter.key()); //$NON-NLS-1$
|
| 1355 |
1314 |
e.printStackTrace();
|
| 1356 |
1315 |
}
|
| ... | ... | |
| 1385 |
1344 |
|
| 1386 |
1345 |
|
| 1387 |
1346 |
/**
|
| 1388 |
|
* Deletes the linked TXM result.
|
| 1389 |
|
* @return
|
|
1347 |
* Deletes the TXM result.
|
|
1348 |
*
|
|
1349 |
* @return true if the deletion was successful otherwise false
|
| 1390 |
1350 |
*/
|
| 1391 |
1351 |
public boolean deleteResult() {
|
| 1392 |
1352 |
try {
|
| 1393 |
1353 |
return this.getEditorInput().deleteResult();
|
| 1394 |
|
} catch(Exception e) {
|
| 1395 |
|
System.out.println("Error: could not delete result: " + e.getLocalizedMessage()); //$NON-NLS-1$
|
|
1354 |
}
|
|
1355 |
catch(Exception e) {
|
|
1356 |
Log.severe(TXMCoreMessages.bind("** Could not delete result {0}.", this.getResult()));
|
| 1396 |
1357 |
Log.printStackTrace(e);
|
| 1397 |
1358 |
return false;
|
| 1398 |
1359 |
}
|
| ... | ... | |
| 1423 |
1384 |
|
| 1424 |
1385 |
|
| 1425 |
1386 |
/**
|
| 1426 |
|
* Creates and populates a popup menu with the specified id and attaches it to the specified composite.
|
|
1387 |
* Creates and populates a pop up menu with the specified id and attaches it to the specified composite.
|
| 1427 |
1388 |
* The menu will be accessible through the RCP extension in plugin.xml by its id, eg. "popup:" + menuId.
|
| 1428 |
1389 |
* @param composite
|
| 1429 |
1390 |
* @param menuId
|
| ... | ... | |
| 1434 |
1395 |
}
|
| 1435 |
1396 |
|
| 1436 |
1397 |
/**
|
| 1437 |
|
* Creates and populates a popup menu and attaches it to the specified composite.
|
|
1398 |
* Creates and populates a pop up menu and attaches it to the specified composite.
|
| 1438 |
1399 |
* The menu will be accessible through the RCP extension in plugin.xml by its id, eg. "popup:" + menuId.
|
| 1439 |
1400 |
*
|
| 1440 |
1401 |
* The menu ID will be the editor/workbench part ID.
|
| ... | ... | |
| 1449 |
1410 |
}
|
| 1450 |
1411 |
|
| 1451 |
1412 |
/**
|
| 1452 |
|
* Creates and populates a popup menu with the specified id and attaches it to the specified composite.
|
|
1413 |
* Creates and populates a pop up menu with the specified id and attaches it to the specified composite.
|
| 1453 |
1414 |
* The menu will be accessible through the RCP extension in plugin.xml by its id, eg. "popup:" + menuId.
|
| 1454 |
1415 |
* @param composite
|
| 1455 |
1416 |
* @param menuId
|
| ... | ... | |
| 1477 |
1438 |
}
|
| 1478 |
1439 |
|
| 1479 |
1440 |
/**
|
| 1480 |
|
* Gets the composite of the sub widgets of the Top toolbar.
|
|
1441 |
* Gets the composite of the sub widgets of the Top tool bar.
|
|
1442 |
*
|
| 1481 |
1443 |
* @return the composite that contains the <b>default Top</b> TXMEditorToolBar parameters panels
|
| 1482 |
1444 |
*/
|
| 1483 |
1445 |
public GLComposite getParametersGroupsComposite() {
|
| ... | ... | |
| 1486 |
1448 |
|
| 1487 |
1449 |
/**
|
| 1488 |
1450 |
* Packs the columns so the label of the sort column is not truncated due of the sorting order arrow display.
|
|
1451 |
*
|
| 1489 |
1452 |
* @param viewer
|
| 1490 |
1453 |
*/
|
| 1491 |
1454 |
public static void packColumns(TableViewer viewer) {
|
| ... | ... | |
| 1500 |
1463 |
|
| 1501 |
1464 |
/**
|
| 1502 |
1465 |
* Adds a mouse adapter to the specified table column that executes a command link specified by its id on double click event.
|
|
1466 |
*
|
| 1503 |
1467 |
* @param table
|
| 1504 |
1468 |
* @param column
|
| 1505 |
1469 |
* @param commandId
|
| ... | ... | |
| 1510 |
1474 |
|
| 1511 |
1475 |
/**
|
| 1512 |
1476 |
* Adds a mouse adapter to the specified table columns range that executes a command link specified by its id on double click event.
|
|
1477 |
*
|
| 1513 |
1478 |
* @param table
|
| 1514 |
1479 |
* @param startingColumn
|
| 1515 |
1480 |
* @param endingColumn
|