How to create Own Bookmark Indicator Manager

SyntaxEditor for WPF Forum

Posted 7 years ago by Banukobhan Nagendram
Version: 16.1.0633
Avatar

Hi Actipro,

We are working on replacing an existing editor with the Actipro editor. There is a global bookmark manager that is responsible for all the bookmarks in various editors including the new Actipro editor.

We need send a notification to the global bookmark manager that a bookmark has been added or deleted in the editor. After some study, we found that the bookmark manger in the Actipro editor won't send out notification to the editor view or other clients when a bookmark is deleted or added.

I'm not sure if it's better for me to implement a new bookmark manager for the Actipro editor, so that I send notify my clients. How could this be properly implemented? Or you can suggest to me any solution?

Thanks.

Regards,
Banu

Comments (5)

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Banu,

When you toggle our built-in bookmarks via the methods on editor.Document.IndicatorManager.Bookmarks, any bookmarks you add/remove should be reflected immediately in the SyntaxEditor UI.  That object is the main way to alter the displayed bookmarks.  Are you talking about getting notified when the user would delete lines that might contain a bookmark and that bookmark is removed?  That's really the only scenario where we would remove a bookmark without you programmatically initiating it.


Actipro Software Support

Posted 7 years ago by Banukobhan Nagendram
Avatar

Hi Actipro,

//Are you talking about getting notified when the user would delete lines that might contain a bookmark and that bookmark is removed?//

Yes. We need to notifiy global bookmark manager (our own manager), if the bookmark is removed, by delete lines.
Is there a way to acheive this functionality?

Regards,
Banu

[Modified 7 years ago]

Answer - Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Banu,

We don't currently have notifications when one of the bookmarks is removed in that fashion.  The bookmark indicators use a CollectionTagger behind the scenes.  We will update CollectionTagger for the next maintenance release to implement INotifyCollectionChanged.  Then you will be able to monitor that.

The only tricky part is getting the tagger.  This can be done like this:

BookmarkIndicatorTagger tagger = null;
if (editor.Document.Properties.TryGetValue(typeof(BookmarkIndicatorTagger), out tagger)) {
    ...
}

However please note that the tagger is only added to the document after the first bookmark is added.

If you'd like a preview build to try this new functionality out, please write our support address.


Actipro Software Support

Posted 7 years ago by Banukobhan Nagendram
Avatar

Hi Actipro,

Shall I know, is INotifyCollectionChanged has argument to know, is it removed by user or by deleted lines?

Please notify me, when the build is ready with this functionality.
email: nbanukh@ra.rockwell.com

Regards,
Banu

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

No that is a common .NET interface so we don't have a way to pass whether it was removed by deleted lines.  That being said, you can flag something when you are removing it by the user and clear the flag afterwards.  Then you'd know if the collection change (when it is a remove) was due to a user action or deleted lines.

The build is ready but per above, please write our support address so a ticket will be created and we will reply to you there.  Please mention this thread in your email.


Actipro Software Support

The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.