public T4ProjectPsiModuleProviderFilter(
     [NotNull] ChangeManager changeManager,
     [NotNull] T4Environment t4Environment)
 {
     _changeManager = changeManager;
     _t4Environment = t4Environment;
 }
示例#2
0
        public BinaryUnityFileCache(Lifetime lifetime, ISolution solution,
                                    IPersistentIndexManager persistentIndexManager, IShellLocks locks,
                                    ChangeManager changeManager)
            : base(lifetime, persistentIndexManager, BinaryFileCacheItem.Marshaller)
        {
            myGroupingEvent = solution.Locks.GroupingEvents.CreateEvent(lifetime, "UnityRefresherOnSaveEvent",
                                                                        TimeSpan.FromMilliseconds(500), Rgc.Guarded, () =>
            {
                var changedFiles = new JetHashSet <IPsiSourceFile>(myChangedFiles);
                myChangedFiles.Clear();

                if (changedFiles.Count > 0)
                {
                    locks.ExecuteWithWriteLock(() => changeManager.ExecuteAfterChange(() =>
                    {
                        var builder = new PsiModuleChangeBuilder();
                        foreach (var file in changedFiles)
                        {
                            if (file.IsValid())
                            {
                                builder.AddFileChange(file, PsiModuleChange.ChangeType.Modified);
                            }
                        }

                        changeManager.OnProviderChanged(solution, builder.Result, SimpleTaskExecutor.Instance);
                    }));
                }
            });
            myChangedFiles = new JetHashSet <IPsiSourceFile>();
        }
示例#3
0
        /// <summary>Called when the associated data file changed: added/removed assemblies or includes.</summary>
        /// <param name="dataDiff">The difference between the old and new data.</param>
        private void OnFileDataChanged([NotNull] T4DeclaredAssembliesDiff dataDiff)
        {
            ShellLocks.AssertWriteAccessAllowed();
            if (!AssemblyReferenceManager.ProcessDiff(dataDiff))
            {
                return;
            }
            var changeBuilder = new PsiModuleChangeBuilder();

            changeBuilder.AddModuleChange(this, PsiModuleChange.ChangeType.Modified);
            // TODO: get rid of this queuing?
            ShellLocks.ExecuteOrQueueEx(
                "T4PsiModuleChange",
                () => ChangeManager.ExecuteAfterChange(
                    () => ShellLocks.ExecuteWithWriteLock(
                        () =>
            {
                if (!IsValid())
                {
                    return;
                }
                ChangeManager.OnProviderChanged(
                    ChangeProvider,
                    changeBuilder.Result,
                    SimpleTaskExecutor.Instance
                    );
            })
                    )
                );
        }
示例#4
0
        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
 // Use this for initialization
 void Start()
 {
     cm = player.GetComponent<ChangeManager> ();
     coneLines.Add ("Whoa what is going on???");
     coneLines.Add ("Again? How far could this go?");
     coneLines.Add ("Ha! Is the cone changing the world or is the world revealing its true self? Either way, I'm keeping one.");
 }
        // This function will get triggered/executed when a new message is written
        // on an Azure Queue called queue. This triggering is done due to the QueueTrigger attribute
        public static void ProcessQueueMessage([QueueTrigger(ChangeManager.StorageQueueName)] NotificationModel notification, TextWriter log)
        {
            log.WriteLine(String.Format("Processing subscription {0} for site {1}", notification.SubscriptionId, notification.SiteUrl));
            ChangeManager changeManager = new ChangeManager();

            changeManager.ProcessNotification(notification);
        }
示例#7
0
        public UnityReferencesTracker(
            Lifetime lifetime,
            IEnumerable <IUnityReferenceChangeHandler> handlers,
            ISolution solution,
            ISolutionLoadTasksScheduler scheduler,
            ModuleReferenceResolveSync moduleReferenceResolveSync,
            ChangeManager changeManager,
            IViewableProjectsCollection projects,
            ILogger logger)
        {
            myAllProjectLifetimes = new Dictionary <IProject, Lifetime>();
            myUnityProjects       = new HashSet <IProject>();

            myHandlers = handlers.ToList();
            myLifetime = lifetime;
            myLogger   = logger;
            mySolution = solution;
            myModuleReferenceResolveSync = moduleReferenceResolveSync;
            myChangeManager = changeManager;
            myProjects      = projects;

            // At PreparePsiModules, we know what references we have, so we know if we're a Unity project. This is where
            // we'll initialise our custom PSI module. We have to initialise our PSI module before Done, or the
            // PersistentIndexManager will clean out the "orphaned" external (YAML) files and we'll have to reparse all
            // files on every startup
            scheduler.EnqueueTask(new SolutionLoadTask("Preparing Unity project", SolutionLoadTaskKinds.PreparePsiModules,
                                                       OnSolutionPreparePsiModules));
        }
