Bug 48641 [typing] Smart paste "fixes" comments
A new feature was added to M5 where smart paste fixes C style comments into Java style comments: /* * */ becomes: /* * */ The problem is that we have lots of text that is formatted the using C style and using smart paste makes the code inconistent. I don't use the feature but others on the team do. Shouldn't smart paste just indent the code?
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaAutoIndentStrategy.java
String prefix= baseIndent + document.get(refPos, command.offset - refPos);
			Document temp= new Document(prefix + command.text);
			
			
			
			region= temp.getLineInformation(temp.getNumberOfLines() - 1);
			boolean eatAfterSpace= temp.get(region.getOffset(), region.getLength()).trim().length() == 0;
			String afterContent= new String();
			if (eatAfterSpace) {
				int selectionEnd= command.offset + command.length;
				region= document.getLineInformationOfOffset(selectionEnd);
				endOfWS= scanner.findNonWhitespaceForwardInAnyPartition(selectionEnd, region.getOffset() + region.getLength());
				if (endOfWS != JavaHeuristicScanner.NOT_FOUND) {
					int token= scanner.nextToken(selectionEnd, region.getOffset() + region.getLength());
					if (token != Symbols.TokenEOF && token != Symbols.TokenCASE) { 
						command.length += endOfWS - selectionEnd;
						afterContent= document.get(endOfWS, scanner.getPosition() - endOfWS);
					}
				} else {
					
					command.length += region.getOffset() + region.getLength() - selectionEnd;
					afterContent= "x"; 
				}
			}
			
			
			temp.replace(temp.getLength(), 0, afterContent);
			
			scanner= new JavaHeuristicScanner(temp);
			indenter= new JavaIndenter(temp, scanner);