src/share/classes/javax/swing/text/GapContent.java

Print this page

        

*** 708,718 **** * @param v the Vector to use, with a new one created on null * @param offset the starting offset &gt;= 0 * @param length the length &gt;= 0 * @return the set of instances */ ! protected Vector getPositionsInRange(Vector v, int offset, int length) { int endOffset = offset + length; int startIndex; int endIndex; int g0 = getGapStart(); int g1 = getGapEnd(); --- 708,719 ---- * @param v the Vector to use, with a new one created on null * @param offset the starting offset &gt;= 0 * @param length the length &gt;= 0 * @return the set of instances */ ! protected Vector<UndoPosRef> getPositionsInRange(Vector<UndoPosRef> v, ! int offset, int length) { int endOffset = offset + length; int startIndex; int endIndex; int g0 = getGapStart(); int g1 = getGapEnd();
*** 736,747 **** else { startIndex = findMarkAdjustIndex(offset + (g1 - g0)); endIndex = findMarkAdjustIndex(endOffset + (g1 - g0) + 1); } ! Vector placeIn = (v == null) ? new Vector(Math.max(1, endIndex - ! startIndex)) : v; for (int counter = startIndex; counter < endIndex; counter++) { placeIn.addElement(new UndoPosRef(marks.elementAt(counter))); } return placeIn; --- 737,749 ---- else { startIndex = findMarkAdjustIndex(offset + (g1 - g0)); endIndex = findMarkAdjustIndex(endOffset + (g1 - g0) + 1); } ! Vector<UndoPosRef> placeIn = (v == null) ? ! new Vector<>(Math.max(1, endIndex - startIndex)) : ! v; for (int counter = startIndex; counter < endIndex; counter++) { placeIn.addElement(new UndoPosRef(marks.elementAt(counter))); } return placeIn;
*** 754,764 **** * This is meant for internal usage, and is generally not of interest * to subclasses. * * @param positions the UndoPosRef instances to reset */ ! protected void updateUndoPositions(Vector positions, int offset, int length) { // Find the indexs of the end points. int endOffset = offset + length; int g1 = getGapEnd(); int startIndex; --- 756,766 ---- * This is meant for internal usage, and is generally not of interest * to subclasses. * * @param positions the UndoPosRef instances to reset */ ! protected void updateUndoPositions(Vector<UndoPosRef> positions, int offset, int length) { // Find the indexs of the end points. int endOffset = offset + length; int g1 = getGapEnd(); int startIndex;
*** 771,781 **** startIndex = 0; } // Reset the location of the refenences. for(int counter = positions.size() - 1; counter >= 0; counter--) { ! UndoPosRef ref = (UndoPosRef)positions.elementAt(counter); ref.resetLocation(endOffset, g1); } // We have to resort the marks in the range startIndex to endIndex. // We can take advantage of the fact that it will be in // increasing order, accept there will be a bunch of MarkData's with --- 773,783 ---- startIndex = 0; } // Reset the location of the refenences. for(int counter = positions.size() - 1; counter >= 0; counter--) { ! UndoPosRef ref = positions.elementAt(counter); ref.resetLocation(endOffset, g1); } // We have to resort the marks in the range startIndex to endIndex. // We can take advantage of the fact that it will be in // increasing order, accept there will be a bunch of MarkData's with
*** 898,908 **** /** The string that was inserted. This will only be valid after an * undo. */ protected String string; /** An array of instances of UndoPosRef for the Positions in the * range that was removed, valid after undo. */ ! protected Vector posRefs; } // GapContent.InsertUndo /** * UndoableEdit created for removes. --- 900,910 ---- /** The string that was inserted. This will only be valid after an * undo. */ protected String string; /** An array of instances of UndoPosRef for the Positions in the * range that was removed, valid after undo. */ ! protected Vector<UndoPosRef> posRefs; } // GapContent.InsertUndo /** * UndoableEdit created for removes.
*** 950,957 **** protected int length; /** The string that was removed. This is valid when redo is valid. */ protected String string; /** An array of instances of UndoPosRef for the Positions in the * range that was removed, valid before undo. */ ! protected Vector posRefs; } // GapContent.RemoveUndo } --- 952,959 ---- protected int length; /** The string that was removed. This is valid when redo is valid. */ protected String string; /** An array of instances of UndoPosRef for the Positions in the * range that was removed, valid before undo. */ ! protected Vector<UndoPosRef> posRefs; } // GapContent.RemoveUndo }