Beispiel #1
0
        public PostfixTemplatesTracker([NotNull] Lifetime lifetime,
                                       [NotNull] IActionManager manager,
                                       [NotNull] ICommandProcessor commandProcessor,
                                       [NotNull] ILookupWindowManager lookupWindowManager,
                                       [NotNull] PostfixTemplatesManager templatesManager,
                                       [NotNull] LookupItemsOwnerFactory lookupItemsFactory,
                                       [NotNull] TextControlChangeUnitFactory changeUnitFactory)
        {
            // override live templates expand action
#if RESHARPER8
            var expandAction = manager.TryGetAction(TextControlActions.TAB_ACTION_ID) as IUpdatableAction;
#elif RESHARPER9
            var expandAction = manager.Defs.TryGetActionDefById(TextControlActions.TAB_ACTION_ID);
#endif
            if (expandAction != null)
            {
                var postfixHandler = new ExpandPostfixTemplateHandler(
                    lifetime, commandProcessor, lookupWindowManager, templatesManager, lookupItemsFactory, changeUnitFactory);

#if RESHARPER8
                expandAction.AddHandler(lifetime, postfixHandler);
#elif RESHARPER9
                lifetime.AddBracket(
                    FOpening: () => manager.Handlers.AddHandler(expandAction, postfixHandler),
                    FClosing: () => manager.Handlers.RemoveHandler(expandAction, postfixHandler));
#endif
            }
        }
Beispiel #2
0
 public ExpandPostfixTemplateHandler([NotNull] Lifetime lifetime,
                                     [NotNull] ICommandProcessor commandProcessor,
                                     [NotNull] ILookupWindowManager lookupWindowManager,
                                     [NotNull] PostfixTemplatesManager templatesManager,
                                     [NotNull] LookupItemsOwnerFactory itemsOwnerFactory,
                                     [NotNull] TextControlChangeUnitFactory changeUnitFactory)
 {
     myLifetime            = lifetime;
     myChangeUnitFactory   = changeUnitFactory;
     myLookupWindowManager = lookupWindowManager;
     myCommandProcessor    = commandProcessor;
     myItemsOwnerFactory   = itemsOwnerFactory;
     myTemplatesManager    = templatesManager;
 }
 public ExpandPostfixTemplateHandler([NotNull] Lifetime lifetime,
                               [NotNull] ICommandProcessor commandProcessor,
                               [NotNull] ILookupWindowManager lookupWindowManager,
                               [NotNull] PostfixTemplatesManager templatesManager,
                               [NotNull] LookupItemsOwnerFactory itemsOwnerFactory,
                               [NotNull] TextControlChangeUnitFactory changeUnitFactory)
 {
     myLifetime = lifetime;
     myChangeUnitFactory = changeUnitFactory;
     myLookupWindowManager = lookupWindowManager;
     myCommandProcessor = commandProcessor;
     myItemsOwnerFactory = itemsOwnerFactory;
     myTemplatesManager = templatesManager;
 }