コード例 #1
0
ファイル: Solution.cs プロジェクト: derigel23/Nitra
    public void Open(Lifetime lifetime, IShellLocks shellLocks, ChangeManager changeManager, ISolution solution, DocumentManager documentManager, IActionManager actionManager, ICommandProcessor commandProcessor, TextControlChangeUnitFactory changeUnitFactory, JetPopupMenus jetPopupMenus)
    {
      Debug.Assert(!IsOpened);

      _solution = solution;
      DocumentManager = documentManager;
      _jetPopupMenus = jetPopupMenus;
      changeManager.Changed2.Advise(lifetime, Handler);
      lifetime.AddAction(Close);
      var expandAction = actionManager.Defs.TryGetActionDefById(GotoDeclarationAction.ACTION_ID);
      if (expandAction != null)
      {
        var postfixHandler = new GotoDeclarationHandler(lifetime, shellLocks, commandProcessor, changeUnitFactory, this);

        lifetime.AddBracket(
          FOpening: () => actionManager.Handlers.AddHandler(expandAction, postfixHandler),
          FClosing: () => actionManager.Handlers.RemoveHandler(expandAction, postfixHandler));
      }
      
      var findUsagesAction = actionManager.Defs.GetActionDef<FindUsagesAction>();
      var findUsagesHandler = new FindUsagesHandler(lifetime, shellLocks, commandProcessor, changeUnitFactory, this);

      lifetime.AddBracket(
        FOpening: () => actionManager.Handlers.AddHandler(findUsagesAction, findUsagesHandler),
        FClosing: () => actionManager.Handlers.RemoveHandler(findUsagesAction, findUsagesHandler));
    }
コード例 #2
0
        protected BasePopupWindow(LifetimeDefinition lifetimeDefinition, IPopupWindowContext context,
                                  PopupWindowMutex mutex, HideFlags hideFlags)
        {
            this.lifetimeDefinition = lifetimeDefinition;
            lifetime = lifetimeDefinition.Lifetime;
            Context  = context;
            Mutex    = mutex;

            HideMethod = FormHideMethod.Visibility;

            this.hideFlags = hideFlags;

            lifetime.AddAction(() =>
            {
                if (!Visible)
                {
                    CloseWindowCore();
                    return;
                }

                EventHandler handle = null;
                handle = (sender, args) =>
                {
                    CloseWindowCore();
                    Closed -= handle;
                };
                Closed += handle;
                HideWindow();
            });
        }
コード例 #3
0
            public SolutionStateNotifier([NotNull] Lifetime lifetime,
                                         [NotNull] ISolution solution,
                                         [NotNull] ISolutionLoadTasksScheduler scheduler,
                                         [NotNull] SolutionStateTracker solutionStateTracker)
            {
                if (lifetime == null)
                {
                    throw new ArgumentNullException("lifetime");
                }
                if (solution == null)
                {
                    throw new ArgumentNullException("solution");
                }
                if (scheduler == null)
                {
                    throw new ArgumentNullException("scheduler");
                }
                if (solutionStateTracker == null)
                {
                    throw new ArgumentNullException("solutionStateTracker");
                }

                scheduler.EnqueueTask(new SolutionLoadTask("SolutionStateTracker",
                                                           SolutionLoadTaskKinds.Done, () => solutionStateTracker.HandleSolutionOpened(solution)));

                lifetime.AddAction(solutionStateTracker.HandleSolutionClosed);
            }
