+ /**
+ * @param event
+ * @param postOperationEnabled
+ * @param selection
+ */
+ private void invokeOperation(ExecutionEvent event, IPostOperationEnabled postOperationEnabled, ISelection selection) {
+ if(selection instanceof IStructuredSelection){
+ Object element = ((IStructuredSelection) selection).getFirstElement();
+ if(element instanceof TreeNode){
+ element = ((TreeNode) element).getValue();
+ }
+ if(element instanceof SpecimenOrObservationBase<?>){
+ try {
+ AbstractPostOperation<?> operation = new AddDerivedUnitFacadeMediaOperation(event.getCommand().getName(),
+ BulkEditorUtil.getUndoContext(), (SpecimenOrObservationBase<?>)element, postOperationEnabled);
+ AbstractUtility.executeOperation(operation);
+ } catch (NotDefinedException e) {
+ MessagingUtils.warn(getClass(), "Command name not set.");
+ }
+ }
+ }
+ }
+