1 22 23 package org.gjt.sp.jedit; 24 25 import javax.swing.text.Position ; 26 27 41 public class Marker 42 { 43 48 public char getShortcut() 49 { 50 return shortcut; 51 } 53 58 public int getPosition() 59 { 60 return (position == null ? pos : position.getOffset()); 61 } 63 65 Marker(Buffer buffer, char shortcut, int position) 67 { 68 this.buffer = buffer; 69 this.shortcut = shortcut; 70 this.pos = position; 71 } 73 79 void setShortcut(char shortcut) 80 { 81 this.shortcut = shortcut; 82 } 84 void createPosition() 86 { 87 position = buffer.createPosition(pos); 88 } 90 void removePosition() 92 { 93 if(position != null) 95 { 96 pos = position.getOffset(); 97 position = null; 98 } 99 } 101 106 void setPosition(int pos) 107 { 108 this.pos = pos; 109 } 111 113 private Buffer buffer; 115 private char shortcut; 116 private int pos; 117 private Position position; 118 } 120 | Popular Tags |