Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 150825

Summary: No syntax coloring if Ant Editor is associated with different content type or extension
Product: [Eclipse Project] Platform Reporter: Dani Megert <daniel_megert>
Component: AntAssignee: Kevin Barnes <cocoakevin>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Darin_Swanson, mark.melvin
Version: 3.2   
Target Milestone: 3.2.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed fix. none

Description Dani Megert CLA 2006-07-17 12:13:17 EDT
R3.2

1. associate the Ant Editor with *.txt
2. copy some build.xml content into new file test.txt
3. open test.txt with the Ant Editor
==> no syntax coloring.

This used to work in R3.1.x

Most likely a regression caused by bug 104320. As I outlined in said bug Ant needs to use a ForwardingDocumentProvider which seems not to be the case.
Comment 1 Dani Megert CLA 2006-07-17 12:26:55 EDT
This should do the trick:

	public AntEditorDocumentProvider() {
		IDocumentProvider provider= new TextFileDocumentProvider(new AntStorageDocumentProvider());
		provider= new ForwardingDocumentProvider(AntDocumentSetupParticipant.ANT_PARTITIONING, new AntDocumentSetupParticipant(), provider);
		setParentDocumentProvider(provider);
	}
Comment 2 Darin Swanson CLA 2006-07-17 12:29:43 EDT
Thanks Dani.

Will apply and likely propose for 3.2.1
Comment 3 Dani Megert CLA 2006-07-17 12:53:50 EDT
In fact the suggested code will not work because Ant seems to be smarter than all other editors: it creates an Ant file info even if the file is not recognized as Ant content type or file extension. Hence the ForwardingDocumentProvider won't kick in.

If you think that it is correct/needed to have the Ant file info (that's OK) in this case then you should discard comment 1 and use the attached patch.
Comment 4 Dani Megert CLA 2006-07-17 12:55:07 EDT
Created attachment 46379 [details]
Proposed fix.
Comment 5 Darin Swanson CLA 2006-07-21 18:54:09 EDT
I rolled back the changes from bug 104320 (which provides the same behavior as the patch) to fix the problem.

Released for 3.3
Comment 6 Darin Swanson CLA 2006-07-21 18:57:38 EDT
Released to 3.2.1
Comment 7 Darin Swanson CLA 2006-07-21 18:57:55 EDT
Please verify Kevin.
Comment 8 Darin Swanson CLA 2006-07-21 19:01:27 EDT
Please verify Kevin.
Comment 9 Mark Melvin CLA 2006-07-24 09:46:20 EDT
Bug #104320 seems to chastise you for calling IDocumentSetupParticipant.setup(IDocument) directly, but the patch here seems to do exactly that.  Why is it OK in this case?
Comment 10 Darin Swanson CLA 2006-07-24 10:15:33 EDT
My reasoning comes for the comment in the code:
	//This is a required workaround for the disconnect between workbench file associations
	//and content types based document setup and creation
	//This ensures that a workbench file association for the AntEditor will have a document
	//that is setup with the correct document setup participant since it was "missed" by the 
	//document setup extensions (bug 72598).
Comment 11 Kevin Barnes CLA 2006-08-08 09:27:13 EDT
verified