I want to write a plugin on a river which allows me to generate code in another class based on the highlighted text, And the API is not the most transparent to get access to selected lessons and what methods should I look at in the code generation methods outside the current class?
When you are writing a context or something like this (read about verbs and context actions here) , You get an example of idTintext. In this way, a text control, document, and select:
var textControl = context.GetData (TextControl.DataContext.DataConstants.TEXT_CONTROL); Var document = textControl.Document; Var solution = projectFile.GetSolution (); Text Range Selection = Text Control Selection. Ondokrangejith Carat (); Document to get text for selection range. Use gate text.
To generate a code outside your current class, you need to find the element declared in your second class. For this you need to use IDeclarationsCache, see about it. When you receive the declared element, use the GetDeclarations () method to gain access to all your class announcements (due to partial organs, there may be many announcements) and put it in ICLASSXCalation. Use addClassMemberDeclaration method to add members to remove and add RemoveClassMemberDeclaration. When adding class members, use the element factory to create the added element (see).
If you have more questions, please do not hesitate to contact me.
Comments
Post a Comment