1 19 20 package org.netbeans.lib.editor.bookmarks.actions; 21 22 import java.awt.event.ActionEvent ; 23 import java.beans.PropertyChangeEvent ; 24 import java.beans.PropertyChangeListener ; 25 import javax.swing.text.BadLocationException ; 26 import javax.swing.text.Caret ; 27 import javax.swing.text.Document ; 28 import javax.swing.text.JTextComponent ; 29 import org.netbeans.editor.BaseAction; 30 import org.netbeans.editor.BaseKit; 31 import org.netbeans.lib.editor.bookmarks.BookmarksApiPackageAccessor; 32 import org.netbeans.lib.editor.bookmarks.api.Bookmark; 33 import org.netbeans.lib.editor.bookmarks.api.BookmarkList; 34 import org.netbeans.lib.editor.bookmarks.spi.BookmarkManager; 35 36 37 43 44 public class BookmarksKitInstallAction extends BaseAction { 45 46 static final long serialVersionUID = -0L; 47 48 public static final BookmarksKitInstallAction INSTANCE = new BookmarksKitInstallAction(); 49 50 BookmarksKitInstallAction() { 51 super("bookmarks-kit-install"); putValue(BaseAction.NO_KEYBINDING, Boolean.TRUE); 53 } 54 55 public void actionPerformed(ActionEvent evt, JTextComponent target) { 56 assert (target != null); 57 Document doc = target.getDocument(); 58 BookmarkList.get(doc); target.addPropertyChangeListener(BookmarksRefreshListener.INSTANCE); 60 } 61 62 private static final class BookmarksRefreshListener implements PropertyChangeListener { 63 64 static final BookmarksRefreshListener INSTANCE = new BookmarksRefreshListener(); 65 66 public void propertyChange(PropertyChangeEvent evt) { 67 if ("document".equals(evt.getPropertyName())) { Document newDoc = (Document )evt.getNewValue(); 69 if (newDoc != null) { 70 BookmarkList bml = BookmarkList.get(newDoc); } 72 } 73 74 } 75 76 } 77 } 78 79 80 | Popular Tags |