コード例 #4
0
ファイル: T4PsiModule.cs プロジェクト: dany4ev/ForTea
        internal T4PsiModule([NotNull] Lifetime lifetime, [NotNull] IPsiModules psiModules, [NotNull] DocumentManager documentManager,
                             [NotNull] ChangeManager changeManager, [NotNull] IAssemblyFactory assemblyFactory, [NotNull] IShellLocks shellLocks,
                             [NotNull] IProjectFile projectFile, [NotNull] T4FileDataCache fileDataCache, [NotNull] T4Environment t4Environment,
                             [NotNull] OutputAssemblies outputAssemblies)
        {
            _lifetime = lifetime;
            lifetime.AddAction(Dispose);

            _psiModules      = psiModules;
            _assemblyFactory = assemblyFactory;
            _changeManager   = changeManager;
            _shellLocks      = shellLocks;

            _projectFile = projectFile;
            IProject project = projectFile.GetProject();

            Assertion.AssertNotNull(project, "project != null");
            _project  = project;
            _solution = project.GetSolution();

            changeManager.RegisterChangeProvider(lifetime, this);
            changeManager.AddDependency(lifetime, psiModules, this);

            _t4Environment    = t4Environment;
            _outputAssemblies = outputAssemblies;
            _resolveProject   = new T4ResolveProject(lifetime, _solution, _shellLocks, t4Environment.PlatformID, project);

            _sourceFile = CreateSourceFile(projectFile, documentManager);

            _isValid = true;
            fileDataCache.FileDataChanged.Advise(lifetime, OnDataFileChanged);
            AddBaseReferences();
        }
コード例 #5
0
 public CommandMap(Lifetime lifetime, IInjector injector)
 {
     _map      = new Dictionary <Type, Container>();
     _lifetime = lifetime;
     _injector = new Injector(injector);
     _lifetime.AddAction(((IDisposable)_injector).Dispose);
 }
