1 11 package org.eclipse.jdt.internal.core; 12 13 import org.eclipse.jdt.core.IBuffer; 14 import org.eclipse.jface.text.BadLocationException; 15 import org.eclipse.jface.text.Document; 16 17 20 public class DocumentAdapter extends Document { 21 22 private IBuffer buffer; 23 24 public DocumentAdapter(IBuffer buffer) { 25 super(buffer.getContents()); 26 this.buffer = buffer; 27 } 28 29 public void set(String text) { 30 super.set(text); 31 this.buffer.setContents(text); 32 } 33 34 public void replace(int offset, int length, String text) throws BadLocationException { 35 super.replace(offset, length, text); 36 this.buffer.replace(offset, length, text); 37 } 38 39 } 40 | Popular Tags |