Bug 4086 Format problem in single element mode (1GKPJI8)
EG (27.09.2001 12:32:36) from WSAD newsgoup If you select Format (from the popup menu when you right click on .java file) while in "View selected element only" mode (ie - looking at only one method) the auot format adds a large amount of whitespace to the begining of each line. Repeated "Formats" just add more space. You then have to go to the "whole document" view and reformat the entire document to fix this (well, I guess I could manual remove the whitespace, but then what's the point of autoformat?). NOTES: EG (10.10.2001 22:38:03) pls investigate whether this is the formatting strategy or the Java editor
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/codemanipulation/StubUtility.java
* @param method A method template (method belongs to different type than the parent)
	 * @param imports Imports required by the sub are added to the imports structure
	 * @throws JavaModelException
	 */
	public static String genStub(IType parenttype, IMethod method, IImportsStructure imports) throws JavaModelException {
		boolean callSuper= !Flags.isAbstract(method.getFlags()) && !Flags.isStatic(method.getFlags())
			&& method.getDeclaringType().isClass();
		return genStub(parenttype, method, callSuper, true, imports);
	}
	/**
	 * Generates a stub. Given a template method, a stub with the same signature
	 * will be constructed so it can be added to a type.
	 * @param parenttype The type to which the method will be added to
	 * @param method A method template (method belongs to different type than the parent)
	 * @param callSuper If set a super call will be added to the method body
	 * @param imports Imports required by the sub are added to the imports structure
	 * @throws JavaModelException
	 */
	public static String genStub(IType parenttype, IMethod method, boolean callSuper, boolean addSeeTag, IImportsStructure imports) throws JavaModelException {
		IType declaringtype= method.getDeclaringType();	
		StringBuffer buf= new StringBuffer();
		String[] paramTypes= method.getParameterTypes();
		String[] paramNames= method.getParameterNames();
		String[] excTypes= method.getExceptionTypes();
		String retTypeSig= method.getReturnType();
		
		int lastParam= paramTypes.length -1;		
		if (!method.isConstructor()) {
			
			if (addSeeTag) {