示例#8
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));
        }
 public MetaFileTracker(Lifetime lifetime, ChangeManager changeManager, ISolution solution, ILogger logger)
 {
     mySolution = solution;
     myLogger   = logger;
     changeManager.RegisterChangeProvider(lifetime, this);
     changeManager.AddDependency(lifetime, this, solution);
 }
        public UnityReferencesTracker(
            Lifetime lifetime,

            IEnumerable <IHandler> handlers,
            ISolution solution,

            ISolutionLoadTasksScheduler scheduler,
            IShellLocks shellLocks,

            ModuleReferenceResolveSync moduleReferenceResolveSync,
            ChangeManager changeManager,
            IViewableProjectsCollection projects,
            ILogger logger
            )
        {
            myProjectLifetimes = new Dictionary <IProject, Lifetime>();

            myHandlers   = handlers.ToList();
            myLifetime   = lifetime;
            myLogger     = logger;
            mySolution   = solution;
            myShellLocks = shellLocks;
            myModuleReferenceResolveSync = moduleReferenceResolveSync;
            myChangeManager = changeManager;
            myProjects      = projects;

            scheduler.EnqueueTask(new SolutionLoadTask("Checking for Unity projects", SolutionLoadTaskKinds.Done, Register));
        }
示例#11
0
        // This function will get triggered/executed when a new message is written
        // on an Azure Queue called queue.
        public static void ProcessQueueMessage([QueueTrigger(ChangeManager.StorageQueueName)] NotificationModel notification, TextWriter log)
        {
            log.WriteLine($"Processing subscription {notification.SubscriptionId} for site {notification.SiteUrl}");
            var changeManager = new ChangeManager();

            changeManager.ProcessNotification(notification);
        }
示例#12
0
        public PerProjectSettings(Lifetime lifetime, ISolution solution, ChangeManager changeManager,
                                  ModuleReferenceResolveSync moduleReferenceResolveSync,
                                  IViewableProjectsCollection projects,
                                  ISettingsSchema settingsSchema,
                                  SettingsStorageProvidersCollection settingsStorageProviders, IShellLocks locks,
                                  ILogger logger, InternKeyPathComponent interned,
                                  UnityProjectFileCacheProvider unityProjectFileCache)
        {
            mySolution                 = solution;
            myChangeManager            = changeManager;
            mySettingsSchema           = settingsSchema;
            mySettingsStorageProviders = settingsStorageProviders;
            myLocks    = locks;
            myLogger   = logger;
            myInterned = interned;
            myUnityProjectFileCache = unityProjectFileCache;
            myProjectMountPoints    = new Dictionary <IProject, SettingsStorageMountPoint>();
            myProjectLifetimes      = new Dictionary <IProject, Lifetime>();

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

            projects.Projects.View(lifetime, (projectLifetime, project) =>
            {
                myProjectLifetimes.Add(project, projectLifetime);

                if (!project.IsUnityProject())
                {
                    return;
                }

                InitialiseProjectSettings(project);
            });
        }
示例#13
0
        public void ChangeManager()
        {
            ChangeManager manager = new ChangeManager();

            Assert.IsFalse(manager.CanRedo);
            Assert.IsFalse(manager.CanUndo);
        }
