1 19 20 package org.netbeans.lib.editor.bookmarks.api; 21 22 import javax.swing.text.Document ; 23 import org.netbeans.lib.editor.bookmarks.spi.BookmarkImplementation; 24 25 30 31 public final class Bookmark { 32 33 36 private BookmarkList bookmarkList; 37 38 41 private BookmarkImplementation impl; 42 43 46 private boolean released; 47 48 55 Bookmark(BookmarkList bookmarkList, BookmarkImplementation impl) { 56 this.bookmarkList = bookmarkList; 57 this.impl = impl; 58 } 59 60 66 public int getOffset() { 67 return impl.getOffset(); 68 } 69 70 73 public int getLineIndex() { 74 return getDocument().getDefaultRootElement().getElementIndex(impl.getOffset()); 75 } 76 77 80 public BookmarkList getList() { 81 return bookmarkList; 82 } 83 84 88 public boolean isReleased() { 89 return released; 90 } 91 92 95 void release() { 96 assert (!released); 97 released = true; 98 impl.release(); 99 } 100 101 104 BookmarkImplementation getImplementation() { 105 return impl; 106 } 107 108 111 private Document getDocument() { 112 return bookmarkList.getDocument(); 113 } 114 115 } 116 117 | Popular Tags |