// {{{ drop() method @SuppressWarnings("deprecation") @Override public void drop(DropTargetDropEvent dtde) { Log.log(Log.DEBUG, this, "Drop"); textArea.setDragInProgress(false); // textArea.getBuffer().endCompoundEdit(); savedBuffer = null; } // }}}
// {{{ dragEnter() method @SuppressWarnings("deprecation") @Override public void dragEnter(DropTargetDragEvent dtde) { Log.log(Log.DEBUG, this, "Drag enter"); savedBuffer = textArea.getBuffer(); textArea.setDragInProgress(true); // textArea.getBuffer().beginCompoundEdit(); savedCaret = textArea.getCaretPosition(); } // }}}
// {{{ dragExit() method @SuppressWarnings("deprecation") @Override public void dragExit(DropTargetEvent dtde) { Log.log(Log.DEBUG, this, "Drag exit"); textArea.setDragInProgress(false); // textArea.getBuffer().endCompoundEdit(); if (textArea.getBuffer() == savedBuffer) { textArea.moveCaretPosition(savedCaret, TextArea.ELECTRIC_SCROLL); } savedBuffer = null; } // }}}
// {{{ dump() method void dump() { if (Debug.FOLD_VIS_DEBUG) { StringBuilder buf = new StringBuilder("{"); for (int i = 0; i < fvmcount; i++) { if (i != 0) buf.append(','); buf.append(fvm[i]); } buf.append('}'); Log.log(Log.DEBUG, this, "fvm = " + buf); } } // }}}
/** Merge previous and next entry if necessary. */ void put2(int starti, int endi, int start, int end) { if (Debug.FOLD_VIS_DEBUG) { Log.log(Log.DEBUG, this, "*fvmput2(" + starti + "," + endi + "," + start + "," + end + ")"); } if (starti != -1 && fvm[starti] == start) { if (endi <= fvmcount - 2 && fvm[endi + 1] == end + 1) { put(starti, endi + 2, null); } else { put(starti, endi + 1, new int[] {end + 1}); } } else { if (endi != fvmcount - 1 && fvm[endi + 1] == end + 1) { put(starti + 1, endi + 2, new int[] {start}); } else { put(starti + 1, endi + 1, new int[] {start, end + 1}); } } } // }}}
/** * Replaces from <code>start</code> to <code>end-1</code> inclusive with <code>put</code>. Update * <code>fvmcount</code>. */ void put(int start, int end, int[] put) { if (Debug.FOLD_VIS_DEBUG) { StringBuilder buf = new StringBuilder(50); buf.append("fvmput(").append(start).append(','); buf.append(end).append(','); buf.append('{'); if (put != null) { for (int i = 0; i < put.length; i++) { if (i != 0) buf.append(','); buf.append(put[i]); } } buf.append("})"); Log.log(Log.DEBUG, this, buf.toString()); } int putl = put == null ? 0 : put.length; int delta = putl - (end - start); if (fvmcount + delta > fvm.length) { int[] newfvm = new int[(fvm.length << 1) + 1]; System.arraycopy(fvm, 0, newfvm, 0, fvmcount); fvm = newfvm; } if (delta != 0) { System.arraycopy(fvm, end, fvm, start + putl, fvmcount - end); } if (putl != 0) { System.arraycopy(put, 0, fvm, start, put.length); } fvmcount += delta; dump(); if (fvmcount == 0) throw new InternalError(); } // }}}