Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 64683 - DocumentSetup extensions based on ContentType not recognized
Summary: DocumentSetup extensions based on ContentType not recognized
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 blocker (vote)
Target Milestone: 3.0 RC2   Edit
Assignee: Kai-Uwe Maetzel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-29 18:19 EDT by David Williams CLA
Modified: 2004-06-11 09:31 EDT (History)
0 users

See Also:


Attachments
patch wihout end-of-line mis-wrapping (751 bytes, text/plain)
2004-05-29 19:08 EDT, David Williams CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Williams CLA 2004-05-29 18:19:37 EDT
I've marked as "blocking" since this prevents implementing document setup 
participants based on contentType and I don't know of a good work around. [Note: 
I believe the "ant based document setup" works simply because it also uses 
extensions.]

I've tried to create a simple setup participant as follows (note: no extensions 
used deliberately):

	<extension point="org.eclipse.core.filebuffers.documentSetup"
		id="com.ibm.sse.model.xml.XMLDocumentSetup.xml.xmlsource"
		name="Structured XML Document Setup">
		<participant
            contentTypeId="com.ibm.sse.model.xml.xmlsource"
			class="com.ibm.sse.model.xml.internal.filebuffers.
SetupParticipantForXML">
		</participant>
	</extension>


I've encountered several bugs in doing so, but the first one was that it seemed 
not to be getting detected/registered correctly. If I understand this code 
right, there seems to be a copy/paste error in 
getDocumentSetupParticipants(contentType), as fixed by following simply patch

Index: ExtensionsRegistry.java
===================================================================
RCS file: /home/eclipse/org.eclipse.core.
filebuffers/src/org/eclipse/core/internal/filebuffers/ExtensionsRegistry.java,v
retrieving revision 1.8
diff -u -r1.8 ExtensionsRegistry.java
--- ExtensionsRegistry.java	6 May 2004 17:52:58 -0000	1.8
+++ ExtensionsRegistry.java	29 May 2004 21:56:16 -0000
@@ -334,7 +334,7 @@
 		Set resultSet= new HashSet();
 		int i= 0;
 		while (i < contentTypes.length) {
-			Set set= (Set) fFactoryDescriptors.get(new 
ContentTypeAdapter(contentTypes[i++]));
+			Set set= (Set) fSetupParticipantDescriptors.get(new 
ContentTypeAdapter(contentTypes[i++]));
 			if (set != null)
 				resultSet.addAll(set);
 		}
Comment 1 David Williams CLA 2004-05-29 18:21:30 EDT
Just corrected abstract to say 'extensions' instead of 'classes'
Comment 2 David Williams CLA 2004-05-29 19:08:31 EDT
Created attachment 11308 [details]
patch wihout end-of-line mis-wrapping

Just realized the intended "patch" above (in text) is probably not usabile
since web interface wraps text and changes "new lines", so appending as
attachment.
Comment 3 Kai-Uwe Maetzel CLA 2004-06-03 12:07:28 EDT
Confirmed access to invalid descriptor set.
Fixed in build I200406040800.
Comment 4 Andre Weinand CLA 2004-06-11 09:31:39 EDT
verified by code inspection in I20040611