Index: DecoratorManager.java =================================================================== RCS file: /home/eclipse/org.eclipse.ui/Eclipse UI/org/eclipse/ui/internal/DecoratorManager.java,v retrieving revision 1.35 diff -u -r1.35 DecoratorManager.java --- DecoratorManager.java 11 Jun 2002 15:35:15 -0000 1.35 +++ DecoratorManager.java 9 Aug 2002 06:47:02 -0000 @@ -101,77 +101,71 @@ * Return null if there are none defined for this type. */ public String decorateText(String text, Object element) { - return decorateText(text, element, true); - } - - /** - * Decorate the text provided for the element type. - * Check for an adapted resource if checkAdapted is true. - * Return null if there are none defined for this type. - */ - private String decorateText( - String text, - Object element, - boolean checkAdapted) { - - DecoratorDefinition[] decorators = getDecoratorsFor(element); - String result = text; - for (int i = 0; i < decorators.length; i++) { - String newResult = decorators[i].decorateText(result, element); - if (newResult != null) - result = newResult; - } - - if (checkAdapted) { - //Get any adaptions to IResource - Object adapted = getResourceAdapter(element); - if (adapted != null) - result = decorateText(result, adapted, false); - } + DecoratorDefinition[] decorators = getDecoratorsFor(element); + String result = text; + for (int i = 0; i < decorators.length; i++) { + String newResult = decorators[i].decorateText(result, element); + if (newResult != null) + result = newResult; + } + + //Get any adaptions to IResource + Object adapted = getResourceAdapter(element); + if (adapted != null) + { + DecoratorDefinition[] resourceDecorators = getDecoratorsFor(adapted); + for (int i = 0; i < resourceDecorators.length; i++) + { + if( resourceDecorators[i].isAdaptable() ) + { + String newResult = resourceDecorators[i].decorateText(result, element); + if (newResult != null) + result = newResult; + } + } + } + + return result; - return result; } - /** - * Decorate the image provided for the element type. - * Return null if there are none defined for this type. - */ - public Image decorateImage(Image image, Object element) { - return decorateImage(image, element, true); - } /** * Decorate the image provided for the element type. - * Check for an adapted resource if checkAdapted is true. * Return null if there are none defined for this type. */ - private Image decorateImage( - Image image, - Object element, - boolean checkAdapted) { - - DecoratorDefinition[] decorators = getDecoratorsFor(element); - Image result = image; - for (int i = 0; i < decorators.length; i++) { - Image newResult = decorators[i].decorateImage(result, element); - if (newResult != null) - result = newResult; - } - - if (checkAdapted) { - //Get any adaptions to IResource - Object adapted = getResourceAdapter(element); - if (adapted != null) - result = decorateImage(result, adapted, false); - } + public Image decorateImage(Image image, Object element) { + DecoratorDefinition[] decorators = getDecoratorsFor(element); + Image result = image; + for (int i = 0; i < decorators.length; i++) { + Image newResult = decorators[i].decorateImage(result, element); + if (newResult != null) + result = newResult; + } + + //Get any adaptions to IResource + Object adapted = getResourceAdapter(element); + if (adapted != null) + { + DecoratorDefinition[] resourceDecorators = getDecoratorsFor(adapted); + for (int i = 0; i < resourceDecorators.length; i++) + { + if( resourceDecorators[i].isAdaptable() ) + { + Image newResult = resourceDecorators[i].decorateImage(result, element); + if (newResult != null) + result = newResult; + } + } + } - return result; + return result; } /** * Get the resource adapted object for the supplied - * element. Return null if there isn't one. + * element. Return null if there isn't one or if adapted == element. */ private Object getResourceAdapter(Object element) {