Bug 84983 [typing] imports disappear
I20050209-0800 + JDT UI from HEAD 1. open a CU with several imports 2. enable folding (ensure imports are folded) 3. remove code so that first import is no longer needed 4. run Organize Imports ==> all imports are gone 5. close and re-open the editor ==> imports are back
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/folding/DefaultJavaFoldingStructureProvider.java
if (fCachedDocument == null)
			return null;
		
		
		ISourceRange range= type.getSourceRange();
		if (range == null)
			return null;
		int start= 0;
		int end= range.getOffset();
		
		if (fInput instanceof ISourceReference) {
			String content;
			try {
				content= fCachedDocument.get(start, end - start);
			} catch (BadLocationException e) {
				return null; 
			}
			
			/* code adapted from CommentFormattingStrategy:
			 * scan the header content up to the first type. Once a comment is
			 * found, accumulate any additional comments up to the stop condition.
			 * The stop condition is reaching a package declaration, import container,
			 * or the end of the input.
			 */
			IScanner scanner= ToolFactory.createScanner(true, false, false, false);
			scanner.setSource(content.toCharArray());
			int headerStart= -1;
			int headerEnd= -1;
			try {
				boolean foundComment= false;