### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.ui Index: ui/org/eclipse/jdt/internal/ui/propertiesfileeditor/PropertiesFileAutoEditStrategy.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/propertiesfileeditor/PropertiesFileAutoEditStrategy.java,v retrieving revision 1.1 diff -u -r1.1 PropertiesFileAutoEditStrategy.java --- ui/org/eclipse/jdt/internal/ui/propertiesfileeditor/PropertiesFileAutoEditStrategy.java 22 Oct 2010 11:26:49 -0000 1.1 +++ ui/org/eclipse/jdt/internal/ui/propertiesfileeditor/PropertiesFileAutoEditStrategy.java 23 Oct 2010 04:58:58 -0000 @@ -26,20 +26,23 @@ * @see org.eclipse.jface.text.IAutoEditStrategy#customizeDocumentCommand(org.eclipse.jface.text.IDocument, org.eclipse.jface.text.DocumentCommand) */ public void customizeDocumentCommand(IDocument document, DocumentCommand command) { - command.text= escape(command.text); + String text= command.text; + if (text.equals(escape(text, false))) + return; + command.text= escape(text, text.length() > 1); } - private static String escape(String s) { + private static String escape(String s, boolean escapeSlash) { StringBuffer sb= new StringBuffer(s.length()); int length= s.length(); for (int i= 0; i < length; i++) { char c= s.charAt(i); - sb.append(escape(c)); + sb.append(escape(c, escapeSlash)); } return sb.toString(); } - private static String escape(char c) { + private static String escape(char c, boolean escapeSlash) { switch (c) { case '\t': return "\t";//$NON-NLS-1$ @@ -50,8 +53,10 @@ case '\r': return "\r";//$NON-NLS-1$ case '\\': - return "\\";//$NON-NLS-1$ - + if (escapeSlash) + return "\\\\";//$NON-NLS-1$ + else + return "\\"; //$NON-NLS-1$ default: return PropertiesFileEscapes.escape(c); }