コード例 #6
0
        public void Open(Lifetime lifetime, IShellLocks shellLocks, ChangeManager changeManager, ISolution solution, DocumentManager documentManager, IActionManager actionManager, ICommandProcessor commandProcessor, TextControlChangeUnitFactory changeUnitFactory, JetPopupMenus jetPopupMenus)
        {
            Debug.Assert(!IsOpened);

            _solution       = solution;
            DocumentManager = documentManager;
            _jetPopupMenus  = jetPopupMenus;
            changeManager.Changed2.Advise(lifetime, Handler);
            lifetime.AddAction(Close);
            var expandAction = actionManager.Defs.TryGetActionDefById(GotoDeclarationAction.ACTION_ID);

            if (expandAction != null)
            {
                var postfixHandler = new GotoDeclarationHandler(lifetime, shellLocks, commandProcessor, changeUnitFactory, this);

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

            var findUsagesAction  = actionManager.Defs.GetActionDef <FindUsagesAction>();
            var findUsagesHandler = new FindUsagesHandler(lifetime, shellLocks, commandProcessor, changeUnitFactory, this);

            lifetime.AddBracket(
                FOpening: () => actionManager.Handlers.AddHandler(findUsagesAction, findUsagesHandler),
                FClosing: () => actionManager.Handlers.RemoveHandler(findUsagesAction, findUsagesHandler));
        }
コード例 #7
0
        public CheckTimer(Lifetime lifetime)
        {
            OnCheckPass = new Signal <bool>(lifetime, "CheckTimer.OnTimer");
            var timer = new Timer(TimerCallback, null, 0, 100);

            lifetime.AddAction(() => timer.Dispose());
        }
コード例 #8
0
            public SolutionStateNotifier([NotNull] Lifetime lifetime,
                                         [NotNull] ISolution solution,
                                         [NotNull] ISolutionLoadTasksScheduler scheduler,
                                         [NotNull] SolutionStateTracker solutionStateTracker,
                                         [NotNull] IPsiServices psiServices)
            {
                if (lifetime == null)
                {
                    throw new ArgumentNullException("lifetime");
                }
                if (solution == null)
                {
                    throw new ArgumentNullException("solution");
                }
                if (scheduler == null)
                {
                    throw new ArgumentNullException("scheduler");
                }
                if (solutionStateTracker == null)
                {
                    throw new ArgumentNullException("solutionStateTracker");
                }

                scheduler.EnqueueTask(new SolutionLoadTask("SolutionStateTracker",
                                                           SolutionLoadTaskKinds.SolutionContainer, () => solutionStateTracker.HandleSolutionContainerCreated(solution)));
                scheduler.EnqueueTask(new SolutionLoadTask("SolutionStateTracker",
                                                           SolutionLoadTaskKinds.Done, () => solutionStateTracker.HandleSolutionOpened(solution)));
                scheduler.EnqueueTask(new SolutionLoadTask("SolutionStateTracker",
                                                           SolutionLoadTaskKinds.AfterDone, () => psiServices.CachesState.IsIdle.WhenTrueOnce(lifetime, () =>
                                                                                                                                              solutionStateTracker.HandlePsiLoaded(solution))));
                lifetime.AddAction(solutionStateTracker.HandleSolutionClosed);
            }
コード例 #9
0
 public IDEStateEventGenerator(IRSEnv env,
                               IMessageBus messageBus,
                               Lifetime lifetime,
                               IDateUtils dateUtils,
                               IEventLogger logger,
                               IThreading threading)
     : base(env, messageBus, dateUtils, threading)
 {
     _env    = env;
     _logger = logger;
     FireIDEStateEvent(IDELifecyclePhase.Startup);
     lifetime.AddAction(FireShutdownEvent);
 }
コード例 #10
0
        public GotoWordController(
            [NotNull] Lifetime lifetime, [NotNull] IShellLocks locks,
            [NotNull] IProjectModelElement projectElement, [CanBeNull] ITextControl textControl)
            : base(lifetime, new GotoByNameModel(lifetime), locks)
        {
            myLocks          = locks;
            myTextControl    = textControl;
            myProjectElement = projectElement;

            var projectFile = projectElement as IProjectFile;

            if (projectFile != null)
            {
                myCurrentFile = projectFile.ToSourceFile();
            }

            lifetime.AddAction(DropHighlightings);

            SelectedItem = new Property <object>(lifetime, "SelectedItem");
            SelectedItem.Change.Advise(lifetime, x =>
            {
                if (x.HasNew)
                {
                    var localOccurrence = x.New as LocalOccurrence;
                    if (localOccurrence != null)
                    {
                        if (textControl != null)
                        {
                            //var textControlPosRange = textControl.Scrolling.ViewportRange.Value;
                            //GC.KeepAlive(textControlPosRange);

                            myLocks.QueueReadLock("Aa", () =>
                            {
                                // todo: merge with highlighting updater?
                                var target = textControl.Coords.FromDocLineColumn(
                                    new DocumentCoords((Int32 <DocLine>)(Math.Max(localOccurrence.LineNumber - 2, 0)), (Int32 <DocColumn>) 0));
                                textControl.Scrolling.ScrollTo(target, TextControlScrollType.TopOfView);
                            });

                            if (myLocal != null)
                            {
                                UpdateLocalHighlightings(textControl.Document, myLocal);
                            }
                        }
                    }
                }
            });

            InitializeModel(lifetime, Model);
        }
コード例 #11
0
        public TaskViewModel(ITaskRepository repository, Lifetime lifetime, IIconsSettingsRepository settingsRepository, TaskEventGenerator generator = null)
        {
            if (generator != null)
            {
                TaskChange += generator.FireTaskEvent;
            }

            _settingsRepository            = settingsRepository;
            IconsSettings                  = _settingsRepository.Settings;
            IconsSettings.PropertyChanged += OnSettingsChanged;
            Lifetime = lifetime;
            Lifetime.AddAction(OnLifetimeTerminate);
            _repository = repository;
            _repository.PropertyChanged += OnRepositoryChanged;
            OnRepositoryChanged(null, null);
            SetActiveTask();
        }
コード例 #12
0
        public SettingsView(Lifetime lifetime, OptionsSettingsSmartContext settings)
        {
            Id = Pid;
            InitializeComponent();

            _lifetime = lifetime;
            _settings = settings;

            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.DelegateInvocationsMayThrowExceptions,
                                DelegateInvocationsMayThrowExceptions, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);

            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.IsDocumentationOfExceptionSubtypeSufficientForThrowStatements,
                                IsDocumentationOfExceptionSubtypeSufficientForThrowStatements, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.IsDocumentationOfExceptionSubtypeSufficientForReferenceExpressions,
                                IsDocumentationOfExceptionSubtypeSufficientForReferenceExpressions, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);

            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.InspectPublicMethods,
                                InspectPublicMethods, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.InspectInternalMethods,
                                InspectInternalMethods, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.InspectProtectedMethods,
                                InspectProtectedMethods, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.InspectPrivateMethods,
                                InspectPrivateMethods, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);

            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.OptionalExceptions2,
                                OptionalExceptions, TextBox.TextProperty);
            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.UseDefaultOptionalExceptions2,
                                UseOptionalExceptionsDefaults, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);

            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.OptionalMethodExceptions2,
                                OptionalMethodExceptions, TextBox.TextProperty);
            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.UseDefaultOptionalMethodExceptions2,
                                UseOptionalMethodExceptionsDefaults, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);

            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.AccessorOverrides2,
                                AccessorOverrides, TextBox.TextProperty);
            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.UseDefaultAccessorOverrides2,
                                UseDefaultAccessorOverrides, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);

            //settings.Changed.Advise(lifetime, delegate { Dispatcher.BeginInvoke((Action)(UpdateTextFields)); });
            lifetime.AddAction(delegate
            {
                // TODO: Force rescan of all documents if settings have changed
            });
        }
