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

Bug 64692

Summary: createEmptyDocument doesn't work with contentType
Product: [Eclipse Project] Platform Reporter: David Williams <david_williams>
Component: TextAssignee: Kai-Uwe Maetzel <kai-uwe_maetzel>
Status: VERIFIED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: thatnitind
Version: 3.0   
Target Milestone: 3.0 RC2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch for above problem none

Description David Williams CLA 2004-05-30 01:41:22 EDT
Once I'd gotten past https://bugs.eclipse.org/bugs/show_bug.cgi?id=64690, 
I quickly ran into next problem in my recent transition to content types and 
document creation factories. 

If a document creation factory is associated with (only) a contentTypeId, then 
createEmptyDocument doesn't create the right kind of document. 

There's no test case in base, since there is no document creation factory 
associated with (only) content type id, but can easily be re-created with small 
changes. First, start with the test case provided in 64690 (without the 
incorrect 'connect' as mentioned in 64690), and change the "nonexistent.txt" 
file name to have a .java extenstion. Second, change the java document creation 
(in jdt.ui) from the extension = "java" to  contentTypeId="org.eclipse.jdt.core.
javaSource". Then, by walking though breakpoints in the test case, you can see 
wrong document type is created, without the attached patch.
Comment 1 David Williams CLA 2004-05-30 01:47:50 EDT
Created attachment 11311 [details]
patch for above problem

The method findContentTypes(IPath) returns too soon if file doesn't exist. It
should just defer to contentTypeManager in those cases, so the file/path name
can be taken into account.
Comment 2 Kai-Uwe Maetzel CLA 2004-06-07 06:08:01 EDT
Content type handling is now in sync with extension and file name handling.
Fixed build I200406071200. 
Comment 3 Dani Megert CLA 2004-06-11 05:14:26 EDT
start verifying (dm)
Comment 4 Dani Megert CLA 2004-06-11 06:10:14 EDT
verified in I200406110010 through code inspection