2 * Copyright (C) 2007-2012 Mathieu Baudier
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org
.argeo
.slc
.client
.ui
.decorators
;
18 import org
.apache
.commons
.logging
.Log
;
19 import org
.apache
.commons
.logging
.LogFactory
;
20 import org
.argeo
.slc
.client
.ui
.ClientUiPlugin
;
21 import org
.argeo
.slc
.client
.ui
.model
.ResultParent
;
22 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
23 import org
.eclipse
.jface
.viewers
.DecorationOverlayIcon
;
24 import org
.eclipse
.jface
.viewers
.IDecoration
;
25 import org
.eclipse
.jface
.viewers
.ILabelDecorator
;
26 import org
.eclipse
.jface
.viewers
.LabelProvider
;
27 import org
.eclipse
.swt
.graphics
.Image
;
28 import org
.eclipse
.ui
.ISharedImages
;
30 public class ResultFailedDecorator
extends LabelProvider
implements
33 private final static Log log
= LogFactory
34 .getLog(ResultFailedDecorator
.class);
36 public ResultFailedDecorator() {
40 // Method to decorate Image
41 public Image
decorateImage(Image image
, Object object
) {
43 // This method returns an annotated image or null if the
44 // image need not be decorated. Returning a null image
45 // decorates resource icon with basic decorations provided
47 if (object
instanceof ResultParent
) {
48 log
.debug("decorate : " + ((ResultParent
) object
).getName()
49 + " - passed : " + ((ResultParent
) object
).isPassed());
50 if (!((ResultParent
) object
).isPassed()) {
51 ImageDescriptor desc
= ClientUiPlugin
.getDefault()
52 .getWorkbench().getSharedImages()
53 .getImageDescriptor(ISharedImages
.IMG_DEC_FIELD_ERROR
);
54 DecorationOverlayIcon decoratedImage
= new DecorationOverlayIcon(
55 image
, desc
, IDecoration
.TOP_LEFT
);
56 return decoratedImage
.createImage();
63 // Method to decorate Text
64 public String
decorateText(String label
, Object object
) {