コード例 #13
0
        public LocalOccurrencesHighlighter([NotNull] Lifetime lifetime,
                                           [NotNull] IShellLocks shellLocks,
                                           [NotNull] ITextControl textControl,
                                           [NotNull] IDocumentMarkupManager markupManager)
        {
            myLifetime                = lifetime;
            myShellLocks              = shellLocks;
            myMarkupManager           = markupManager;
            myTextControl             = textControl;
            mySequentialOccurrences   = new SequentialLifetimes(lifetime);
            mySequentialFocused       = new SequentialLifetimes(lifetime);
            myTextControlViewportRect = textControl.Scrolling.ViewportRect.Value;

            mySyncRoot = new object();

            myLifetime.AddAction(DropHighlightings);
        }
コード例 #14
0
        public SettingsView(Lifetime lifetime, OptionsSettingsSmartContext settings)
        {
            InitializeComponent();

            _lifetime = lifetime;
            _settings = settings;

            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.DelegateInvocationsMayThrowExceptions,
                DelegateInvocationsMayThrowExceptions, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);

            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.IsDocumentationOfExceptionSubtypeSufficientForThrowStatements,
                IsDocumentationOfExceptionSubtypeSufficientForThrowStatements, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.IsDocumentationOfExceptionSubtypeSufficientForReferenceExpressions,
                IsDocumentationOfExceptionSubtypeSufficientForReferenceExpressions, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);

            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.InspectPublicMethods,
                InspectPublicMethods, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.InspectInternalMethods,
                InspectInternalMethods, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.InspectProtectedMethods,
                InspectProtectedMethods, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.InspectPrivateMethods,
                InspectPrivateMethods, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);

            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.OptionalExceptions2,
                OptionalExceptions, TextBox.TextProperty);
            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.UseDefaultOptionalExceptions2,
                UseOptionalExceptionsDefaults, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);

            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.OptionalMethodExceptions2,
                OptionalMethodExceptions, TextBox.TextProperty);
            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.UseDefaultOptionalMethodExceptions2,
                UseOptionalMethodExceptionsDefaults, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);

            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.AccessorOverrides2,
                AccessorOverrides, TextBox.TextProperty);
            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.UseDefaultAccessorOverrides2,
                UseDefaultAccessorOverrides, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);

            //settings.Changed.Advise(lifetime, delegate { Dispatcher.BeginInvoke((Action)(UpdateTextFields)); });
            lifetime.AddAction(delegate
            {
                // TODO: Force rescan of all documents if settings have changed
            });
        }
