KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > lib > editor > bookmarks > spi > BookmarkManager


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.lib.editor.bookmarks.spi;
21
22 import javax.swing.text.JTextComponent JavaDoc;
23 import org.netbeans.lib.editor.bookmarks.api.Bookmark;
24
25 /**
26  * Manager of the bookmarks for a document.
27  * <br>
28  * If the manager wishes to persist the bookmarks
29  * its implementation must do so at the appropriate times.
30  *
31  * @author Miloslav Metelka
32  */

33
34 public interface BookmarkManager {
35
36     /**
37      * Initialize the bookmarks.
38      * <br>
39      * If the manager persists the bookmarks it should restore
40      * them now and use
41      * {@link BookmarkManagerSupport#addBookmark(BookmarkImplementation)}
42      * to add them to the bookmark list.
43      */

44     void init(BookmarkManagerSupport support);
45     
46     /**
47      * Bookmark list calls this method once it's necessary
48      * to create the bookmark implementation (for example when
49      * {@link BookmarkList#toggleBookmark(int)} gets called.
50      *
51      * @param offset offset at which the bookmark should be created.
52      * @return non-null bookmark implementation for the given offset.
53      */

54     BookmarkImplementation createBookmarkImplementation(int offset);
55
56     /**
57      * This method is called by the infrastructure to save
58      * the present bookmarks into a persistent storage.
59      * <br>
60      * This happens whenever a document gets uninstalled
61      * from a text component or when a document's content
62      * gets saved.
63      */

64     void saveBookmarks();
65
66 }
67
68
Popular Tags