class="org.argeo.slc.client.ui.commands.ResultDetailsDisplayHandler"
scope="prototype">
</bean>
+ <bean id="org.argeo.slc.client.ui.launchBatch" class="org.argeo.slc.client.ui.commands.LaunchBatchHandler"
+ scope="prototype">
+ </bean>
+ <bean id="org.argeo.slc.client.ui.removeSelectedFromBatch"
+ class="org.argeo.slc.client.ui.commands.RemoveSelectedProcessFromBatchHandler"
+ scope="prototype">
+ </bean>
+ <bean id="org.argeo.slc.client.ui.clearBatch" class="org.argeo.slc.client.ui.commands.ClearBatchHandler"
+ scope="prototype">
+ </bean>
<bean id="org.argeo.slc.client.ui.editRealizedFlowDetails"
class="org.argeo.slc.client.ui.commands.EditRealizedFlowDetailsHandler"
scope="prototype">
scope="prototype">
<property name="processController" ref="processController" />
<property name="oxmBean" ref="oxmBean" />
+ <property name="slcAgents" ref="slcAgents" />
</bean>
<bean id="org.argeo.slc.client.ui.processParametersView" class="org.argeo.slc.client.ui.views.ProcessParametersView"
<command
defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
id="org.argeo.slc.client.ui.refreshResultList"
- name="RefreshResultList ">
+ name="RefreshResultList">
+ </command>
+ <command
+ defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
+ id="org.argeo.slc.client.ui.launchBatch"
+ name="LaunchBatch">
+ </command>
+ <command
+ defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
+ id="org.argeo.slc.client.ui.removeSelectedFromBatch"
+ name="RemoveSelectedFromBatch">
+ </command>
+ <command
+ defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
+ id="org.argeo.slc.client.ui.clearBatch"
+ name="ClearBatch">
</command>
<command
defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
</separator>
</toolbar>
</menuContribution>
+ <menuContribution
+ locationURI="toolbar:org.argeo.slc.client.ui.processBuilderView">
+ <command
+ commandId="org.argeo.slc.client.ui.launchBatch"
+ label="Launch Batch"
+ tooltip="Launch the batch built in the process builder view.">
+ </command>
+ <command
+ commandId="org.argeo.slc.client.ui.clearBatch"
+ label="Clear Batch"
+ tooltip="Clear the batch built in the process builder view.">
+ </command>
+ <command
+ commandId="org.argeo.slc.client.ui.removeSelectedFromBatch"
+ label="Remove Selected From Batch"
+ tooltip="Remove selected process from process builder view.">
+ </command>
+ </menuContribution>
</extension>
-
</plugin>
--- /dev/null
+package org.argeo.slc.client.ui.commands;
+
+import org.argeo.slc.client.ui.views.ProcessBuilderView;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ *
+ * @author bsinou
+ *
+ * Remove all processes from the batch built in the ProcessBuilderView
+ *
+ * NOTE : only one batch is supported with this command, if more than
+ * one batch is planned, this class must be updated with parameter.
+ */
+public class ClearBatchHandler extends AbstractHandler {
+ // private final static Log log =
+ // LogFactory.getLog(ClearBatchHandler.class);
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ProcessBuilderView pbView = (ProcessBuilderView) HandlerUtil
+ .getActiveWorkbenchWindow(event).getActivePage()
+ .findView(ProcessBuilderView.ID);
+ pbView.clearBatch();
+ return null;
+ }
+
+}
import org.eclipse.ui.handlers.HandlerUtil;
/**
- * Command handler to display and edit the attributes of a given Realizedflow.
- * The corresponding RealizedFlow is passed via command parameters and
- * unmarshalled with the oxmBean which is injected by Spring.
*
* @author bsinou
*
+ * Command handler to display and edit the attributes of a given
+ * Realizedflow. The corresponding RealizedFlow is passed via command
+ * parameters and unmarshalled with the oxmBean which is injected by
+ * Spring.
+ *
+ * Note thet passing an index of -1 will cause the reset of the View
+ * (used among others when removing processes from the batch).
*/
public class EditRealizedFlowDetailsHandler extends AbstractHandler {
int index = new Integer(
event.getParameter("org.argeo.slc.client.commands.realizedFlowIndex"))
.intValue();
- RealizedFlow rf = (RealizedFlow) oxmBean.unmarshal(rfAsXml);
-
try {
ProcessParametersView ppView = (ProcessParametersView) HandlerUtil
.getActiveWorkbenchWindow(event).getActivePage()
.showView(ProcessParametersView.ID);
- ppView.setRealizedFlow(index, rf);
+
+ if (index == -1)
+ ppView.setRealizedFlow(-1, null);
+ else {
+ RealizedFlow rf = (RealizedFlow) oxmBean.unmarshal(rfAsXml);
+ ppView.setRealizedFlow(index, rf);
+
+ }
} catch (Exception e) {
e.printStackTrace();
}
--- /dev/null
+package org.argeo.slc.client.ui.commands;
+
+import org.argeo.slc.client.ui.views.ProcessBuilderView;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ *
+ * @author bsinou
+ *
+ * Launch the batch built in the ProcessBuilderView
+ *
+ * NOTE : only one batch is supported with this command, if more than
+ * one batch is planned, this class must be updated with parameter.
+ */
+public class LaunchBatchHandler extends AbstractHandler {
+ // private final static Log log =
+ // LogFactory.getLog(LaunchBatchHandler.class);
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ProcessBuilderView pbView = (ProcessBuilderView) HandlerUtil
+ .getActiveWorkbenchWindow(event).getActivePage()
+ .findView(ProcessBuilderView.ID);
+ pbView.launchBatch();
+ return null;
+ }
+
+}
--- /dev/null
+package org.argeo.slc.client.ui.commands;
+
+import org.argeo.slc.client.ui.views.ProcessBuilderView;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ *
+ * @author bsinou
+ *
+ * Launch the batch built in the ProcessBuilderView
+ *
+ * NOTE : only one batch is supported with this command, if more than
+ * one batch is planned, this class must be updated with parameter.
+ */
+
+public class RemoveSelectedProcessFromBatchHandler extends AbstractHandler {
+ // private final static Log log =
+ // LogFactory.getLog(RemoveSelectedProcessFromBatchHandler.class);
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ProcessBuilderView pbView = (ProcessBuilderView) HandlerUtil
+ .getActiveWorkbenchWindow(event).getActivePage()
+ .findView(ProcessBuilderView.ID);
+ pbView.removeSelected();
+ return null;
+ }
+
+}
private final static Log log = LogFactory
.getLog(ExecutionModulesContentProvider.class);
+ // IoC
private List<SlcAgent> slcAgents;
public Object[] getChildren(Object parent) {
-
if (parent instanceof ExecutionModuleNode) {
ExecutionModuleNode executionModuleNode = (ExecutionModuleNode) parent;
ExecutionModuleDescriptor emd = executionModuleNode.getDescriptor();
return getChildren(parent);
}
- public void setSlcAgents(List<SlcAgent> slcAgents) {
- this.slcAgents = slcAgents// for (String flowName :
- // executionModuleNode.getFlowDescriptors()
- // .keySet()) {
- // executionModuleNode.addChild(new FlowNode(flowName,
- // executionModuleNode));
- // }
- ;
- }
-
+
+
public class AgentNode extends TreeParent {
private final SlcAgent agent;
}
}
+
+ // IoC
+ public void setSlcAgents(List<SlcAgent> slcAgents) {
+ this.slcAgents = slcAgents;
+ }
}
public class ProcessParametersEditingSupport extends EditingSupport {
- private CellEditor editor;
- private int column;
+ // private final static Log log = LogFactory
+ // .getLog(ProcessParametersEditingSupport.class);
+
+ private CellEditor strEditor;
+ private CellEditor nbEditor;
+ // private int column;
+
+ private final static String strType = "string", intType = "integer";
+
+ // different type of primitive
+ private static enum primitiveType {
+ strType, intType
+ };
// So that we can update corresponding process
private int curProcessIndex;
public ProcessParametersEditingSupport(ColumnViewer viewer, int column) {
super(viewer);
- editor = new TextCellEditor(((TableViewer) viewer).getTable());
- this.column = column;
+ strEditor = new TextCellEditor(((TableViewer) viewer).getTable());
+ // nbEditor = new NumberCellEditor(((TableViewer) viewer).getTable());
+ // this.column = column;
}
@Override
protected CellEditor getCellEditor(Object element) {
- return editor;
+ // TODO return specific editor depending on the parameter type.
+ return strEditor;
}
@Override
if (objectWithName.obj instanceof PrimitiveAccessor) {
PrimitiveAccessor pv = (PrimitiveAccessor) objectWithName.obj;
- // we only handle string parameter in a first time
- if ("string".equals(pv.getType())) {
+ // we only handle string & integer parameter in a first time
+ if (strType.equals(pv.getType())) {
return pv.getValue();
}
+ if (intType.equals(pv.getType())) {
+ return ((Integer) pv.getValue()).toString();
+ }
}
return "unsupported param type";
@Override
protected void setValue(Object element, Object value) {
ProcessParametersView.ObjectWithName objectWithName = (ProcessParametersView.ObjectWithName) element;
-
if (objectWithName.obj instanceof PrimitiveAccessor) {
PrimitiveAccessor pv = (PrimitiveAccessor) objectWithName.obj;
// we only handle string parameter in a first time
- if ("string".equals(pv.getType())) {
+ if (strType.equals(pv.getType())) {
pv.setValue(value);
pbView.updateParameter(curProcessIndex, objectWithName.name,
objectWithName.obj);
- getViewer().update(element, null);
+ } else if (intType.equals(pv.getType())) {
+
+ String stVal = (String) value;
+ Integer val = ("".equals(stVal)) ? new Integer(0)
+ : new Integer(stVal);
+ pv.setValue(val);
+ pbView.updateParameter(curProcessIndex, objectWithName.name, pv);
}
+ getViewer().update(element, null);
}
}
ExecutionModulesContentProvider.FlowNode flowNode = (ExecutionModulesContentProvider.FlowNode) selection
.getFirstElement();
- // we still use property because the marshaller bean does
- // not know the FlowNode Class
Properties props = new Properties();
flowNodeAsProperties(props, flowNode);
props.setProperty("agentId", flowNode
.getExecutionModuleNode().getAgentNode().getAgent()
.getAgentUuid());
+ props.setProperty("host", flowNode.getExecutionModuleNode().getAgentNode()
+ .getAgent().toString());
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
System.out.println("Finished Drag");
}
- private void flowNodeAsProperties(Properties props, FlowNode fn) {
- props.setProperty("moduleName", fn.getExecutionModuleNode()
+ protected void flowNodeAsProperties(Properties props, FlowNode fn) {
+
+ RealizedFlow realizedFlow = new RealizedFlow();
+ realizedFlow.setModuleName(fn.getExecutionModuleNode()
.getDescriptor().getName());
- props.setProperty("moduleVersion", fn.getExecutionModuleNode()
+ realizedFlow.setModuleVersion(fn.getExecutionModuleNode()
.getDescriptor().getVersion());
- props.setProperty("flowName", fn.getFlowName());
+ realizedFlow.setFlowDescriptor(fn.getExecutionFlowDescriptor());
- System.out.println("Execution Spec avant marshalling ??? ");
- System.out.println(fn.getExecutionFlowDescriptor());
- System.out.println(fn.getExecutionFlowDescriptor()
+ // As we want to have the effective ExecutionSpec and not a
+ // reference; we store it at the RealizeFlow level : thus the
+ // marshaller will store the object and not only a reference.
+ realizedFlow.setExecutionSpec(fn.getExecutionFlowDescriptor()
.getExecutionSpec());
- props.setProperty("FlowDescriptorAsXml",
- oxmBean.marshal(fn.getExecutionFlowDescriptor()));
+ props.setProperty("RealizedFlowAsXml",
+ oxmBean.marshal(realizedFlow));
System.out
.println(oxmBean.marshal(fn.getExecutionFlowDescriptor()));
import java.util.UUID;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.argeo.slc.SlcException;
import org.argeo.slc.client.oxm.OxmInterface;
import org.argeo.slc.client.ui.ClientUiPlugin;
import org.argeo.slc.client.ui.controllers.ProcessController;
-import org.argeo.slc.execution.ExecutionFlowDescriptor;
import org.argeo.slc.process.RealizedFlow;
import org.argeo.slc.process.SlcExecution;
import org.argeo.slc.runtime.SlcAgent;
*
*/
public class ProcessBuilderView extends ViewPart {
+ private final static Log log = LogFactory.getLog(ProcessBuilderView.class);
+
public static final String ID = "org.argeo.slc.client.ui.processBuilderView";
+ private static final String EDIT_CMD = "org.argeo.slc.client.ui.editRealizedFlowDetails";
+ private static final String FLOWASXML_PARAM = "org.argeo.slc.client.commands.realizedFlowAsXml";
+ private static final String INDEX_PARAM = "org.argeo.slc.client.commands.realizedFlowIndex";
// private final static Log log =
// LogFactory.getLog(ProcessBuilderView.class);
private TableViewer viewer;
private List<RealizedFlow> realizedFlows = new ArrayList<RealizedFlow>();
private String currentAgentUuid = null;
+ private String host = null;
+
+ // TODO find a better way to get index of the current selected row
+ // used in removeSelected
+ private int curSelectedRow = -1;
// IoC
private OxmInterface oxmBean;
private ProcessController processController;
+ private List<SlcAgent> slcAgents;
public void createPartControl(Composite parent) {
Table table = createTable(parent);
curRealizedFlow.getFlowDescriptor().getValues().put(paramName, value);
}
+ // clear the realizedFlow<List>
+ public void clearBatch() {
+ // we clear the list
+ realizedFlows = new ArrayList<RealizedFlow>();
+ curSelectedRow = -1;
+ refreshParameterview(null);
+ viewer.refresh();
+ }
+
+ // Remove the selected process from the batch
+ public void removeSelected() {
+ if (curSelectedRow == -1)
+ return;
+ else
+ realizedFlows.remove(curSelectedRow);
+ curSelectedRow = -1;
+ refreshParameterview(null);
+ viewer.refresh();
+ }
+
+ // calling this method with index =-1 will cause the reset of the view.
+ private void refreshParameterview(RealizedFlow rf) {
+ IWorkbench iw = ClientUiPlugin.getDefault().getWorkbench();
+ IHandlerService handlerService = (IHandlerService) iw
+ .getService(IHandlerService.class);
+ try {
+ // get the command from plugin.xml
+ IWorkbenchWindow window = iw.getActiveWorkbenchWindow();
+ ICommandService cmdService = (ICommandService) window
+ .getService(ICommandService.class);
+ Command cmd = cmdService.getCommand(EDIT_CMD);
+
+ ArrayList<Parameterization> parameters = new ArrayList<Parameterization>();
+
+ IParameter iparam;
+ Parameterization params;
+
+ // The current index to be able to records changes on
+ // parameters
+ iparam = cmd.getParameter(INDEX_PARAM);
+ params = new Parameterization(iparam,
+ (new Integer(curSelectedRow)).toString());
+ parameters.add(params);
+
+ if (curSelectedRow != -1) {
+ // The current Realized flow marshalled as XML
+ String result = oxmBean.marshal(rf);
+ iparam = cmd.getParameter(FLOWASXML_PARAM);
+ 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());
+ }
+
+ }
+
+ // Return the list of the processes to execute.
+ public void launchBatch() {
+ SlcExecution slcExecution = new SlcExecution();
+ slcExecution.setUuid(UUID.randomUUID().toString());
+
+ slcExecution.setRealizedFlows(realizedFlows);
+ slcExecution.setHost(host);
+
+ // TODO : insure that the concept has been well understood & the
+ // specification respected
+ SlcAgent curAgent;
+ for (int i = 0; i < slcAgents.size(); i++) {
+ if (currentAgentUuid == null)
+ throw new SlcException(
+ "Cannot launch a batch if no agent is specified");
+ if (currentAgentUuid.equals(slcAgents.get(i).getAgentUuid())) {
+ curAgent = slcAgents.get(i);
+ processController.execute(curAgent, slcExecution);
+ break;
+ }
+ }
+ }
+
// Specific Providers for the current view.
protected class ViewContentProvider implements IStructuredContentProvider {
public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
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());
- }
+ curSelectedRow = realizedFlows.indexOf(rf);
+ refreshParameterview(rf);
}
}
}
}
String agentId = props.getProperty("agentId");
- if (currentAgentUuid == null)
+ if (currentAgentUuid == null) {
currentAgentUuid = agentId;
- else if (!currentAgentUuid.equals(agentId)) {
+ host = props.getProperty("host");
+ } else if (!currentAgentUuid.equals(agentId)) {
// TODO: as for now, we can only construct batch on a single
- // Agent,
- // must be upgraded to enable batch on various agent.
+ // Agent, must be upgraded to enable batch on various agent.
throw new SlcException(
"Cannot create batch on two (or more) distinct agents",
null);
// return false;
}
- RealizedFlow rf = realizedFlowFromProperties(props);
+ String fdXml = props.getProperty("RealizedFlowAsXml");
+ if (fdXml == null)
+ return false;
+ RealizedFlow rf = (RealizedFlow) oxmBean.unmarshal(fdXml);
realizedFlows.add(rf);
getViewer().refresh();
return true;
}
- private RealizedFlow realizedFlowFromProperties(Properties props) {
- RealizedFlow rf = new RealizedFlow();
- rf.setModuleName(props.getProperty("moduleName"));
- rf.setModuleVersion(props.getProperty("moduleVersion"));
- String fdXml = props.getProperty("FlowDescriptorAsXml");
- if (fdXml != null) {
- Object o = oxmBean.unmarshal(fdXml);
- if (o instanceof ExecutionFlowDescriptor) {
- rf.setFlowDescriptor((ExecutionFlowDescriptor) o);
- System.out.println("instance of EFD !!!"
- + rf.getFlowDescriptor().toString());
- System.out.println(rf.getFlowDescriptor()
- .getExecutionSpec());
- return rf;
- }
- }
- // Else
- System.out
- .println("***** WARNING : we should not be here; corresponding flow name"
- + props.getProperty("flowName"));
- ExecutionFlowDescriptor efd = new ExecutionFlowDescriptor();
- efd.setName(props.getProperty("flowName"));
- rf.setFlowDescriptor(efd);
- return rf;
- }
-
@Override
public boolean validateDrop(Object target, int operation,
TransferData transferType) {
}
// IoC
+ public void setSlcAgents(List<SlcAgent> slcAgents) {
+ this.slcAgents = slcAgents;
+ }
+
public void setOxmBean(OxmInterface oxmBean) {
this.oxmBean = oxmBean;
}
import java.util.List;
import java.util.Map;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.argeo.slc.client.ui.ClientUiPlugin;
import org.argeo.slc.client.ui.providers.ProcessParametersEditingSupport;
import org.argeo.slc.core.execution.PrimitiveAccessor;
* attribute to recall (and update ??) the various parameters.
*/
public class ProcessParametersView extends ViewPart {
- public static final String ID = "org.argeo.slc.client.ui.processParametersView";
+ private static final Log log = LogFactory
+ .getLog(ProcessParametersView.class);
- // class attribute
- private Map<String, ExecutionSpecAttribute> parameters;
- private RealizedFlow curRealizedFlow;
+ public static final String ID = "org.argeo.slc.client.ui.processParametersView";
- // we should be using executionspecAttribute but for now we uses values.
+ // This map stores actual values set to default if existing at the begining
+ // and then the ones computed by the end user
private Map<String, Object> values;
+ // This map stores the spec of the attributes used to offer the end user
+ // some choices.
+ private Map<String, ExecutionSpecAttribute> specAttributes;
// We must keep a reference to the current EditingSupport so that we can
// update the index of the process being updated
createColumns(viewer);
// WARNING
- // for the moment being, we support only one process builder at a time
+ // for the moment being, we support only one process builder at a time
// we set the corresponding view in the editor here.
ProcessBuilderView pbView = (ProcessBuilderView) ClientUiPlugin
.getDefault().getWorkbench().getActiveWorkbenchWindow()
.getActivePage().findView(ProcessBuilderView.ID);
ppEditingSupport.setCurrentProcessBuilderView(pbView);
-
+
viewer.setLabelProvider(new ViewLabelProvider());
viewer.setContentProvider(new ViewContentProvider());
viewer.setInput(getViewSite());
-
-
+
}
// This will create the columns for the table
Table table = viewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
-
+
}
public void setFocus() {
viewer.getControl().setFocus();
}
- // save and update a field when it looses the focus
- // TODO implement this method.
-
// set class attributes, refresh the lists of process paramaters to edit.
public void setRealizedFlow(int index, RealizedFlow rf) {
-
- // this.processIndex = index;
+ // force the cleaning of the view
+ if (index == -1) {
+ viewer.setInput(null);
+ return;
+ }
+ // we store the index of the edited Process in the editor so that it can
+ // save computed values.
ppEditingSupport.setCurrentProcessIndex(index);
- curRealizedFlow = rf;
// TODO :
// We should handle ExecutionSpec here. need to be improved.
// viewer.setInput(parameters);
values = rf.getFlowDescriptor().getValues();
+ specAttributes = rf.getFlowDescriptor().getExecutionSpec()
+ .getAttributes();
+
if (values != null)
viewer.setInput(values);
else
PrimitiveAccessor pa = (PrimitiveAccessor) own.obj;
if ("string".equals(pa.getType()))
return (String) pa.getValue();
+ else if ("integer".equals(pa.getType()))
+ return ((Integer) pa.getValue()).toString();
else
return "Type " + pa.getType()
+ " not yet supported";
}
}
-
- // protected class ViewContentProvider implements IStructuredContentProvider
- // {
- // public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
- // }
- //
- // public void dispose() {
- // }
- //
- // // we cast the Map<String, ExecutionSpecAttribute> to List<Object>
- // public Object[] getElements(Object obj) {
- // if (obj instanceof Map && ((Map) obj).size() != 0) {
- // List<ExecutionSpecAttributeWithName> list = new
- // ArrayList<ExecutionSpecAttributeWithName>();
- // Map<String, ExecutionSpecAttribute> map = (Map<String,
- // ExecutionSpecAttribute>) obj;
- // for (String key : map.keySet()) {
- // list.add(new ExecutionSpecAttributeWithName(key, map
- // .get(key)));
- // }
- // return list.toArray();
- // } else {
- // return new Object[0];
- // }
- // }
- // }
- //
- // protected class ViewLabelProvider extends LabelProvider implements
- // ITableLabelProvider {
- //
- // public String getColumnText(Object obj, int index) {
- // // NOTE : the passed object is a line of the table !!!
- //
- // if (obj instanceof ExecutionSpecAttributeWithName) {
- // ExecutionSpecAttributeWithName esaw = (ExecutionSpecAttributeWithName)
- // obj;
- // switch (index) {
- // case 0:
- // return esaw.name;
- // case 1:
- // return esaw.esa.getValue().toString();
- // default:
- // return getText(obj);
- // }
- // } else
- // return getText(obj);
- // }
- //
- // public Image getColumnImage(Object obj, int index) {
- // return null;
- // }
- //
- // }
- //
- // // We add an inner class to enrich the ExecutionSpecAttribute with a name
- // // so that we can display it.
- // private class ExecutionSpecAttributeWithName {
- // public ExecutionSpecAttribute esa;
- // public String name;
- //
- // public ExecutionSpecAttributeWithName(String name,
- // ExecutionSpecAttribute esa) {
- // this.name = name;
- // this.esa = esa;
- // }
-
- // }
}