1 20 21 package org.apache.directory.ldapstudio.browser.ui.views.browser; 22 23 24 import org.apache.directory.ldapstudio.browser.core.model.IEntry; 25 import org.apache.directory.ldapstudio.browser.core.model.ISearchResult; 26 import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants; 27 import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin; 28 29 import org.eclipse.jface.viewers.IDecoration; 30 import org.eclipse.jface.viewers.ILightweightLabelDecorator; 31 import org.eclipse.jface.viewers.LabelProvider; 32 33 34 42 public class BrowserViewLabelDecorator extends LabelProvider implements ILightweightLabelDecorator 43 { 44 45 48 public void decorate( Object element, IDecoration decoration ) 49 { 50 IEntry entry = null; 51 52 if ( element instanceof ISearchResult ) 53 { 54 ISearchResult searchResult = ( ISearchResult ) element; 55 entry = searchResult.getEntry(); 56 decoration.addOverlay( BrowserUIPlugin.getDefault().getImageDescriptor( 57 BrowserUIConstants.IMG_OVR_SEARCHRESULT ), IDecoration.BOTTOM_RIGHT ); 58 } 59 else if ( element instanceof IEntry ) 60 { 61 entry = ( IEntry ) element; 62 if ( entry.getChildrenFilter() != null ) 63 { 64 decoration.addOverlay( BrowserUIPlugin.getDefault().getImageDescriptor( 65 BrowserUIConstants.IMG_OVR_FILTERED ), IDecoration.BOTTOM_RIGHT ); 66 } 67 } 68 else 69 { 70 decoration.addOverlay( null, IDecoration.BOTTOM_RIGHT ); 71 } 72 73 if ( entry != null ) 74 { 75 if ( !entry.isConsistent() ) 76 { 77 decoration.addOverlay( BrowserUIPlugin.getDefault().getImageDescriptor( 78 BrowserUIConstants.IMG_OVR_ERROR ), IDecoration.BOTTOM_LEFT ); 79 } 80 else if ( !entry.isDirectoryEntry() ) 81 { 82 decoration.addOverlay( BrowserUIPlugin.getDefault().getImageDescriptor( 83 BrowserUIConstants.IMG_OVR_WARNING ), IDecoration.BOTTOM_LEFT ); 84 } 85 else 86 { 87 decoration.addOverlay( null, IDecoration.BOTTOM_LEFT ); 88 } 89 } 90 } 91 92 } 93 | Popular Tags |