Bug 107128 [typing] Move lines destroys indentation of outcommented code
I20050811-1530 Move lines destroys the indentation of code that has been commented out. IMO, Move lines should never try to be smart about the contents of a commented section. It should just add/remove whitespace in front of the // (same behavior as when moving other statements). public class Klass { int bar; // void foo() { // System.out.println("foo"); // } } - select the 3 commented lines - press Alt+Up -> document looks like this (note the removed tab in fromt of System.out.pr...): public class Klass { // void foo() { // System.out.println("foo"); // } int bar; }
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/IndentAction.java
/**
	 * Returns if the current selection is valid, i.e. whether it is empty and the caret in the 
	 * whitespace at the start of a line, or covers multiple lines.
	 * 
	 * @return <code>true</code> if the selection is valid for an indent operation
	 */
	private boolean isValidSelection() {
		ITextSelection selection= getSelection();
		if (selection.isEmpty())
			return false;
		
		int offset= selection.getOffset();
		int length= selection.getLength();
		
		IDocument document= getDocument();
		if (document == null)
			return false;
		
		try {
			IRegion firstLine= document.getLineInformationOfOffset(offset);
			int lineOffset= firstLine.getOffset();
			
			
			
			if (length == 0)
				return document.get(lineOffset, offset - lineOffset).trim().length() == 0;
			else
				return false; 
			
		} catch (BadLocationException e) {