Bug 47674 Formatting problem with paste
M5: - create class Bar with this code: public class Bar { void foo() { int i= 1; if (i == 2) { i= 1; } i= 2; } } - select full line "i= 2" and cut to clipboard - paste line inside if-statement Observe: the closing bracket is indented public class Bar { void foo() { int i= 1; if (i == 2) { i= 1; i= 2; } } }
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaAutoIndentStrategy.java
DefaultPartitioner partitioner= new DefaultPartitioner(new FastJavaPartitionScanner(), types);
			partitioner.connect(temp);
			temp.setDocumentPartitioner(IJavaPartitions.JAVA_PARTITIONING, partitioner);
			
			int lines= temp.getNumberOfLines();
			for (int l= document.computeNumberOfLines(prefix); l < lines; l++) { 
				IRegion r= temp.getLineInformation(l);
				lineOffset= r.getOffset();
				int lineLength= r.getLength();
				
				if (lineLength == 0) 
					continue;
				
				if (lineOffset < temp.getLength() - 1) {
					
					String s= temp.get(lineOffset, 2);
					if ("//".equals(s)) { 
						continue;
					}
				}
				
				StringBuffer indent= indenter.computeIndentation(lineOffset);
				if (indent == null) 
					return;
				
				
				ITypedRegion partition= temp.getPartition(IJavaPartitions.JAVA_PARTITIONING, lineOffset);
				String type= partition.getType();
				if (type.equals(IJavaPartitions.JAVA_DOC) || type.equals(IJavaPartitions.JAVA_MULTI_LINE_COMMENT))
					if (partition.getOffset() != lineOffset)