+ // Handle Events
+ class SelectionChangedListener implements ISelectionChangedListener {
+ public void selectionChanged(SelectionChangedEvent evt) {
+
+ IStructuredSelection curSelection = (IStructuredSelection) evt
+ .getSelection();
+ Object obj = curSelection.getFirstElement();
+
+ if (obj instanceof RealizedFlow) {
+ RealizedFlow rf = (RealizedFlow) obj;
+
+ IWorkbench iw = ClientUiPlugin.getDefault().getWorkbench();
+ IHandlerService handlerService = (IHandlerService) iw
+ .getService(IHandlerService.class);
+
+ // TODO :
+ // WARNING :
+ // when marshalling an ExecutionFlowDescriptor, the Execution
+ // Spec is set correctly,
+ // but
+ // when marshalling directly a realized flow, paramters are
+ // stored under ExecutionFlowDescriptor.values
+ String result = oxmBean.marshal(rf);
+
+ // Passing parameters to the command
+ try {
+ // get the command from plugin.xml
+ IWorkbenchWindow window = iw.getActiveWorkbenchWindow();
+ ICommandService cmdService = (ICommandService) window
+ .getService(ICommandService.class);
+ Command cmd = cmdService
+ .getCommand("org.argeo.slc.client.ui.editRealizedFlowDetails");
+
+ ArrayList<Parameterization> parameters = new ArrayList<Parameterization>();
+
+ IParameter iparam;
+ Parameterization params;
+
+ // The current index to be able to records changes on
+ // parameters
+ iparam = cmd
+ .getParameter("org.argeo.slc.client.commands.realizedFlowIndex");
+ params = new Parameterization(iparam, (new Integer(
+ realizedFlows.indexOf(rf))).toString());
+
+ parameters.add(params);
+
+ // The current Realized flow marshalled as XML
+ // See warning above
+ iparam = cmd
+ .getParameter("org.argeo.slc.client.commands.realizedFlowAsXml");
+ params = new Parameterization(iparam, result);
+ parameters.add(params);
+
+ // build the parameterized command
+ ParameterizedCommand pc = new ParameterizedCommand(cmd,
+ parameters.toArray(new Parameterization[parameters
+ .size()]));
+
+ // execute the command
+ handlerService = (IHandlerService) window
+ .getService(IHandlerService.class);
+ handlerService.executeCommand(pc, null);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new SlcException("Problem while rendering result. "
+ + e.getMessage());
+ }
+ }
+ }
+ }
+
+ // Implementation of the Drop Listener