This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 233965
Collapse All | Expand All

(-)a/editor.bookmarks/src/org/netbeans/lib/editor/bookmarks/api/Bookmark.java (+4 lines)
Lines 196-201 Link Here
196
        lineToAnnotation.remove (line);
196
        lineToAnnotation.remove (line);
197
    }
197
    }
198
    
198
    
199
    void detachAnnotation() {
200
        annotation.detach();
201
    }
202
    
199
    BookmarkInfo info() {
203
    BookmarkInfo info() {
200
        return info;
204
        return info;
201
    }
205
    }
(-)a/editor.bookmarks/src/org/netbeans/lib/editor/bookmarks/api/BookmarkList.java (-1 / +13 lines)
Lines 61-66 Link Here
61
import javax.swing.text.Element;
61
import javax.swing.text.Element;
62
import javax.swing.text.Position;
62
import javax.swing.text.Position;
63
import org.netbeans.api.annotations.common.NonNull;
63
import org.netbeans.api.annotations.common.NonNull;
64
import org.netbeans.api.editor.EditorRegistry;
64
65
65
import org.netbeans.modules.editor.NbEditorUtilities;
66
import org.netbeans.modules.editor.NbEditorUtilities;
66
import org.netbeans.modules.editor.bookmarks.BookmarkChange;
67
import org.netbeans.modules.editor.bookmarks.BookmarkChange;
Lines 149-155 Link Here
149
        }
150
        }
150
151
151
    };
152
    };
153
    
154
    private PropertyChangeListener componentRemovedListener = new PropertyChangeListener() {
152
155
156
        @Override
157
        public void propertyChange(PropertyChangeEvent evt) {
158
            if (EditorRegistry.COMPONENT_REMOVED_PROPERTY.equals(evt.getPropertyName())) {
159
                for (Bookmark bookmark: bookmarks) {
160
                    bookmark.detachAnnotation();
161
                }
162
            }
163
        }
164
    };
153
    private boolean pendingFireChange;
165
    private boolean pendingFireChange;
154
    
166
    
155
    private BookmarkList(final Document document) {
167
    private BookmarkList(final Document document) {
Lines 159-165 Link Here
159
        this.document = document;
171
        this.document = document;
160
        this.bookmarks = new ArrayList<Bookmark> ();
172
        this.bookmarks = new ArrayList<Bookmark> ();
161
        this.info2bookmark = new HashMap<BookmarkInfo, Bookmark>();
173
        this.info2bookmark = new HashMap<BookmarkInfo, Bookmark>();
162
174
        EditorRegistry.addPropertyChangeListener(componentRemovedListener);
163
        BookmarkUtils.postTask(new Runnable() {
175
        BookmarkUtils.postTask(new Runnable() {
164
            @Override
176
            @Override
165
            public void run() {
177
            public void run() {

Return to bug 233965