示例#14
0
        public void ShowTutorialWindow(int tutorialId, Lifetime lifetime,
                                       ISolution solution, IPsiFiles psiFiles, ChangeManager changeManager, TextControlManager textControlManager,
                                       IShellLocks shellLocks, IEditorManager editorManager, DocumentManager documentManager,
                                       IUIApplication environment,
                                       IActionManager actionManager, WindowsHookManager windowsHookManager, IPsiServices psiServices,
                                       IActionShortcuts shortcutManager, IColorThemeManager colorThemeManager, IThreading threading)
        {
            var contentPath = _globalSettings.GetPath(tutorialId, PathType.WorkCopyContentFile);

            _runningTutorial = tutorialId;

            threading.ExecuteOrQueue("RunTutorialWindow", () =>
            {
                _tutorialWindow = new TutorialWindow(contentPath, lifetime, this, solution, psiFiles, changeManager,
                                                     textControlManager,
                                                     shellLocks, editorManager, documentManager, environment, actionManager, _toolWindowClass,
                                                     windowsHookManager, colorThemeManager);

                lifetime.AddBracket(
                    () =>
                {
                    _tutorialWindow.Show();
                    _homeWindow.HideLoadingImages();
                },
                    () =>
                {
                    _tutorialWindow.Close();
                    _tutorialWindow  = null;
                    _runningTutorial = 0;
                    _homeWindow.EnableButtons(true);
                });
            });
        }
示例#15
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));
    }
示例#16
0
        public TutorialWindowRunner([NotNull] Lifetime lifetime, ISolution solution, IPsiFiles psiFiles,
                                    ChangeManager changeManager, [NotNull] ISolutionStateTracker solutionStateTracker,
                                    [NotNull] GlobalSettings globalSettings, TextControlManager textControlManager, IShellLocks shellLocks,
                                    IEditorManager editorManager, DocumentManager documentManager, IUIApplication environment,
                                    IActionManager actionManager,
                                    WindowsHookManager windowsHookManager, IPsiServices psiServices, IActionShortcuts shortcutManager,
                                    IColorThemeManager colorThemeManager, IThreading threading)
        {
            if (lifetime == null)
            {
                throw new ArgumentNullException("lifetime");
            }
            if (solutionStateTracker == null)
            {
                throw new ArgumentNullException("solutionStateTracker");
            }
            if (globalSettings == null)
            {
                throw new ArgumentNullException("globalSettings");
            }


            foreach (var tutorial in globalSettings.AvailableTutorials)
            {
                if (VsIntegration.GetCurrentSolutionPath() == tutorial.Value)
                {
                    solutionStateTracker.AfterSolutionOpened.Advise(lifetime,
                                                                    () =>
                                                                    RunTutorial(globalSettings, tutorial.Key, lifetime, solution, psiFiles, changeManager,
                                                                                textControlManager, shellLocks, editorManager, documentManager, environment,
                                                                                actionManager, windowsHookManager, psiServices, shortcutManager, colorThemeManager,
                                                                                threading));
                }
            }
        }
        /// <summary>
        /// Responds to requests generated by subscriptions registered with
        /// the SharePoint WebHook REST API.
        /// </summary>
        /// <param name="validationToken">The validation token (guid) sent by SharePoint when
        /// validating the Notification URL for the web hook subscription.</param>
        public async Task <HttpResponseMessage> Post(string validationToken = null)
        {
            // If a validation token is present, we need to respond within 5 seconds by
            // returning the given validation token. This only happens when a new
            // web hook is being added
            if (validationToken != null)
            {
                var response = Request.CreateResponse(HttpStatusCode.OK);
                response.Content = new StringContent(validationToken);
                return(response);
            }

            // Read and parse the request body.
            var content = await Request.Content.ReadAsStringAsync();

            var notifications = JsonConvert.DeserializeObject <ResponseModel <NotificationModel> >(content).Value;

            if (notifications.Count > 0)
            {
                // do something with the received notification
                ChangeManager changeManager = new ChangeManager();
                foreach (var notification in notifications)
                {
                    // Recommended async pattern: this request must be processed within 5 seconds,
                    // hence it's better to do the processing using an asynchronous pattern.
                    changeManager.AddNotificationToQueue(CloudConfigurationManager.GetSetting("StorageConnectionString"), notification);

                    // Synchronous pattern: only for very simple operations that always complete within 5 seconds!
                    //changeManager.ProcessNotification(notification);
                }
            }

            // if we get here we assume the request was well received
            return(new HttpResponseMessage(HttpStatusCode.OK));
        }
示例#18
0
 public void Redo()
 {
     if (!CurrentMapCtrl.MapView.NodeTextEditor.IsTextEditing)
     {
         ChangeManager.Redo();
     }
 }
示例#19
0
 public T4PsiModuleProvider([NotNull] Lifetime lifetime, [NotNull] IShellLocks shellLocks, [NotNull] ChangeManager changeManager, [NotNull] T4Environment t4Environment)
 {
     _lifetime = lifetime;
     _shellLocks = shellLocks;
     _changeManager = changeManager;
     _t4Environment = t4Environment;
 }
