View | Details | Raw Unified | Return to bug 197999 | Differences between
and this patch

Collapse All | Expand All

(-)test cases/org/eclipse/jdt/ui/tests/refactoring/nls/PropertyFileDocumentModellTest.java (+16 lines)
Lines 151-156 Link Here
151
				"key_y=value\n" + 
151
				"key_y=value\n" + 
152
				"key_z=value\n", props.get());
152
				"key_z=value\n", props.get());
153
	}
153
	}
154
	
155
	public void testManyInsertsIntoDoc3() throws Exception {
156
		Document props= new Document(
157
				"key_a=value\n" +
158
				"\n" +
159
				"key_b_2=value\n");
160
		
161
		insert(props, new KeyValuePair[] {new KeyValuePair("key_b_1", "value"), new KeyValuePair("key_b_0", "value")});
162
163
		assertEquals(
164
				"key_a=value\n" +
165
				"\n" +
166
				"key_b_0=value\n" +
167
				"key_b_1=value\n" +
168
				"key_b_2=value\n", props.get());
169
	}
154
170
155
	public void testBlockInsertsIntoDoc() throws Exception {
171
	public void testBlockInsertsIntoDoc() throws Exception {
156
		Document props= new Document(
172
		Document props= new Document(
(-)core refactoring/org/eclipse/jdt/internal/corext/refactoring/nls/PropertyFileDocumentModel.java (+4 lines)
Lines 74-79 Link Here
74
				offset-= insertHere.fLeadingWhiteSpaces;
74
				offset-= insertHere.fLeadingWhiteSpaces;
75
			} else if (distBefore == distAfter && Collator.getInstance().compare(beforeKey, afterKey) < 0) {
75
			} else if (distBefore == distAfter && Collator.getInstance().compare(beforeKey, afterKey) < 0) {
76
				offset-= insertHere.fLeadingWhiteSpaces;
76
				offset-= insertHere.fLeadingWhiteSpaces;
77
			} else {
78
				//insert it before afterKey -> move the leading white spaces to the inserted pair
79
				keyValuePairModell.fLeadingWhiteSpaces= insertHere.fLeadingWhiteSpaces;
80
				insertHere.fLeadingWhiteSpaces= 0;
77
			}
81
			}
78
        }
82
        }
79
        
83
        

Return to bug 197999