Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » icon decoration order for content type(bug?)
icon decoration order for content type [message #779463] Sun, 15 January 2012 20:19 Go to next message
valentin Mising name is currently offline valentin Mising name
Messages: 36
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

Re: icon decoration order for content type [message #783197 is a reply to message #779463] Wed, 25 January 2012 09:15 Go to previous messageGo to next message
valentin Mising name is currently offline valentin Mising name
Messages: 36
Registered: December 2011
Member
In short, I have realized that I can enrich my navigator with problem markers by attacting the jdt.java.ui.javaContent contentExtension with plugin.xml. This worked in some environments, but stopped for txt files in the other, because of icon "caching". Should I report this as a eclipse bug?
Re: icon decoration order for content type [message #783216 is a reply to message #783197] Wed, 25 January 2012 09:53 Go to previous messageGo to next message
Dani Megert is currently offline Dani Megert
Messages: 3801
Registered: July 2009
Senior Member
On 25.01.2012 10:15, valentin Mising name wrote:
> In short, I have realized that I can enrich my navigator with problem
> markers by attacting the jdt.java.ui.javaContent contentExtension with
> plugin.xml. This worked in some environments, but stopped for txt
> files in the other,
What do mean with "stopped for txt files"?

Dani
> because of icon "caching". Should I report this as a eclipse bug?
Re: icon decoration order for content type [message #800744 is a reply to message #783216] Fri, 17 February 2012 12:43 Go to previous message
valentin Mising name is currently offline valentin Mising name
Messages: 36
Registered: December 2011
Member
I think that it was visible for text files initially but now it is not. I do not remember. I just see that icon is not visible in Project Explorer in my installation. But, if I "export as product" then it appears visible in the product.
Previous Topic:Spellchecking of non-English languages
Next Topic:DocumentProvider for external opened files
Goto Forum:
  


Current Time: Mon Oct 20 18:15:41 GMT 2014

Powered by FUDForum. Page generated in 0.17990 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software