Bug 26599 BadLocationException in JavaAutoIndentStrategy
I20021115: - Open the Java editor - select/copy a couple of lines with soem indentation - select all lines and delete them - paste them into the empty editor -> JavaAutoIndentStrategy.calcShiftBackReplace: BadLocationException
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaAutoIndentStrategy.java
* The result can be compared against the print margin.
	 */
	private static int calculateDisplayedWidth(String string) {
		final int tabWidth= JavaPlugin.getDefault().getPreferenceStore().getInt(PreferenceConstants.EDITOR_TAB_WIDTH); 
		
		int column= 0;
		for (int i= 0; i < string.length(); i++)
			if ('\t' == string.charAt(i))
				column += tabWidth - (column % tabWidth);
			else
				column++;
				
		return column;
	}
	
	private String getIndent(IDocument d, DocumentCommand c) {
		if (c.offset < 0)
			return null;
		
		try {
			int p= (c.offset == d.getLength() ? c.offset - 1 : c.offset);
			int line= d.getLineOfOffset(p);
			
			int indLine= findMatchingOpenBracket(d, line, c.offset, 1);
			if (indLine != -1 && indLine != line)
				
				return getIndentOfLine(d, indLine);
		} catch (BadLocationException excp) {
			System.out.println(JavaTextMessages.getString("AutoIndent.error.bad_location.message1")); 
		}