]> 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
f26e29f47d61883925b4ce4d41f5f5a971c8e24c
[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 *
13 * @author bsinou
14 *
15 * Command handler to display and edit the attributes of a given
16 * Realizedflow. The corresponding RealizedFlow is passed via command
17 * parameters and unmarshalled with the oxmBean which is injected by
18 * Spring.
19 *
20 * Note thet passing an index of -1 will cause the reset of the View
21 * (used among others when removing processes from the batch).
22 */
23
24 public class EditRealizedFlowDetailsHandler extends AbstractHandler {
25
26 // IoC
27 private OxmInterface oxmBean;
28
29 public Object execute(ExecutionEvent event) throws ExecutionException {
30 // We pass Realized flow through command parameters as XML
31 String rfAsXml = event
32 .getParameter("org.argeo.slc.client.commands.realizedFlowAsXml");
33 int index = new Integer(
34 event.getParameter("org.argeo.slc.client.commands.realizedFlowIndex"))
35 .intValue();
36 try {
37 ProcessParametersView ppView = (ProcessParametersView) HandlerUtil
38 .getActiveWorkbenchWindow(event).getActivePage()
39 .showView(ProcessParametersView.ID);
40
41 if (index == -1)
42 ppView.setRealizedFlow(-1, null);
43 else {
44 RealizedFlow rf = (RealizedFlow) oxmBean.unmarshal(rfAsXml);
45 ppView.setRealizedFlow(index, rf);
46
47 }
48 } catch (Exception e) {
49 e.printStackTrace();
50 }
51 return null;
52 }
53
54 // IoC
55 public void setOxmBean(OxmInterface oxmBean) {
56 this.oxmBean = oxmBean;
57 }
58
59 }