]> git.argeo.org Git - gpl/argeo-slc.git/blob - eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/EditRealizedFlowDetailsHandler.java
a21ac37a3c97a46c61310e8089b03163cb8a88d7
[gpl/argeo-slc.git] / eclipse / plugins / org.argeo.slc.client.ui / src / org / argeo / slc / client / ui / commands / EditRealizedFlowDetailsHandler.java
1 package org.argeo.slc.client.ui.commands;
2
3 import org.argeo.slc.client.oxm.OxmInterface;
4 import org.argeo.slc.client.ui.views.ProcessParametersView;
5 import org.argeo.slc.process.RealizedFlow;
6 import org.eclipse.core.commands.AbstractHandler;
7 import org.eclipse.core.commands.ExecutionEvent;
8 import org.eclipse.core.commands.ExecutionException;
9 import org.eclipse.ui.handlers.HandlerUtil;
10
11 /**
12 * Command handler to display and edit the attributes of a given Realizedflow.
13 * The corresponding RealizedFlow is passed via command parameters and
14 * unmarshalled with the oxmBean which is injected by Spring.
15 *
16 * @author bsinou
17 *
18 */
19
20 public class EditRealizedFlowDetailsHandler extends AbstractHandler {
21
22 // IoC
23 private OxmInterface oxmBean;
24
25 public Object execute(ExecutionEvent event) throws ExecutionException {
26 // We pass Realized flow through command parameters as XML
27 String rfAsXml = event
28 .getParameter("org.argeo.slc.client.commands.realizedFlowAsXml");
29 int index = new Integer(
30 event.getParameter("org.argeo.slc.client.commands.realizedFlowIndex"))
31 .intValue();
32 RealizedFlow rf = (RealizedFlow) oxmBean.unmarshal(rfAsXml);
33
34 try {
35 ProcessParametersView ppView = (ProcessParametersView) HandlerUtil
36 .getActiveWorkbenchWindow(event).getActivePage()
37 .showView(ProcessParametersView.ID);
38 ppView.setRealizedFlow(index, rf);
39 } catch (Exception e) {
40 e.printStackTrace();
41 }
42 return null;
43 }
44
45 // IoC
46 public void setOxmBean(OxmInterface oxmBean) {
47 this.oxmBean = oxmBean;
48 }
49
50 }