icon decoration order for content type [message #779463] |
Sun, 15 January 2012 20:19 |
valentin Mising name Messages: 38 Registered: December 2011 |
Member |
|
|
Hi, I have recently managed to introduce problem markers into my Navigator through a reference to java plugin, <contentExtension pattern="org.eclipse.jdt.java.ui.javaContent"/>
In works fine for my custom file types, but I see no markers for .txt files. Interestingly, the markers present in the status bar, even when when Navigator refuses to show them. After investigaion, I have figured out that java decorates all files. You see this in the first part of
public Image Decorating.StyledCell.getImage(Object element) {
Image image = super.getImage(element); // produces problem markers
if (this.decorator == null) {
return image;
}
Image decorated = null;
if (this.decorator instanceof LabelDecorator) {
decorated = ((LabelDecorator) this.decorator).decorateImage(image,
element, getDecorationContext());
} else {
decorated = this.decorator.decorateImage(image, element);
}
But then, there is decorateImage() call that reaches eclipse.ui.internal.decorators.DecorationScheduler
public Image decorateWithOverlays(
{
DecorationResult decoration = getResult(element, adaptedElement,
context);
if (decoration == null) {
return image;
}
}
private DecorationResult getResult(
DecorationResult decoration = internalGetResult(element, context);
if (decoration == null) {
queueForDecoration(element, adaptedElement, false, null, context);
return null;
}
private DecorationResult internalGetResult(Object element,
IDecorationContext context) {
Map results = (Map) resultCache.get(context);
First time, when label is produced for the status bar, because resultCache is empty, this returns null and java-decorated icon is preserved. However, as you see, queueForDecoration launches caching job in this case. Therefore, when icon is produced for the navigator, cache overwrites the java.ui problem decoration.
Why this happens for one file kind and not the other? I see that
contentDescription = file.getContentDescription();
if (contentDescription != null) {
IContentType contentType = contentDescription.getContentType();
if (contentType != null) {
image = workbench.getEditorRegistry().getImageDescriptor(file.getName(), contentType);
}
in ContentTypeDecorator.decorate() returns the image (without problem markers) because contentDescription = default org.eclipse.core.runtime.text. It is null in other cases because vhdl files have M_NO_CONTENT_DESCRIPTION attribute, which preserves java image. Text files have default description.
Shouldn't caching and decorators respect the picture, produced at the previous steps and add decorations after
workbench.getEditorRegistry().getImageDescriptor(file.getName(), contentType);
?
[Updated on: Mon, 16 January 2012 10:37] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04639 seconds