com.borland.primetime.editor
Class BookmarkManager

java.lang.Object
  |
  +--com.borland.primetime.ide.BrowserAdapter
        |
        +--com.borland.primetime.editor.BookmarkManager
All Implemented Interfaces:
BrowserListener, java.util.EventListener

public class BookmarkManager
extends BrowserAdapter

A BookmarkManager contains all of the logic and storage for maintaining bookmarks within the editor. There is one instance of this class per browser, and a static map of associations between browsers and instances.


Inner Class Summary
protected  class BookmarkManager.EditorMark
          This class is an extension of GutterMark that represents a particular bookmark within the editor.
 
Field Summary
protected  Browser browser
           
protected static java.util.Map managerHash
          This HashMap stores BookmarkManager instances using a Browser as a key.
protected  java.util.Vector marks
           
 
Constructor Summary
BookmarkManager(Browser browser)
          Create a BookmarkManager for a particular browser.
 
Method Summary
static void addBookmark(int p0, int markNumber, EditorPane editor)
          Add a bookmark for a particular editor.
 void browserClosed(Browser browser)
          Invoked when all listeners agree that close is okay.
static void clearBookmarks(Browser browser, EditorPane editor)
          Clears the bookmarks belonging to a particular EditorPane.
static BookmarkManager getBookmarkManager(Browser browser)
          Returns the BookmarkManager associated with a particular browser.
static void gotoBookmark(int markNumber, EditorPane editor)
          Navigate to a bookmark from a particular editor.
static void nextBookmark(EditorPane editor)
          Navigate to the next bookmark below the current line in a particular editor.
static void previousBookmark(EditorPane editor)
          Navigate to the previous bookmark above the current line in a particular editor.
static void toggleBookmark(int p0, EditorPane editor)
          Toggle a bookmark for a particular editor.
static void toggleBookmark(int p0, EditorPane editor, javax.swing.Icon icon)
          Toggle a bookmark for a particular editor.
 
Methods inherited from class com.borland.primetime.ide.BrowserAdapter
browserActivated, browserClosing, browserDeactivated, browserNodeActivated, browserNodeClosed, browserOpened, browserProjectActivated, browserProjectClosed, browserViewerActivated, browserViewerDeactivating
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

marks

protected java.util.Vector marks

browser

protected Browser browser

managerHash

protected static java.util.Map managerHash
This HashMap stores BookmarkManager instances using a Browser as a key.
Constructor Detail

BookmarkManager

public BookmarkManager(Browser browser)
Create a BookmarkManager for a particular browser.
Method Detail

getBookmarkManager

public static BookmarkManager getBookmarkManager(Browser browser)
Returns the BookmarkManager associated with a particular browser. If there is not yet an association, a new BookmarkManager is created and added to the cache.
Parameters:
browser - The browser of the requested BookmarkManager.
Returns:
The BookmarkManager associated with the specified browser.

clearBookmarks

public static void clearBookmarks(Browser browser,
                                  EditorPane editor)
Clears the bookmarks belonging to a particular EditorPane. This method should only be called when the editor in question is being released.

addBookmark

public static void addBookmark(int p0,
                               int markNumber,
                               EditorPane editor)
Add a bookmark for a particular editor.
Parameters:
p0 - The offset within the document that should be remembered.
markNumber - This represents the bookmark to use. This is a number between 0 and 9, inclusive. Values outside of this range have no effect.
editor - The editor to which the bookmark refers.

toggleBookmark

public static void toggleBookmark(int p0,
                                  EditorPane editor)
Toggle a bookmark for a particular editor. If there is already a bookmark on the line of the offset, that bookmark is turned off. Otherwise a new unnumbered bookmark that uses the standard bookmark icon will be set on the line of the offset.
Parameters:
p0 - The offset within the document that should be remembered.
editor - The editor to which the bookmark refers.

toggleBookmark

public static void toggleBookmark(int p0,
                                  EditorPane editor,
                                  javax.swing.Icon icon)
Toggle a bookmark for a particular editor. If there is already a bookmark on the line of the offset, that bookmark is turned off. Otherwise a new unnumbered bookmark that uses the provided icon will be set on the line of the offset.
Parameters:
p0 - The offset within the document that should be remembered.
editor - The editor to which the bookmark refers.
icon - The icon to use for the bookmark.

gotoBookmark

public static void gotoBookmark(int markNumber,
                                EditorPane editor)
Navigate to a bookmark from a particular editor.
Parameters:
markNumber - This represents the bookmark to use. This is a number between 0 and 9, inclusive. Values outside of this range have no effect.
editor - The editor which is currently active. Note that the boomark may not be in this editor at all, but the editor is required to determine which browser is active, and which set of bookmarks to use.

nextBookmark

public static void nextBookmark(EditorPane editor)
Navigate to the next bookmark below the current line in a particular editor. Wrap around to the top if no bookmark was found yet.
Parameters:
editor - The editor currently active.

previousBookmark

public static void previousBookmark(EditorPane editor)
Navigate to the previous bookmark above the current line in a particular editor. Wrap around to the bottom if no bookmark was found yet.
Parameters:
editor - The editor currently active.

browserClosed

public void browserClosed(Browser browser)
Invoked when all listeners agree that close is okay. This is a notification that the Browser has closed (is about to, and you can't stop it).
Overrides:
browserClosed in class BrowserAdapter
Parameters:
browser - The Browser that is about to close.