示例#20
0
        public ProjectReferenceChangeTracker(
            Lifetime lifetime,
            ISolution solution,
            ModuleReferenceResolveSync moduleReferenceResolveSync,
            ChangeManager changeManager,
            IViewableProjectsCollection projects)
        {
            myHandlers         = new ConcurrentBag <Action <Lifetime, IProject> >();
            myProjectLifetimes = new Dictionary <IProject, Lifetime>();

            mySolution         = solution;
            myChangeManager    = changeManager;
            myProjectLifetimes = new Dictionary <IProject, Lifetime>();

            myChangeManager.RegisterChangeProvider(lifetime, this);
            myChangeManager.AddDependency(lifetime, this, moduleReferenceResolveSync);

            projects.Projects.View(lifetime, (projectLifetime, project) =>
            {
                myProjectLifetimes.Add(project, projectLifetime);

                if (!project.IsUnityProject())
                {
                    return;
                }

                Handle(project);
            });
        }
 public T4ProjectPsiModuleProviderFilter(
     [NotNull] ChangeManager changeManager,
     [NotNull] T4Environment t4Environment)
 {
     _changeManager = changeManager;
     _t4Environment = t4Environment;
 }
示例#22
0
 public T4PsiModuleProvider([NotNull] Lifetime lifetime, [NotNull] IShellLocks shellLocks, [NotNull] ChangeManager changeManager,
                            [NotNull] T4Environment t4Environment)
 {
     _lifetime      = lifetime;
     _shellLocks    = shellLocks;
     _changeManager = changeManager;
     _t4Environment = t4Environment;
 }
 public T4MiscFilesProjectPsiModuleProvider(
     Lifetime lifetime,
     [NotNull] IShellLocks shellLocks,
     [NotNull] ChangeManager changeManager,
     [NotNull] IT4Environment t4Environment,
     [NotNull] PsiProjectFileTypeCoordinator coordinator,
     [NotNull] IT4TemplateKindProvider templateDataManager
     ) => _t4PsiModuleProvider = new T4PsiModuleProvider(
示例#24
0
 internal EditorMode(Editor editor)
 {
     this.editor      = editor;
     hitObjectManager = editor.hitObjectManager;
     spriteManager    = new SpriteManager(true);
     changeManager    = editor.changeManager;
     Grid             = null;
 }
示例#25
0
 public T4MiscFilesProjectPsiModuleProvider(
     [NotNull] Lifetime lifetime,
     [NotNull] IShellLocks shellLocks,
     [NotNull] ChangeManager changeManager,
     [NotNull] T4Environment t4Environment)
 {
     _t4PsiModuleProvider = new T4PsiModuleProvider(lifetime, shellLocks, changeManager, t4Environment);
 }
示例#26
0
        public void EndBatch_EmptyBatch()
        {
            ChangeManager manager = new ChangeManager();

            manager.StartBatch("Empty Batch");
            manager.EndBatch();
            Assert.IsFalse(manager.CanUndo);
        }
示例#27
0
        public void StartBatch()
        {
            ChangeManager manager = new ChangeManager();

            manager.StartBatch("batch");

            Assert.IsTrue(manager.IsBatchOpen);
        }
示例#28
0
文件: MapTree.cs 项目: ywscr/MindMate
 /// <summary>
 /// Change Manager is off by default (helps in deserialization).
 /// It is mandatory to turn on ChangeManager (MapCtrl and others assume that it is on).
 /// </summary>
 public void TurnOnChangeManager()
 {
     if (!ChangeManagerOn)
     {
         ChangeManager = new ChangeManager();
         ChangeManager.RegisterMap(this);
     }
 }
示例#29
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="paidAmount"></param>
        /// <param name="productAmount"></param>
        /// <returns></returns>
        private string CalculateChange(string paidAmount, string productAmount)
        {
            // Limpa mensagem de erro
            this.UxTxtOutput.Text = string.Empty;

            // Monta o request
            ChangeRequest changeRequest = new ChangeRequest();

            changeRequest.PaidAmount    = int.Parse(paidAmount);
            changeRequest.ProductAmount = int.Parse(productAmount);

            // Chama o calculo do troco
            ChangeManager changeManager = new ChangeManager();

            // Assina o evento de conclusão de processador.
            changeManager.OnProcessorDone += changeManager_OnProcessorDone;

            ChangeResponse changeResponse = changeManager.CalculateChange(changeRequest);

            // Verifica se o calculo foi feito corretamente
            if (changeResponse.Success == true)
            {
                // Instancia montador de string
                StringBuilder stringBuilder = new StringBuilder();

                stringBuilder.AppendFormat("Moedas:");

                foreach (ChangeData changeInCoin in changeResponse.ChangeDataCollection)
                {
                    stringBuilder.AppendFormat("\r\n{0} {1}(s) de {2} centavo(s)", changeInCoin.Quantity, changeInCoin.Name, changeInCoin.AmountInCents);
                }

                // Devolve a mensagem de erro para a interface
                this.UxTxtOutput.AppendText(stringBuilder.ToString());

                // Retorna troco
                return(changeResponse.ChangeAmount.ToString());
            }
            else
            {
                // Instancia montador de string
                StringBuilder stringBuilder = new StringBuilder();

                stringBuilder.AppendFormat("Deu ruim!");

                // Varre a coleção de erros
                foreach (ErrorReport errorReport in changeResponse.ErrorReport)
                {
                    stringBuilder.AppendFormat("\r\nErro no campo {0}: {1}", errorReport.Field, errorReport.Message);
                }

                // Devolve a mensagem de erro para a interface
                this.UxTxtOutput.AppendText(stringBuilder.ToString());

                // Retorna troco vazio
                return(string.Empty);
            }
        }
示例#30
0
 protected FileSystemShimChangeProvider(Lifetime lifetime, Shim.IFileSystem fileSystem,
                                        ChangeManager changeManager, params IChangeProvider[] changeProviders) : base(lifetime, fileSystem)
 {
     changeManager.RegisterChangeProvider(lifetime, this);
     foreach (var changeProvider in changeProviders)
     {
         changeManager.AddDependency(lifetime, this, changeProvider);
     }
 }
示例#31
0
        public void StopMonitoring(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException("path");
            }

            ChangeManager.StopMonitor(path);
        }
