1 4 package org.terracotta.dso.decorator; 5 6 import org.eclipse.core.resources.IFile; 7 import org.eclipse.core.resources.IProject; 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 import org.terracotta.dso.TcPlugin; 13 14 19 20 public class ConfigFileDecorator extends LabelProvider 21 implements ILightweightLabelDecorator 22 { 23 private static final ImageDescriptor 24 m_imageDesc = ImageDescriptor.createFromURL( 25 ConfigFileDecorator.class.getResource( 26 "/com/tc/admin/icons/installed_ovr.gif")); 27 28 public static final String 29 DECORATOR_ID = "org.terracotta.dso.configFileDecorator"; 30 31 public void decorate(Object element, IDecoration decoration) { 32 TcPlugin plugin = TcPlugin.getDefault(); 33 IFile file = (IFile)element; 34 IProject project = file.getProject(); 35 36 if(plugin.hasTerracottaNature(project)) { 37 IFile configFile = plugin.getConfigurationFile(project); 38 39 if(file.equals(configFile)) { 40 decoration.addOverlay(m_imageDesc); 41 } 42 } 43 } 44 45 public static void updateDecorators() { 46 TcPlugin.getDefault().updateDecorator(DECORATOR_ID); 47 } 48 } 49 | Popular Tags |