Bug 34205 Wrap string produces incorrect code
Balance string is turned off, wrap string on. User is entering a list of string constants, e.g., public static final String[] KEYWORDS = new String[] { "a", "b", //... }; To make data entry go faster, user copies to clipboard the "continuation" of each line, e.g., the characters: ", " Now, user types, "c and pastes the continuation, expecting to see: "c", " Instead, the generated code is: "c"," + " " I can't think of a satisfactory explanation for this result; it seems to be a plain old bug. But the correct behavior would be to recognize that the leading " in the pasted text completes a string on the same line and the trailing " starts a new string on a new line, so no string is being continued and there is no need for a continuation.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaStringAutoIndentStrategy.java
/*******************************************************************************
 * Copyright (c) 2000, 2003 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jdt.internal.ui.text.java;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.DefaultAutoIndentStrategy;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.DocumentCommand;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITypedRegion;
import org.eclipse.jdt.ui.PreferenceConstants;
import org.eclipse.jdt.internal.ui.JavaPlugin;
/**
 * Auto indent strategy for java strings
 */
public class JavaStringAutoIndentStrategy extends DefaultAutoIndentStrategy {