1 11 package org.eclipse.jface.text; 12 13 import org.eclipse.core.runtime.Assert; 14 15 16 21 class DocumentClone extends AbstractDocument { 22 23 private static class StringTextStore implements ITextStore { 24 25 private String fContent; 26 27 32 public StringTextStore(String content) { 33 Assert.isNotNull(content); 34 fContent= content; 35 } 36 37 40 public char get(int offset) { 41 return fContent.charAt(offset); 42 } 43 44 47 public String get(int offset, int length) { 48 return fContent.substring(offset, offset + length); 49 } 50 51 54 public int getLength() { 55 return fContent.length(); 56 } 57 58 61 public void replace(int offset, int length, String text) { 62 } 63 64 67 public void set(String text) { 68 } 69 70 } 71 72 78 public DocumentClone(String content, String [] lineDelimiters) { 79 super(); 80 setTextStore(new StringTextStore(content)); 81 ConfigurableLineTracker tracker= new ConfigurableLineTracker(lineDelimiters); 82 setLineTracker(tracker); 83 getTracker().set(content); 84 completeInitialization(); 85 } 86 } 87 | Popular Tags |