コード例 #15
0
        public void Play(Lifetime lifetime, string animation)
        {
            // Stop the current, potentially looping animation, and any other
            // (potentially looping) animations in the queue before playing ours
            StopAllAnimations();

            var request = Character.Play(animation);

            RegisterRequest(request);
            lifetime.AddAction(() =>
            {
                var requestStatus = (RequestStatus)request.Status;
                if (requestStatus == RequestStatus.Pending || requestStatus == RequestStatus.InProgress)
                {
                    Stop(request);
                    Play("Idle1_1");
                }
            });
        }
コード例 #16
0
ファイル: Agent.cs プロジェクト: saulchen/resharper-clippy
        public Agent(Lifetime lifetime, AgentManager agentManager)
        {
            character = JetBrains.Util.Lazy.Lazy.Of(() =>
            {
                agentManager.Initialise();
                var agentCharacter = agentManager.GetAgent("Clippit");

                agentCharacter.AgentClicked.FlowInto(lifetime, AgentClicked);
                agentCharacter.ButtonClicked.FlowInto(lifetime, ButtonClicked);
                agentCharacter.BalloonOptionClicked.FlowInto(lifetime, BalloonOptionClicked);

                lifetime.AddAction(() => agentManager.UnloadAgent(agentCharacter));

                return(agentCharacter);
            });

            AgentClicked         = new SimpleSignal(lifetime, "Agent::AgentClicked");
            ButtonClicked        = new Signal <string>(lifetime, "Agent::ButtonClicked");
            BalloonOptionClicked = new Signal <object>(lifetime, "Agent::BalloonOptionClicked");
        }
コード例 #17
0
        public TripleGoToEverythingActionHandler([NotNull] IActionManager actionManager, Lifetime lifetime)
        {
            myActionManager = actionManager;

            const string gotoTypeActionId = "GotoType";

#if RESHARPER8 || RESHARPER81
            var gotoTypeAction = actionManager.TryGetAction(gotoTypeActionId) as IUpdatableAction;
            if (gotoTypeAction != null)
            {
                gotoTypeAction.AddHandler(lifetime, this);
            }
#elif RESHARPER9
            var gotoTypeAction = actionManager.Defs.TryGetActionDefById(gotoTypeActionId);
            if (gotoTypeAction != null)
            {
                lifetime.AddAction(() => actionManager.Handlers.RemoveHandler(gotoTypeAction, this));
                actionManager.Handlers.AddHandler(gotoTypeAction, this);
            }
#endif
        }
コード例 #18
0
        private void EnableShortcuts(Lifetime enabledLifetime)
        {
            var popupWindowLifetimeDefinition = Lifetimes.Define(enabledLifetime, "PresentationAssistant::PopupWindow");

            var window = new PresentationAssistantWindow();

            window.Owner = mainWindow.MainWpfWindow.Value;


            theming.PopulateResourceDictionary(popupWindowLifetimeDefinition.Lifetime, window.Resources);

            var popupWindow = new FadingWpfPopupWindow(popupWindowLifetimeDefinition, context, context.Mutex,
                                                       popupWindowManager, window, opacity: 0.8);

            var visibilityLifetimes = new SequentialLifetimes(popupWindowLifetimeDefinition.Lifetime);

            showAction = shortcut =>
            {
                window.SetShortcut(shortcut);
                popupWindow.ShowWindow();

                visibilityLifetimes.DefineNext((visibleLifetimeDefinition, visibleLifetime) =>
                {
                    // Hide the window after a timespan, and queue it on the visible sequential lifetime so
                    // that the timer is cancelled when we want to show a new shortcut. Don't hide the window
                    // by attaching it to the sequential lifetime, as that will cause the window to hide when
                    // we need to show a new shortcut. But, make sure we do terminate the lifetime so that
                    // the topmost timer hack is stopped when this window is not visible
                    threading.TimedActions.Queue(visibleLifetime, "PresentationAssistantWindow::HideWindow",
                                                 () => popupWindow.HideWindow(), VisibleTimeSpan,
                                                 TimedActionsHost.Recurrence.OneTime, Rgc.Invariant);
                });
            };

            enabledLifetime.AddAction(() =>
            {
                showAction = _ => { };
            });
        }
