Open document from context menu

SyntaxEditor for WPF Forum

Posted 4 years ago by Scott Haney
Version: 15.1.0624
Avatar

Hi,

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 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

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 (v2019.1 build 0683) 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.