示例#32
0
        public void ScheduleMonitor(IEnumerable <string> paths)
        {
            if (paths == null)
            {
                throw new ArgumentNullException("paths");
            }

            ChangeManager.ScheduleMonitor(paths);
        }
示例#33
0
        public void ScheduleGlyphUpdate(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException("path");
            }

            ScheduleGlyphOnlyUpdate(Mapper.GetAllProjectsContaining(path));
            ChangeManager.Refresh(path);
        }
示例#34
0
        public void ScheduleGlyphUpdate(IEnumerable <string> paths)
        {
            if (paths == null)
            {
                throw new ArgumentNullException("paths");
            }

            ScheduleGlyphOnlyUpdate(Mapper.GetAllProjectsContaining(paths));
            ChangeManager.Refresh(paths);
        }
示例#35
0
        public T4PsiModuleProvider([NotNull] Lifetime lifetime, [NotNull] IShellLocks shellLocks, [NotNull] ChangeManager changeManager,
            [NotNull] T4Environment t4Environment, [NotNull] ISolution solution)
        {
            _lifetime = lifetime;
            _shellLocks = shellLocks;
            _changeManager = changeManager;
            _t4Environment = t4Environment;
            _solution = solution;

            changeManager.RegisterChangeProvider(lifetime, this);
            changeManager.AddDependency(lifetime, this, solution);
        }
 public ReflectedReferenceProviderValidator(Lifetime lifetime, IShellLocks shellLocks, ChangeManager changeManager, ISettingsStore settingsStore, ISolution solution)
 {
     var providerValidator = this;
     changeManager.Changed2.Advise(lifetime, Handler(solution, providerValidator));
     settingsStore.BindToContextLive(lifetime, ContextRange.Smart(solution.ToDataContext()))
         .GetValueProperty<MvcCustomReferencesSettings, bool>(lifetime, mvcSettings => mvcSettings.Enabled)
         .Change.Advise_NoAcknowledgement(lifetime,
             () =>
             {
                 if (lifetime.IsTerminated)
                     return;
                 shellLocks.ExecuteOrQueueReadLockEx(lifetime, "ReflectedReferenceProviderValidator", () => shellLocks.ExecuteWithWriteLock(providerValidator.FireOnChanged));
             });
 }
 public ExternalCodeFilesProvider(
     IProjectFileExtensions projectFileExtensions,
     PsiProjectFileTypeCoordinator projectFileTypeCoordinator,
     ChangeManager changeManager,
     IFileSystemTracker fileSystemTracker,
     IShellLocks shellLocks,
     DocumentManager documentManager,
     ISettingsStore settingsStore)
 {
     _projectFileExtensions = projectFileExtensions;
     _projectFileTypeCoordinator = projectFileTypeCoordinator;
     _changeManager = changeManager;
     _fileSystemTracker = fileSystemTracker;
     _shellLocks = shellLocks;
     _documentManager = documentManager;
     _settingsStore = settingsStore;
 }
