X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=eclipse%2Fplugins%2Forg.argeo.slc.client.ui%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fclient%2Fui%2Fviews%2FJcrProcessListView.java;h=cfc57497954490348ebcdac1a4eb88cfa98a1907;hb=6a5737bbf4cd63e00e61a3fd81e6673b5ad9341f;hp=ddc34a581943f63ed47d898436261e6c449fd70c;hpb=9bab32638cc6a08ba96c3feca190733e9d1ac0ac;p=gpl%2Fargeo-slc.git diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/JcrProcessListView.java b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/JcrProcessListView.java index ddc34a581..cfc574979 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/JcrProcessListView.java +++ b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/JcrProcessListView.java @@ -19,8 +19,10 @@ import javax.jcr.query.Query; import org.argeo.eclipse.ui.jcr.AsyncUiEventListener; import org.argeo.jcr.JcrUtils; import org.argeo.slc.SlcException; +import org.argeo.slc.client.ui.SlcImages; import org.argeo.slc.client.ui.editors.ProcessEditor; import org.argeo.slc.client.ui.editors.ProcessEditorInput; +import org.argeo.slc.execution.ExecutionProcess; import org.argeo.slc.jcr.SlcJcrConstants; import org.argeo.slc.jcr.SlcNames; import org.argeo.slc.jcr.SlcTypes; @@ -41,10 +43,7 @@ import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.part.ViewPart; -/** - * This class display the list of all processes that have run in the - * corresponding agent. Currently, the local agent. - */ +/** Displays processes. */ public class JcrProcessListView extends ViewPart { public static final String ID = "org.argeo.slc.client.ui.jcrProcessListView"; @@ -68,6 +67,7 @@ public class JcrProcessListView extends ViewPart { processesObserver = new AsyncUiEventListener() { protected void onEventInUiThread(EventIterator events) { + // TODO optimize by updating only the changed process viewer.refresh(); } }; @@ -157,8 +157,29 @@ public class JcrProcessListView extends ViewPart { class LabelProvider extends ColumnLabelProvider implements ITableLabelProvider { - public Image getColumnImage(Object element, int columnIndex) { - return null; + public Image getColumnImage(Object obj, int columnIndex) { + if (columnIndex != 0) + return null; + try { + Node node = (Node) obj; + String status = node.getProperty(SlcNames.SLC_STATUS) + .getString(); + if (status.equals(ExecutionProcess.NEW) + || status.equals(ExecutionProcess.INITIALIZED) + || status.equals(ExecutionProcess.SCHEDULED)) + return SlcImages.PROCESS_SCHEDULED; + else if (status.equals(ExecutionProcess.ERROR) + || status.equals(ExecutionProcess.UNKOWN)) + return SlcImages.PROCESS_ERROR; + else if (status.equals(ExecutionProcess.COMPLETED)) + return SlcImages.PROCESS_COMPLETED; + else if (status.equals(ExecutionProcess.RUNNING)) + return SlcImages.PROCESS_RUNNING; + else + throw new SlcException("Unkown status " + status); + } catch (RepositoryException e) { + throw new SlcException("Cannot get column text", e); + } } public String getColumnText(Object obj, int index) {