| 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: | Ant | Assignee: | 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
Dani Megert
This should do the trick:
public AntEditorDocumentProvider() {
IDocumentProvider provider= new TextFileDocumentProvider(new AntStorageDocumentProvider());
provider= new ForwardingDocumentProvider(AntDocumentSetupParticipant.ANT_PARTITIONING, new AntDocumentSetupParticipant(), provider);
setParentDocumentProvider(provider);
}
Thanks Dani. Will apply and likely propose for 3.2.1 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. Created attachment 46379 [details]
Proposed fix.
I rolled back the changes from bug 104320 (which provides the same behavior as the patch) to fix the problem. Released for 3.3 Released to 3.2.1 Please verify Kevin. Please verify Kevin. 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? 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). verified |