示例#38
0
        public NitraSolutionComponent(Lifetime lifetime, ISolution solution, ChangeManager changeManager, DocumentManager documentManager,
            IShellLocks locks, IPsiConfiguration psiConfiguration, IPersistentIndexManager persistentIndexManager)
        {
            _persistentIndexManager = persistentIndexManager;
              _psiConfiguration = psiConfiguration;
              _locks = locks;
              _solution = solution;
              _documentManager = documentManager;
              //changeManager.Changed2.Advise(lifetime, OnChangeManagerChanged);

              changeManager.RegisterChangeProvider(lifetime, this);
              changeManager.AddDependency(lifetime, this, documentManager.ChangeProvider);
              changeManager.AddDependency(lifetime, this, solution);

              foreach (var project in solution.GetAllProjects())
              {
            Debug.WriteLine(project.Name);
            //var projectItem = project as JetBrains.Proj
            foreach (var file in project.GetAllProjectFiles())
            {
              var ext = System.IO.Path.GetExtension(file.Name);
              if (string.Equals(ext, ".dll", StringComparison.InvariantCultureIgnoreCase))
            continue;

              if (file.LanguageType.Name == "MSBuild")
            continue;

              if (string.Equals(ext, ".dsl", StringComparison.InvariantCultureIgnoreCase))
              {
            var stream = file.CreateReadStream();
            string content = "";
            using (var streamReader = new StreamReader(stream))
              content = streamReader.ReadToEnd();
            Debug.WriteLine(content);
              }

              Debug.WriteLine(file.Name);
            }

              }
        }
        /// <summary>
        /// Method that is used to encapsulate a series of actions into a single transaction for the user
        /// to undo or redo.
        /// </summary>
        public void Connect()
        {
            //Establish a reference to the change manager
            _changeManager = _inventorApplication.ChangeManager;

            //Establish a reference to the Change Definitions collection for this add-in
            _changeDefinitions = _changeManager.Add(_clientID);

            _changeDefinition = _changeDefinitions.Add(_changeDefInternalName, _changeDefCommandName);

            //Create a change processor
            _changeProcessor = _changeDefinition.CreateChangeProcessor();

            //Connect the events
            this._onExecute_Delegate = new ChangeProcessorSink_OnExecuteEventHandler(changeProcessor_OnExecute);
            _changeProcessor.OnExecute += this._onExecute_Delegate;

            this._onTerminate_Delegate = new ChangeProcessorSink_OnTerminateEventHandler(changeProcessor_OnTerminate);
            _changeProcessor.OnTerminate += this._onTerminate_Delegate;

            //Calling the Execute method is what causes the transaction to occur.
            _changeProcessor.Execute(_inventorApplication.ActiveEditDocument);
        }
示例#40
0
        public Kernel(IEnumerable<IProcessor> processors, IEnumerable<IWatchConfiguration> watchList, OutputFilter outputFilter)
        {
            if (watchList == null)
                throw new ArgumentNullException("watchList");

            if (processors == null)
                throw new ArgumentNullException("processors");

            this.manager = new ChangeManager(processors, outputFilter);

            Lazy<W3CProcessor> w3CProcessor = new Lazy<W3CProcessor>(() => new W3CProcessor());
            DefaultPreProcessor preProcessor = new DefaultPreProcessor();

            foreach (var item in watchList)
            {
                FileNotificationService watcher = this.CreateWatcher(item);

                if (watcher != null)
                {
                    this.watchers.Add(watcher);

                    IPreProcessor selectedPreProcessor;

                    if (!string.IsNullOrEmpty(item.Type) && "w3c".Equals(item.Type, StringComparison.OrdinalIgnoreCase))
                    {
                        selectedPreProcessor = w3CProcessor.Value;
                    }
                    else
                    {
                        selectedPreProcessor = preProcessor;
                    }

                    watcher.ContentAdded += (object o, ContentEventArgs e) => this.manager.Add(selectedPreProcessor.Process(e.FileName, e.AddedContent));
                }
            }
        }
