Executing refactorings from a plug in code


Just a very basic question, but cannot find a sample code for doing it: How can I execute a refactoring programmatically

I'm trying to rename with the following code. I want to replace the last line with a proper "Rename" refactoring .

[ContextAction(Group="VB", Name="MyAction")]

public class MyContextAction:BulbItemImpl,IContextAction



protected override Action<JetBrains.TextControl.ITextControl> ExecuteTransaction(JetBrains.ProjectModel.ISolution solution, JetBrains.Application.Progress.IProgressIndicator progress)


var method = _provider.GetSelectedElement<IMethodDeclaration>(false, true);

if (method != null) method.SetName("HelloWorld");




1 comment
Comment actions Permalink

I am trying to do the same thing. Still haven't figured out how :(


Please sign in to leave a comment.