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
            manager.Handlers.AddHandler(expandAction, postfixHandler);
            #endif
              }
        }
Exemplo n.º 2
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
            }
        }
Exemplo n.º 3
0
        public PostfixTemplatesTabTracker(
            [NotNull] Lifetime lifetime,
            [NotNull] IActionManager manager,
            [NotNull] ICommandProcessor commandProcessor,
            [NotNull] TextControlChangeUnitFactory changeUnitFactory)
        {
            // override live templates expand action
            var expandAction = manager.Defs.TryGetActionDefById(TextControlActions.TAB_ACTION_ID);

            if (expandAction != null)
            {
                var postfixHandler = new ExpandPostfixTemplateHandler(commandProcessor, changeUnitFactory);

                lifetime.AddBracket(
                    FOpening: () => manager.Handlers.AddHandler(expandAction, postfixHandler),
                    FClosing: () => manager.Handlers.RemoveHandler(expandAction, postfixHandler));
            }
        }