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() { |