1 package org
.argeo
.slc
.client
.contentprovider
;
5 import org
.apache
.commons
.logging
.Log
;
6 import org
.apache
.commons
.logging
.LogFactory
;
7 import org
.argeo
.slc
.process
.RealizedFlow
;
8 import org
.argeo
.slc
.process
.SlcExecution
;
9 import org
.argeo
.slc
.process
.SlcExecutionStep
;
10 import org
.eclipse
.jface
.viewers
.ITreeContentProvider
;
11 import org
.eclipse
.jface
.viewers
.Viewer
;
14 * Basic tree view of the chosen process details. For now, only a basic list of
15 * details is displayed, not a tree.
17 public class ProcessDetailContentProvider
implements ITreeContentProvider
{
18 private final static Log log
= LogFactory
19 .getLog(ProcessDetailContentProvider
.class);
21 private SlcExecution slcExecution
;
23 // private List<SlcAgent> slcAgents;
25 public Object
[] getChildren(Object parent
) {
26 if (parent
instanceof SlcExecution
) {
27 slcExecution
= (SlcExecution
) parent
;
29 List
<SlcExecutionStep
> steps
= slcExecution
.getSteps();
30 List
<RealizedFlow
> realizedFlows
= slcExecution
.getRealizedFlows();
32 for (int i
= 0; i
< steps
.size(); i
++) {
33 log
.debug("step[" + i
+ "] : " + steps
.get(i
).getType());
35 for (int i
= 0; i
< realizedFlows
.size(); i
++) {
36 log
.debug("step[" + i
+ "] : "
37 + realizedFlows
.get(i
).toString());
40 log
.debug(" Realized flows : ");
41 return steps
.toArray();
43 // if (parent instanceof ExecutionModuleNode) {
44 // ExecutionModuleNode executionModuleNode = (ExecutionModuleNode)
46 // ExecutionModuleDescriptor emd =
47 // executionModuleNode.getDescriptor();
48 // emd = executionModuleNode.getAgentNode().getAgent()
49 // .getExecutionModuleDescriptor(emd.getName(),
51 // executionModuleNode.cacheDescriptor(emd);
52 // // for (String flowName :
53 // executionModuleNode.getFlowDescriptors()
55 // // executionModuleNode.addChild(new FlowNode(flowName,
56 // // executionModuleNode));
58 // return executionModuleNode.getChildren();
59 // } else if (parent instanceof AgentNode) {
60 // AgentNode agentNode = (AgentNode) parent;
62 // if (log.isTraceEnabled())
63 // log.trace("Scan agent " + agentNode);
65 // agentNode.clearChildren();
66 // for (ExecutionModuleDescriptor desc : agentNode.getAgent()
67 // .listExecutionModuleDescriptors()) {
68 // agentNode.addChild(new ExecutionModuleNode(agentNode, desc));
71 // return agentNode.getChildren();
72 // } else if (parent instanceof TreeParent) {
73 // return ((TreeParent) parent).getChildren();
74 // } else if (parent instanceof FlowNode) {
75 // return new Object[0];
77 // List<AgentNode> agentNodes = new ArrayList<AgentNode>();
78 // for (SlcAgent slcAgent : slcAgents) {
79 // agentNodes.add(new AgentNode(slcAgent));
81 // return agentNodes.toArray();
86 public Object
getParent(Object node
) {
87 // if (node instanceof TreeObject) {
88 // return ((TreeObject) node).getParent();
93 public boolean hasChildren(Object parent
) {
97 public void inputChanged(Viewer v
, Object oldInput
, Object newInput
) {
100 public void dispose() {
103 public Object
[] getElements(Object parent
) {
104 // return getChildren(parent);
105 // Here we must duplicate the code otherwise the inner call to method
106 // getChildren(parent); is not intercepted by AspectJ
107 if (parent
instanceof SlcExecution
) {
108 slcExecution
= (SlcExecution
) parent
;
110 List
<SlcExecutionStep
> steps
= slcExecution
.getSteps();
111 List
<RealizedFlow
> realizedFlows
= slcExecution
.getRealizedFlows();
113 for (int i
= 0; i
< steps
.size(); i
++) {
114 log
.debug("step[" + i
+ "] : " + steps
.get(i
).getType());
116 for (int i
= 0; i
< realizedFlows
.size(); i
++) {
117 log
.debug("step[" + i
+ "] : "
118 + realizedFlows
.get(i
).toString());
121 log
.debug(" Realized flows : ");
122 return steps
.toArray();