Bug 30468 enhanced smart pasting
consider the following file: public class Test { public void method() { String x = "hello"; } public class C { } } ------------------- if you select the method starting the 'p' in "public void method()" and paste it just below with smart pasting enabled you get the following: public class Test { public void method() { String x = "hello"; } public void method() { String x = "hello"; } public class C { } } If you then paste it as part of class C you get the following: public class Test { public void method() { String x = "hello"; } public void method() { String x = "hello"; } public class C { public void method() { String x = "hello"; } } } It would be nice if the brackets line up with the method. This can probably be achieved if you treat the first line of the pasted text as different to the other lines because you cannot guarentee that text selection will always start from the beginning of the line with the correct ammount of tabs/spaces in the first line of a selection.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/JavaIndenter.java
* is set to <code>JavaHeuristicScanner.NOT_FOUND</code>.
	 * 
	 * @param position the position for which the reference is computed
	 * @return the reference statement relative to which <code>position</code> should be indented.
	 */
	public int findReferencePosition(int position) {
		return findReferencePosition(position, false, false);
	}
	
	/**
	 * Returns the reference position regarding to indentation for <code>position</code>, or
	 * <code>NOT_FOUND</code>. <code>fIndent</code> will contain the relative indentation (in 
	 * indentation units, not characters) after the call. If there is a special alignment (e.g. for
	 * a method declaration where parameters should be aligned), <code>fAlign</code> will contain the absolute
	 * position of the alignment reference in <code>fDocument</code>, otherwise <code>fAlign</code>
	 * is set to <code>JavaHeuristicScanner.NOT_FOUND</code>.
	 * 
	 * @param position the position for which the reference is computed
	 * @param danglingElse whether a dangling else should be assumed at <code>position</code>
	 * @param matchBrace whether the position of the matching brace should be returned instead of doing code analysis
	 * @return the reference statement relative to which <code>position</code> should be indented.
	 */
	private int findReferencePosition(int position, boolean danglingElse, boolean matchBrace) {
		fIndent= 0; 
		fAlign= JavaHeuristicScanner.NOT_FOUND;
		fPosition= position;
		
		boolean indentBlockLess= true; 
		boolean takeNextExit= true; 
		boolean found= false;