Open document from context menu

SyntaxEditor for WPF Forum

Posted 8 years ago by Scott Haney
Version: 15.1.0624


I have a C-like language that supports include files, e.g.

include "SCRIPT.STD"

Assuming the cursor is located on the line somewhere, I would like to provide a context menu item 'Open "SCRIPT.STD"'. Could you write a few words describing how I might go about doing this?

Thank you very much,

Scott Haney

Comments (1)

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

Hi Scott,

You can get an ITextSnapshotReader via editor.ActiveView.GetReader() that will be initialized to the caret's location.  From there you can scan text and tokens around it to determine contextual information.

You could execute that sort of logic in a SyntaxEditor.CreateDefaultContextMenu override and add a menu item to the default generated menu as appropriate when you encounter an appropriate scenario.

Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.