Bug 51093 [typing] Pressing enter after an opening curly brace closes the curly brace repeatedly.
Pressing enter after an opening curly brace closes the curly brace repeatedly. IF you are about to define a method and you open a curly brace, the completion closing curly brace is added automatically. If you go and press "enter" again in front of the opening curly brace , it adds another closing brace repeatedly.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaAutoIndentStrategy.java
IJavaPartitions.JAVA_MULTI_LINE_COMMENT,
									  IJavaPartitions.JAVA_SINGLE_LINE_COMMENT,
									  IJavaPartitions.JAVA_STRING,
									  IJavaPartitions.JAVA_CHARACTER,
									  IDocument.DEFAULT_CONTENT_TYPE
		};
		DefaultPartitioner partitioner= new DefaultPartitioner(new FastJavaPartitionScanner(), types);
		partitioner.connect(document);
		document.setDocumentPartitioner(IJavaPartitions.JAVA_PARTITIONING, partitioner);
	}
	private static void smartPaste(IDocument document, DocumentCommand command) {
		try {
			JavaHeuristicScanner scanner= new JavaHeuristicScanner(document);
			JavaIndenter indenter= new JavaIndenter(document, scanner);
			int offset= command.offset;
			
			
			int refOffset= indenter.findReferencePosition(offset);
			if (refOffset == JavaHeuristicScanner.NOT_FOUND)
				return;
			int peerOffset= getPeerPosition(document, command);
			peerOffset= indenter.findReferencePosition(peerOffset);
			refOffset= Math.min(refOffset, peerOffset);
			
			
			int firstLine= 1; 
			IRegion line= document.getLineInformationOfOffset(offset);
			String notSelected= document.get(line.getOffset(), offset - line.getOffset());
			if (notSelected.trim().length() == 0) {
				command.length += notSelected.length();