311 |
311 |
return this.getEditorInput().getResult().getStringParameterValue(key);
|
312 |
312 |
}
|
313 |
313 |
|
|
314 |
//// TODO commented for now ?
|
|
315 |
// /**
|
|
316 |
// * Computes the result stored in the specified editor input and opens an editor specified by its id.
|
|
317 |
// * @param editorInput
|
|
318 |
// * @param editorPartId
|
|
319 |
// * @return
|
|
320 |
// */
|
|
321 |
// public static void openEditor(TXMResultEditorInput editorInput, String editorPartId) {
|
|
322 |
// compute(editorInput, editorPartId, false, null);
|
|
323 |
// }
|
314 |
324 |
|
315 |
325 |
/**
|
316 |
|
* Computes the result stored in the specified editor input and opens an editor specified by its id.
|
317 |
|
* @param editorInput
|
318 |
|
* @param editorPartId
|
319 |
|
* @return
|
320 |
|
*/
|
321 |
|
public static void openEditor(TXMResultEditorInput editorInput, String editorPartId) {
|
322 |
|
compute(editorInput, editorPartId, false, null);
|
323 |
|
}
|
324 |
|
|
325 |
|
/**
|
326 |
326 |
* Computes specified result stored, creates an editor input and opens an editor specified by its id.
|
|
327 |
*
|
|
328 |
* Always creates an editor
|
|
329 |
*
|
327 |
330 |
* @param result
|
328 |
331 |
* @param editorPartId
|
329 |
332 |
* @return
|
330 |
333 |
*/
|
331 |
334 |
public static void openEditor(TXMResult result, String editorPartId) {
|
332 |
|
openEditor(new TXMResultEditorInput(result), editorPartId);
|
|
335 |
//openEditor(new TXMResultEditorInput(result), editorPartId);
|
|
336 |
compute(new TXMResultEditorInput(result), editorPartId, false, null);
|
333 |
337 |
}
|
334 |
338 |
|
335 |
|
|
336 |
|
|
|
339 |
/**
|
|
340 |
* Computes the TXMResult If all necessary parameters are set AND refresh the editor UI
|
|
341 |
*
|
|
342 |
* @param update transfered to the TXMResult.compute method
|
|
343 |
*/
|
337 |
344 |
public final void compute(boolean update) {
|
338 |
|
compute(update, this);
|
|
345 |
compute(this.getEditorInput(), null, update, this);
|
339 |
346 |
}
|
340 |
347 |
|
341 |
|
|
342 |
|
public static void compute(final boolean update, final TXMEditorPart editor) {
|
343 |
|
compute(editor.getEditorInput(), null, update, editor);
|
344 |
|
}
|
345 |
|
|
346 |
348 |
/**
|
|
349 |
* Internal method to mutualize compute editor creation
|
347 |
350 |
*
|
348 |
351 |
* @param result
|
349 |
352 |
* @param update
|
... | ... | |
352 |
355 |
* @param resetView
|
353 |
356 |
* @param clearChartItemsSelection
|
354 |
357 |
*/
|
355 |
|
public static void compute(final TXMResultEditorInput editorInput, final String editorId, final boolean update, final TXMEditorPart editor) {
|
|
358 |
protected static void compute(final TXMResultEditorInput editorInput, final String editorId, final boolean update, final TXMEditorPart editor) {
|
356 |
359 |
|
357 |
360 |
StatusLine.setMessage("Computing " + editorInput.getResult().getName());
|
358 |
361 |
|
... | ... | |
370 |
373 |
|
371 |
374 |
|
372 |
375 |
currentEditor = editor;
|
373 |
|
|
374 |
|
// transfer editor parameters to result
|
375 |
|
// if (currentEditor != null) {
|
376 |
|
// currentEditor.updateResultFromEditor();
|
377 |
|
// }
|
378 |
|
|
379 |
|
|
|
376 |
|
380 |
377 |
// computing result
|
381 |
378 |
monitor.beginTask("Computing", 100);
|
382 |
379 |
|
383 |
|
editorInput.getResult().compute(update, monitor);
|
|
380 |
editorInput.getResult().compute(update, monitor); // always open the editor
|
384 |
381 |
|
385 |
|
// if (!editorInput.getResult().compute(update, monitor)) {
|
386 |
|
// return Status.CANCEL_STATUS;
|
387 |
|
// }
|
388 |
|
|
389 |
382 |
monitor.worked(50);
|
390 |
383 |
|
391 |
384 |
// opening an editor if not exists
|
392 |
|
if (currentEditor == null) {
|
|
385 |
if (currentEditor == null && editorId != null) {
|
393 |
386 |
this.syncExec(new Runnable() {
|
394 |
387 |
@Override
|
395 |
388 |
public void run() {
|
... | ... | |
397 |
390 |
|
398 |
391 |
Log.info("TXMEditorPart.compute(): opening editor with id " + editorId);
|
399 |
392 |
|
400 |
|
IWorkbenchWindow window =TXMWindows.getActiveWindow();
|
|
393 |
IWorkbenchWindow window = TXMWindows.getActiveWindow();
|
401 |
394 |
IWorkbenchPage page = window.getActivePage();
|
402 |
395 |
currentEditor = (TXMEditorPart) page.openEditor(editorInput, editorId, true, IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID);
|
403 |
396 |
} catch (Exception e) {
|
... | ... | |
408 |
401 |
});
|
409 |
402 |
}
|
410 |
403 |
|
411 |
|
|
412 |
404 |
// refreshing the UI
|
413 |
405 |
if (currentEditor != null) {
|
414 |
406 |
this.syncExec(new Runnable() {
|
... | ... | |
434 |
426 |
}
|
435 |
427 |
return Status.OK_STATUS;
|
436 |
428 |
}
|
437 |
|
|
438 |
429 |
};
|
439 |
430 |
job.setPriority(Job.DECORATE);
|
440 |
431 |
job.setUser(false);
|