コード例 #19
0
        protected void AttachEvents(PopupWindowManager popupWindowManager)
        {
            lifetime.AddAction(DetachEvents);

            var context = Context;

            if (context != null)
            {
                lifetime.AddBracket(() => Layouter = context.CreateLayouter(lifetime), () => Layouter = null);
                Layouter?.Layout.Change.Advise_HasNew(lifetime, OnLayouterResultChanged);

                context.AnyOtherAction   += OnContextOwnerAnyActionPerformed;
                context.Scroll           += OnContextOwnerScroll;
                context.SelectionChanged += OnContextOwnerSelectionChanged;
                context.Deactivated      += OnContextOwnerDeactivated;
                context.EscapePressed    += OnContextOwnerEscapePressed;
            }

            AttachWindowEvents();

            popupWindowManager?.PopupWindows.Add(lifetime, this);
        }
コード例 #20
0
        public void Patch([NotNull] Lifetime lifetime, [NotNull] IActionBar actionBar)
        {
            if (actionBar.ActionGroup.ActionId == TodoExplorerActionBarActionGroup.ID)
            {
                _separator = actionBar.InjectSeparator(int.MaxValue);

                _label = actionBar.InjectLabel(int.MaxValue, "Updating...", lifetime);
                _label.NotNull().MouseDoubleClick += Label_MouseDoubleClick;

                lifetime.AddAction(() =>
                {
                    _label.NotNull().MouseDoubleClick -= Label_MouseDoubleClick;
                    _label     = null;
                    _separator = null;
                });

#if !RS20172
                _separator = actionBar.InjectSeparator(int.MaxValue);
#endif

                _shellLocks.Tasks.Queue(lifetime, () => UpdateRequestSignal.Fire(), TaskPriority.BelowNormal);
            }
        }
コード例 #21
0
        internal T4PsiModule([NotNull] Lifetime lifetime, [NotNull] PsiModuleManager psiModuleManager, [NotNull] DocumentManager documentManager,
                             [NotNull] ChangeManager changeManager, [NotNull] IAssemblyFactory assemblyFactory, [NotNull] IShellLocks shellLocks,
                             [NotNull] IProjectFile projectFile, [NotNull] T4FileDataCache fileDataCache, [NotNull] T4Environment t4Environment,
                             [NotNull] OutputAssembliesCache outputAssembliesCache)
        {
            _lifetime = lifetime;
            lifetime.AddAction(Dispose);

            _psiModuleManager = psiModuleManager;
            _documentManager  = documentManager;
            _assemblyFactory  = assemblyFactory;

            _changeManager = changeManager;
            changeManager.RegisterChangeProvider(lifetime, this);
            changeManager.AddDependency(lifetime, psiModuleManager, this);

            _shellLocks  = shellLocks;
            _projectFile = projectFile;
            _project     = projectFile.GetProject();
            Assertion.AssertNotNull(_project, "_project != null");
            _solution = _project.GetSolution();

            _t4Environment         = t4Environment;
            _outputAssembliesCache = outputAssembliesCache;
            _resolveProject        = new T4ResolveProject(_solution, _shellLocks, t4Environment.PlatformID, _project);

            _sourceFile = new PsiProjectFile(
                this,
                _projectFile,
                (pf, sf) => new DefaultPsiProjectFileProperties(pf, sf),
                JetFunc <IProjectFile, IPsiSourceFile> .True,
                _documentManager);

            _isValid = true;
            fileDataCache.FileDataChanged.Advise(lifetime, OnDataFileChanged);
            AddBaseReferences();
        }
コード例 #22
0
 public DelegatingFileSystemShim(Lifetime lifetime)
 {
     myFileSystem    = Shim.FileSystem;
     Shim.FileSystem = this;
     lifetime.AddAction(() => Shim.FileSystem = myFileSystem);
 }
コード例 #23
0
 private void UnsubscribeOnTerminate()
 {
     _myLifetime.AddAction(() => _textControlManager.TextControls.CollectionChanged -= AdviceOnNewControls);
 }