1 4 package org.terracotta.dso.decorator; 5 6 import org.eclipse.core.resources.IProject; 7 import org.eclipse.jdt.core.IField; 8 import org.eclipse.jface.resource.ImageDescriptor; 9 import org.eclipse.jface.viewers.IDecoration; 10 import org.eclipse.jface.viewers.ILightweightLabelDecorator; 11 import org.eclipse.jface.viewers.LabelProvider; 12 13 import org.terracotta.dso.ConfigurationHelper; 14 import org.terracotta.dso.TcPlugin; 15 16 25 26 public class TransientDecorator extends LabelProvider 27 implements ILightweightLabelDecorator 28 { 29 private static final ImageDescriptor 30 m_imageDesc = ImageDescriptor.createFromURL( 31 TransientDecorator.class.getResource( 32 "/com/tc/admin/icons/transient_ovr.gif")); 33 34 public static final String 35 DECORATOR_ID = "org.terracotta.dso.transientDecorator"; 36 37 public void decorate(Object element, IDecoration decoration) { 38 TcPlugin plugin = TcPlugin.getDefault(); 39 IField field = (IField)element; 40 IProject project = field.getJavaProject().getProject(); 41 42 if(plugin.hasTerracottaNature(project)) { 43 ConfigurationHelper config = plugin.getConfigurationHelper(project); 44 45 if(config != null && config.isTransient(field)) { 46 decoration.addOverlay(m_imageDesc); 47 } 48 } 49 } 50 51 public static void updateDecorators() { 52 TcPlugin.getDefault().updateDecorator(DECORATOR_ID); 53 } 54 } 55 | Popular Tags |