示例#41
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();
        }
示例#42
0
 public ReSharperSolution(Lifetime lifetime, IShellLocks shellLocks, ChangeManager changeManager, ISolution solution, DocumentManager documentManager, IActionManager actionManager, ICommandProcessor commandProcessor, TextControlChangeUnitFactory changeUnitFactory, JetPopupMenus jetPopupMenus)
 {
   XXLanguageXXSolution.Open(lifetime, shellLocks, changeManager, solution, documentManager, actionManager, commandProcessor, changeUnitFactory, jetPopupMenus);
 }
示例#43
0
        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();
        }
示例#44
0
        private static Parameters GetChangeManagerParameters(ChangeManager.Options options)
        {
            var parameters = new Parameters();

            parameters.ApplicationPath = options.ApplicationPath;
            parameters.ArtifactsDirectory = options.ArtifactsFolder;
            parameters.BuildDatabaseTemplateName = options.BuildDatabaseTemplateName;
            parameters.BuildDatabaseTemplateScript = options.BuildDatabaseTemplateScript;
            parameters.BuildScriptPath = options.BuildFilePath;
            parameters.CompareDeltaScriptPath = options.DeltaFilePath;
            parameters.ConfigurationPath = options.ConfigurationPath;
            parameters.PreserveBuildDatabase = options.PreserveBuildDatabase;
            parameters.ProcessMode = (Parameters.ProcessType) Enum.Parse(typeof(Parameters.ProcessType), options.ProcessType);
            parameters.ReportFilePath = options.ReportFilePath;
            parameters.RootDirectory = options.RootFolder;
            parameters.TemplateConfigurationPath = options.TemplateConfigurationPath;
            parameters.XmlReportFilePath = options.XmlReportFilePath;
            parameters.BuildDatabase = new Parameters.Database
                                {
                                    Authentication = options.BuildDatabaseAuthenticationMode != null
                                                         ? (Parameters.Database.AuthenticationMode)
                                                           Enum.Parse(
                                                               typeof (
                                                                   Parameters.Database.AuthenticationMode),
                                                               options.BuildDatabaseAuthenticationMode)
                                                         : Parameters.Database.AuthenticationMode.Windows,
                                    Name = options.BuildDatabaseName,
                                    Password = options.BuildDatabasePassword,
                                    Server = options.BuildDatabaseServer,
                                    Username = options.BuildDatabaseUsername
                                };
            parameters.CompareSourceDatabase = new Parameters.Database
                                        {
                                            Authentication =
                                                options.CompareSourceDatabaseAuthenticationMode != null
                                                    ? (Parameters.Database.AuthenticationMode) Enum.Parse(
                                                        typeof (Parameters.Database.AuthenticationMode),
                                                        options.CompareSourceDatabaseAuthenticationMode)
                                                    : Parameters.Database.AuthenticationMode.Windows,
                                            Name = options.CompareSourceDatabaseName,
                                            Password = options.CompareSourceDatabasePassword,
                                            Server = options.CompareSourceDatabaseServer,
                                            Username = options.CompareSourceDatabaseUsername
                                        };
            parameters.CompareTargetDatabase = new Parameters.Database
                                        {
                                            Authentication =
                                                options.CompareTargetDatabaseAuthenticationMode != null
                                                    ? (Parameters.Database.AuthenticationMode) Enum.Parse(
                                                        typeof (Parameters.Database.AuthenticationMode),
                                                        options.CompareTargetDatabaseAuthenticationMode)
                                                    : Parameters.Database.AuthenticationMode.Windows,
                                            Name = options.CompareTargetDatabaseName,
                                            Password = options.CompareTargetDatabasePassword,
                                            Server = options.CompareTargetDatabaseServer,
                                            Username = options.CompareTargetDatabaseUsername
                                        };
            parameters.ScriptSourceDatabase = new Parameters.Database
                                        {
                                            Name = options.ScriptSourceDatabaseName,
                                            Password = options.ScriptSourceDatabasePassword,
                                            Server = options.ScriptSourceDatabaseServer,
                                            Username = options.ScriptSourceDatabaseUsername
                                        };

            return parameters;
        }