private void DoRename(TextSelection selection)
        {
            if (selection.Text.Length == 0 || !selection.Text.Contains("_" + _eventName))
            {
                return;
            }
            //Now look in more detail and figure out if this actually is what we're looking for
            string original     = selection.Text;
            int    lastPost     = original.LastIndexOf('_');
            string siteName     = original.Substring(0, lastPost);
            string eventName    = original.Substring(lastPost + 1);
            var    classElement = selection.ActivePoint.CodeElement[vsCMElement.vsCMElementClass];
            string name         = _nameProvider.CreateEventHandlerName(siteName, eventName, classElement.Name, selection.Text);

            selection.TopPoint.CreateEditPoint().ReplaceText(selection.BottomPoint, name, 0);
        }
Beispiel #2
0
 public string CreateUniqueMethodName(IComponent component, EventDescriptor e)
 {
     return(_nameProvider.CreateEventHandlerName(component.Site.Name, e.Name, component.Site.Container.Components[0].Site.Name, _realService.CreateUniqueMethodName(component, e)));
 }