From: Bruno Sinou Date: Tue, 26 Mar 2013 18:14:05 +0000 (+0000) Subject: Update decorators to show more explicitly PASSED / FAILED / ERROR status in the Resul... X-Git-Tag: argeo-slc-2.1.7~364 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;ds=sidebyside;h=0dcc341dafa9c72011b01491bfa8631b4e71ede2;p=gpl%2Fargeo-slc.git Update decorators to show more explicitly PASSED / FAILED / ERROR status in the ResultTree view. t might be reverted if it raises some performance issues. git-svn-id: https://svn.argeo.org/slc/trunk@6226 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/plugins/org.argeo.slc.client.ui/icons/executionPassed.gif b/plugins/org.argeo.slc.client.ui/icons/executionPassed.gif new file mode 100644 index 000000000..20fc2f250 Binary files /dev/null and b/plugins/org.argeo.slc.client.ui/icons/executionPassed.gif differ diff --git a/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/SlcImages.java b/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/SlcImages.java index 28c14d956..d881f0ec8 100644 --- a/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/SlcImages.java +++ b/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/SlcImages.java @@ -15,8 +15,10 @@ */ package org.argeo.slc.client.ui; +import static org.argeo.slc.client.ui.ClientUiPlugin.getImageDescriptor; import static org.argeo.slc.client.ui.ClientUiPlugin.img; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.graphics.Image; /** Shared images. */ @@ -45,4 +47,9 @@ public class SlcImages { public final static Image PROCESS_SCHEDULED = img("icons/process_scheduled.gif"); public final static Image PROCESS_RUNNING = img("icons/process_running.png"); public final static Image PROCESS_COMPLETED = img("icons/process_completed.png"); + + // Decorators + public final static ImageDescriptor EXECUTION_ERROR = getImageDescriptor("icons/executionError.gif"); + public final static ImageDescriptor EXECUTION_PASSED = getImageDescriptor("icons/executionPassed.gif"); + } diff --git a/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/decorators/ResultFailedDecorator.java b/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/decorators/ResultFailedDecorator.java index a7c96927d..f5a7c98d1 100644 --- a/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/decorators/ResultFailedDecorator.java +++ b/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/decorators/ResultFailedDecorator.java @@ -25,6 +25,7 @@ import org.argeo.slc.SlcException; import org.argeo.slc.client.ui.ClientUiPlugin; import org.argeo.slc.client.ui.SlcImages; import org.argeo.slc.client.ui.SlcUiConstants; +import org.argeo.slc.client.ui.model.ResultFolder; import org.argeo.slc.client.ui.model.ResultParent; import org.argeo.slc.client.ui.model.SingleResultNode; import org.argeo.slc.jcr.SlcNames; @@ -51,19 +52,30 @@ public class ResultFailedDecorator extends LabelProvider implements // hack for SWT resource leak // see http://www.eclipse.org/articles/swt-design-2/swt-design-2.html // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=181215 + private final Image passedFolder; private final Image failedFolder; private final Image failedSingleResult; + private final Image errorSingleResult; + private final Image passedSingleResult; public ResultFailedDecorator() { super(); - ImageDescriptor desc = ClientUiPlugin.getDefault().getWorkbench() + ImageDescriptor failedDesc = ClientUiPlugin.getDefault().getWorkbench() .getSharedImages() .getImageDescriptor(ISharedImages.IMG_DEC_FIELD_ERROR); - failedFolder = new DecorationOverlayIcon(SlcImages.FOLDER, desc, + failedFolder = new DecorationOverlayIcon(SlcImages.FOLDER, failedDesc, IDecoration.TOP_LEFT).createImage(); + passedFolder = new DecorationOverlayIcon(SlcImages.FOLDER, + SlcImages.EXECUTION_PASSED, IDecoration.TOP_LEFT).createImage(); failedSingleResult = new DecorationOverlayIcon( - SlcImages.PROCESS_COMPLETED, desc, IDecoration.TOP_LEFT) + SlcImages.PROCESS_COMPLETED, failedDesc, IDecoration.TOP_LEFT) .createImage(); + errorSingleResult = new DecorationOverlayIcon( + SlcImages.PROCESS_COMPLETED, SlcImages.EXECUTION_ERROR, + IDecoration.TOP_LEFT).createImage(); + passedSingleResult = new DecorationOverlayIcon( + SlcImages.PROCESS_COMPLETED, SlcImages.EXECUTION_PASSED, + IDecoration.TOP_LEFT).createImage(); } // Method to decorate Image @@ -74,7 +86,14 @@ public class ResultFailedDecorator extends LabelProvider implements // decorates resource icon with basic decorations provided // by Eclipse if (object instanceof ResultParent) { - if (!((ResultParent) object).isPassed()) { + if (((ResultParent) object).isPassed()) { + if (object instanceof SingleResultNode) + return passedSingleResult; + else if (object instanceof ResultFolder) + return passedFolder; + else + return null; + } else { // ImageDescriptor desc = ClientUiPlugin.getDefault() // .getWorkbench().getSharedImages() // .getImageDescriptor(ISharedImages.IMG_DEC_FIELD_ERROR); @@ -82,12 +101,24 @@ public class ResultFailedDecorator extends LabelProvider implements // DecorationOverlayIcon( // image, desc, IDecoration.TOP_LEFT); // return decoratedImage.createImage(); - if (object instanceof SingleResultNode) - return failedSingleResult; - else + if (object instanceof SingleResultNode) { + SingleResultNode srn = (SingleResultNode) object; + boolean isError = false; + try { + isError = srn.getNode() + .getNode(SlcNames.SLC_AGGREGATED_STATUS) + .hasProperty(SlcNames.SLC_ERROR_MESSAGE); + } catch (RepositoryException re) { + // Silent node might not exist + } + if (isError) + return errorSingleResult; + else + return failedSingleResult; + + } else return failedFolder; - } else - return null; + } } return null; }