Author: dazarov
Date: 2012-01-23 14:57:46 -0500 (Mon, 23 Jan 2012)
New Revision: 38044
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/MarkerResolutionUtils.java
Log:
Add the code which is supposed to be inserted by the Quick Fix into its description
https://issues.jboss.org/browse/JBIDE-10636
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/MarkerResolutionUtils.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/MarkerResolutionUtils.java 2012-01-23
19:09:36 UTC (rev 38043)
+++
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/MarkerResolutionUtils.java 2012-01-23
19:57:46 UTC (rev 38044)
@@ -608,8 +608,6 @@
private ArrayList<TextEdit> edits = new ArrayList<TextEdit>();
private ArrayList<Region> regions = new ArrayList<Region>();
- //private int lastOffset = 0;
-
public EditSet(TextEdit edit){
addEdits(edit);
sort();
@@ -658,27 +656,15 @@
text = ((ReplaceEdit) edit).getText();
addings = text.length()-edit.getLength();
}else if(edit instanceof DeleteEdit){
-// text = NEW_LINE+current.substring(edit.getOffset(),
edit.getOffset()+edit.getLength());
- //addings = -text.length();
-
int offset = edit.getOffset()+delta;
int length = edit.getLength();
- regions.add(new Region(offset, length));
- //lastOffset = offset+length;
-//
-// // select
-// String before = preview.substring(0, offset);
-// String after = preview.substring(offset);
-// preview = before+OPEN_DEL+text+CLOSE_DEL+after;
-//
-// delta += OPEN_DEL.length()+CLOSE_DEL.length()+addings;
-// text = null;
+ regions.add(new Region(offset, 0));
+ delta -= length;
}
if(text != null){
int offset = edit.getOffset()+delta;
int length = text.length();
regions.add(new Region(offset, length));
- //lastOffset = offset+length;
// select
String before = preview.substring(0, offset);
@@ -701,6 +687,9 @@
if(prevRegion != null){
lowLimit = prevRegion.offset+prevRegion.length;
}
+ if(position > preview.length()-1){
+ position = preview.length()-1;
+ }
while(position >= lowLimit){
char c = preview.charAt(position);
if(c == C_NEW_LINE){
@@ -751,7 +740,9 @@
if(index == 0 && region.offset != 0){
buffer.append(DOTS+NEW_LINE);
}
- buffer.append(preview.substring(region.offset, region.offset + region.length));
+ if(region.length > 0){
+ buffer.append(preview.substring(region.offset, region.offset + region.length));
+ }
if((region.offset + region.length) < (preview.length()-1)){
if(index == regions.size()-1){
buffer.append(NEW_LINE+DOTS);