/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { SrcMLFileLogger.DefaultLogger.Info("Initializing SrcML.NET Service ..."); base.Initialize(); ExtensionDirectory = GetExtensionDirectory(); SetUpLogger(); //SetUpCommand(); // SrcML.NET does not need any command so far. AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; //// setup cursor monitoring service //cursorMonitor = GetService(typeof(SCursorMonitorService)) as ICursorMonitorService; // setup srcML service srcMLService = GetService(typeof(SSrcMLGlobalService)) as ISrcMLGlobalService; // setup working set registrar _workingSetRegistrar = GetService(typeof(SWorkingSetRegistrarService)) as IWorkingSetRegistrarService; _workingSetRegistrar.RegisterWorkingSetFactory(new DefaultWorkingSetFactory <CompleteWorkingSet>()); SetUpDTEEvents(); SrcMLFileLogger.DefaultLogger.Info("Initialization completed."); }
private static XElement GetXElementForFile(FileEventRaisedArgs args, ISrcMLGlobalService srcMLService) { XElement xelement = null; if (!args.EventType.Equals(FileEventType.FileDeleted)) { if (args.FilePath.EndsWith(".xml") || args.FilePath.EndsWith(".xaml")) { var allText = File.ReadAllText(args.FilePath); try { xelement = XDocument.Parse(allText, LoadOptions.SetLineInfo | LoadOptions.PreserveWhitespace).Root; } catch (Exception e) { return(xelement); } } else { xelement = srcMLService.GetXElementForSourceFile(args.FilePath); } } return(xelement); }
internal static bool WaitForServiceToFinish(ISrcMLGlobalService service, int millisecondsTimeout) { AutoResetEvent monitoringStartedResetEvent = new AutoResetEvent(false), updateArchivesStartedResetEvent = new AutoResetEvent(false), updateArchivesCompletedResetEvent = new AutoResetEvent(false); EventHandler monitoringStartedEventHandler = GetEventHandler(monitoringStartedResetEvent), updateStartedEventHandler = GetEventHandler(updateArchivesStartedResetEvent), updateCompleteEventHandler = GetEventHandler(updateArchivesCompletedResetEvent); service.MonitoringStarted += monitoringStartedEventHandler; service.UpdateArchivesStarted += updateStartedEventHandler; service.UpdateArchivesCompleted += updateCompleteEventHandler; service.StartMonitoring(); Assert.IsTrue(updateArchivesStartedResetEvent.WaitOne(millisecondsTimeout)); Assert.IsTrue(monitoringStartedResetEvent.WaitOne(millisecondsTimeout)); Assert.IsTrue(updateArchivesCompletedResetEvent.WaitOne(millisecondsTimeout)); service.MonitoringStarted -= monitoringStartedEventHandler; service.UpdateArchivesStarted -= updateStartedEventHandler; service.UpdateArchivesCompleted -= updateCompleteEventHandler; return(!service.IsUpdating); }
internal static bool WaitForServiceToFinish(ISrcMLGlobalService service, int millisecondsTimeout) { AutoResetEvent monitoringStartedResetEvent = new AutoResetEvent(false), updateArchivesStartedResetEvent = new AutoResetEvent(false), updateArchivesCompletedResetEvent = new AutoResetEvent(false); EventHandler monitoringStartedEventHandler = GetEventHandler(monitoringStartedResetEvent), updateStartedEventHandler = GetEventHandler(updateArchivesStartedResetEvent), updateCompleteEventHandler = GetEventHandler(updateArchivesCompletedResetEvent); service.MonitoringStarted += monitoringStartedEventHandler; service.UpdateArchivesStarted += updateStartedEventHandler; service.UpdateArchivesCompleted += updateCompleteEventHandler; service.StartMonitoring(); Assert.IsTrue(updateArchivesStartedResetEvent.WaitOne(millisecondsTimeout)); Assert.IsTrue(monitoringStartedResetEvent.WaitOne(millisecondsTimeout)); Assert.IsTrue(updateArchivesCompletedResetEvent.WaitOne(millisecondsTimeout)); service.MonitoringStarted -= monitoringStartedEventHandler; service.UpdateArchivesStarted -= updateStartedEventHandler; service.UpdateArchivesCompleted -= updateCompleteEventHandler; return !service.IsUpdating; }
public static void ClassCleanup() { srcMLService = null; package.SetSite(null); package.Close(); package = null; }
/// <summary> /// Creates a new data service /// </summary> /// <param name="serviceProvider">The container where this service is sited</param> /// <param name="taskManagerService">The task manager</param> /// <param name="srcMLService">The srcML service</param> /// <param name="workingSetService">The working set factory service</param> public VsDataService(SrcMLServicePackage serviceProvider, ITaskManagerService taskManagerService, ISrcMLGlobalService srcMLService, IWorkingSetRegistrarService workingSetService) : base(serviceProvider, taskManagerService) { _srcMLService = srcMLService; _workingSetFactories = workingSetService; if(_srcMLService.IsMonitoring) { _srcMLService_MonitoringStarted(this, new EventArgs()); } Subscribe(); }
/// <summary> /// Set up SrcML Service. /// </summary> private void SetUpSrcMLService() { SrcMLFileLogger.DefaultLogger.Info("> Set up SrcML Service."); srcMLService = GetService(typeof(SSrcMLGlobalService)) as ISrcMLGlobalService; if (null == srcMLService) { Trace.WriteLine("Can not get the SrcML global service."); } }
internal static bool WaitForServiceToFinish(ISrcMLGlobalService service, int millisecondsTimeout) { if(!service.IsReady) { ManualResetEvent mre = new ManualResetEvent(false); EventHandler<IsReadyChangedEventArgs> action = (o, e) => { mre.Set(); }; service.IsReadyChanged += action; mre.WaitOne(millisecondsTimeout); service.IsReadyChanged -= action; } return service.IsReady; }
/// <summary> /// Step 3: Implement the callback method. /// This is the function that will create a new instance of the services the first time a client /// will ask for a specific service type. It is called by the base class's implementation of /// IServiceProvider. /// </summary> /// <param name="container">The IServiceContainer that needs a new instance of the service. /// This must be this package.</param> /// <param name="serviceType">The type of service to create.</param> /// <returns>The instance of the service.</returns> private object CreateService(IServiceContainer container, Type serviceType) { SrcMLFileLogger.DefaultLogger.Info(" SrcMLServicePackage.CreateService()"); // Check if the IServiceContainer is this package. if (container != this) { Trace.WriteLine("ServicesPackage.CreateService called from an unexpected service container."); return(null); } // Find the type of the requested service and create it. if (typeof(SCursorMonitorService) == serviceType) { return(new CursorMonitor(this)); } if (typeof(SMethodTrackService) == serviceType) { return(new MethodTrack(this)); } if (typeof(SSrcMLGlobalService) == serviceType) { // Build the global service using this package as its service provider. ITaskManagerService taskManager = GetService(typeof(STaskManagerService)) as ITaskManagerService; return(new VsMonitoringService(this, taskManager)); } if (typeof(SSrcMLDataService) == serviceType) { ITaskManagerService taskManager = GetService(typeof(STaskManagerService)) as ITaskManagerService; ISrcMLGlobalService srcMLService = GetService(typeof(SSrcMLGlobalService)) as ISrcMLGlobalService; IWorkingSetRegistrarService workingSetService = GetService(typeof(SWorkingSetRegistrarService)) as IWorkingSetRegistrarService; return(new VsDataService(this, taskManager, srcMLService, workingSetService)); } if (typeof(STaskManagerService) == serviceType) { return(new TaskManagerService(this, new ConservativeAbbCoreStrategy())); } if (typeof(SWorkingSetRegistrarService) == serviceType) { return(new WorkingSetRegistrarService(this)); } // If we are here the service type is unknown, so write a message on the debug output // and return null. Trace.WriteLine("ServicesPackage.CreateService called for an unknown service type."); return(null); }
/// <summary> /// Creates a new data service /// </summary> /// <param name="serviceProvider">The container where this service is sited</param> /// <param name="taskManagerService">The task manager</param> /// <param name="srcMLService">The srcML service</param> /// <param name="workingSetService">The working set factory service</param> public VsDataService(SrcMLServicePackage serviceProvider, ITaskManagerService taskManagerService, ISrcMLGlobalService srcMLService, IWorkingSetRegistrarService workingSetService) : base(serviceProvider, taskManagerService) { _srcMLService = srcMLService; _workingSetFactories = workingSetService; if (_srcMLService.IsMonitoring) { _srcMLService_MonitoringStarted(this, new EventArgs()); } Subscribe(); }
internal static bool WaitForServiceToFinish(ISrcMLGlobalService service, int millisecondsTimeout) { System.Threading.Thread.Sleep(2000); if (!service.IsReady) { ManualResetEvent mre = new ManualResetEvent(false); EventHandler <IsReadyChangedEventArgs> action = (o, e) => { mre.Set(); }; service.IsReadyChanged += action; mre.WaitOne(millisecondsTimeout); service.IsReadyChanged -= action; } System.Threading.Thread.Sleep(10000); return(service.IsReady); }
public SrcMLDataService(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; _taskManager = _serviceProvider.GetService(typeof(STaskManagerService)) as ITaskManagerService; _srcMLService = _serviceProvider.GetService(typeof(SSrcMLGlobalService)) as ISrcMLGlobalService; if (_srcMLService != null) { if (_srcMLService.IsMonitoring) { RespondToMonitoringStarted(this, new EventArgs()); } SubscribeToEvents(); } }
public static void ClassInitialize(TestContext testContext) { // Create SrcMLServicePackage SrcMLServicePackage packageObject = new SrcMLServicePackage(); package = (IVsPackage)packageObject; Assert.IsNotNull(package, "Get a null SrcMLServicePackage instance."); IServiceProvider serviceProvider = package as IServiceProvider; // Get SrcML Service object o = serviceProvider.GetService(typeof(SSrcMLGlobalService)); Assert.IsNotNull(o, "GetService returned null for the global service."); srcMLService = o as ISrcMLGlobalService; Assert.IsNotNull(srcMLService, "The service SSrcMLGlobalService does not implements ISrcMLGlobalService."); // Register SrcML Service events srcMLService.SourceFileChanged += SourceFileChanged; srcMLService.IsReadyChanged += IsReadyChanged; srcMLService.MonitoringStopped += MonitoringStopped; }
public void GetGlobalServiceSimple() { SrcMLServicePackage packageObject = new SrcMLServicePackage(); IVsPackage package = (IVsPackage)packageObject; using (OleServiceProvider provider = OleServiceProvider.CreateOleServiceProviderWithBasicServices()) { int result = package.SetSite(provider); Assert.IsTrue(Microsoft.VisualStudio.ErrorHandler.Succeeded(result), "SetSite failed."); IServiceProvider serviceProvider = package as IServiceProvider; object o = serviceProvider.GetService(typeof(SSrcMLGlobalService)); Assert.IsNotNull(o, "GetService returned null for the global service."); ISrcMLGlobalService service = o as ISrcMLGlobalService; Assert.IsNotNull(service, "The service SSrcMLGlobalService does not implements ISrcMLGlobalService."); ///////service.GlobalServiceFunction(); } package.SetSite(null); package.Close(); }
/// <summary> /// Creates a new data service object /// </summary> /// <param name="serviceProvider">The service provider where this service is sited</param> public SrcMLDataService(IServiceProvider serviceProvider) { _isMonitoring = false; _isUpdating = false; _serviceProvider = serviceProvider; _workingSetFactories = serviceProvider.GetService(typeof(SWorkingSetRegistrarService)) as IWorkingSetRegistrarService; _taskManager = _serviceProvider.GetService(typeof(STaskManagerService)) as ITaskManagerService; _srcMLService = _serviceProvider.GetService(typeof(SSrcMLGlobalService)) as ISrcMLGlobalService; if (_srcMLService != null) { if (_srcMLService.IsMonitoring) { RespondToMonitoringStarted(this, new EventArgs()); } SubscribeToEvents(); } }
public MethodTrack(IServiceProvider sp) { _serviceProvider = sp; _dataService = sp.GetService(typeof(SSrcMLDataService)) as ISrcMLDataService; _srcmlService = sp.GetService(typeof(SSrcMLGlobalService)) as ISrcMLGlobalService; _cursorMonitor = sp.GetService(typeof(SCursorMonitorService)) as ICursorMonitorService; _currentMethod = new Method(); _navigatedMethods = new List <Method>(); _currentCursor = new CursorPos("", 0, 0); if (null != _cursorMonitor) { _cursorMonitor.PropertyChanged += OnCursorMoving; } if (null != _srcmlService) { _srcmlService.SourceFileChanged += OnFileChanged; } }
public static string GetDisplayPathMonitoredFiles(ISrcMLGlobalService service, object callingObject) { if (service.MonitoredDirectories.Count > 0) { var fullpath = service.MonitoredDirectories.First(); var path = Path.GetFileName(fullpath); try { var parent = Path.GetFileName(Path.GetDirectoryName(fullpath)); path += " in folder " + parent; } catch (Exception e) { LogEvents.UIIndexUpdateError(callingObject, e); } return(path); } else { return(SearchViewControl.PleaseAddDirectoriesMessage); } }
internal static bool WaitForServiceToFinish(ISrcMLGlobalService service, int millisecondsTimeout) { System.Threading.Thread.Sleep(2000); if (service.IsUpdating) { ManualResetEvent mre = new ManualResetEvent(false); EventHandler action = (o, e) => { mre.Set(); }; service.UpdateArchivesCompleted += action; mre.WaitOne(millisecondsTimeout); service.UpdateArchivesCompleted -= action; } System.Threading.Thread.Sleep(10000); return !service.IsUpdating; }
private static XElement GetXElement(FileEventRaisedArgs args, ISrcMLGlobalService srcMLService) { try { return srcMLService.GetXElementForSourceFile(args.FilePath); } catch (ArgumentException e) { return XElement.Load(args.FilePath); } }
private static void ProcessFileEvent(ISrcMLGlobalService srcMLService, FileEventRaisedArgs args, bool commitImmediately, DocumentIndexer documentIndexer) { string sourceFilePath = args.FilePath; var fileExtension = Path.GetExtension(sourceFilePath); var parsableToXml = (ExtensionPointsRepository.Instance.GetParserImplementation(fileExtension) != null); if (ConcurrentIndexingMonitor.TryToLock(sourceFilePath)) return; XElement xelement = null; if (parsableToXml) { xelement = GetXElement(args, srcMLService); if (xelement == null && args.EventType != FileEventType.FileDeleted) return; } var indexUpdateManager = ServiceLocator.Resolve<IndexUpdateManager>(); try { switch (args.EventType) { case FileEventType.FileAdded: documentIndexer.DeleteDocuments(sourceFilePath.ToLowerInvariant()); //"just to be safe!" indexUpdateManager.Update(sourceFilePath.ToLowerInvariant(), xelement); if (parsableToXml) { SwumManager.Instance.AddSourceFile(sourceFilePath.ToLowerInvariant(), xelement); } break; case FileEventType.FileChanged: documentIndexer.DeleteDocuments(sourceFilePath.ToLowerInvariant()); indexUpdateManager.Update(sourceFilePath.ToLowerInvariant(), xelement); if (parsableToXml) { SwumManager.Instance.UpdateSourceFile(sourceFilePath.ToLowerInvariant(), xelement); } break; case FileEventType.FileDeleted: documentIndexer.DeleteDocuments(sourceFilePath.ToLowerInvariant(), commitImmediately); if (parsableToXml) { SwumManager.Instance.RemoveSourceFile(sourceFilePath.ToLowerInvariant()); } break; case FileEventType.FileRenamed: // FileRenamed is repurposed. Now means you may already know about it, so // check and only parse if not existing if (!SwumManager.Instance.ContainsFile(sourceFilePath.ToLowerInvariant())) { documentIndexer.DeleteDocuments(sourceFilePath.ToLowerInvariant()); //"just to be safe!" indexUpdateManager.Update(sourceFilePath.ToLowerInvariant(), xelement); if (parsableToXml) { SwumManager.Instance.AddSourceFile(sourceFilePath.ToLowerInvariant(), xelement); } } break; default: // if we get here, a new event was probably added. for now, no-op break; } } catch (AlreadyClosedException ace) { //ignore, index closed } ConcurrentIndexingMonitor.ReleaseLock(sourceFilePath); }
public SrcMLCppParser(ISrcMLGlobalService srcmlService) { this.SrcMLService = srcmlService; }
/// <summary> /// Creates a new data service object /// </summary> /// <param name="serviceProvider">The service provider where this service is sited</param> public SrcMLDataService(IServiceProvider serviceProvider) { _isMonitoring = false; _isUpdating = false; _serviceProvider = serviceProvider; _workingSetFactories = serviceProvider.GetService(typeof(SWorkingSetRegistrarService)) as IWorkingSetRegistrarService; _taskManager = _serviceProvider.GetService(typeof(STaskManagerService)) as ITaskManagerService; _srcMLService = _serviceProvider.GetService(typeof(SSrcMLGlobalService)) as ISrcMLGlobalService; if(_srcMLService != null) { if(_srcMLService.IsMonitoring) { RespondToMonitoringStarted(this, new EventArgs()); } SubscribeToEvents(); } }
private void AddDirectoryToMonitor(ISrcMLGlobalService srcMlService, IndexedFile file) { List<IndexedFile> indexFilesThatFailedToAdd = new List<IndexedFile>(); foreach (IndexedFile addFile in this.IndexedFiles) { if (addFile.GUID == file.GUID) { try { srcMlService.AddDirectoryToMonitor(addFile.FilePath); } catch (DirectoryScanningMonitorSubDirectoryException cantAdd) { MessageBox.Show("Sub-directories of existing directories cannot be added - " + cantAdd.Message, "Invalid Directory", MessageBoxButton.OK, MessageBoxImage.Warning); indexFilesThatFailedToAdd.Add(addFile); } catch (ForbiddenDirectoryException cantAdd) { MessageBox.Show(cantAdd.Message, "Invalid Directory", MessageBoxButton.OK, MessageBoxImage.Warning); indexFilesThatFailedToAdd.Add(addFile); } } } foreach (var indexedFile in indexFilesThatFailedToAdd) this.IndexedFiles.Remove(indexedFile); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { SrcMLFileLogger.DefaultLogger.Info("Initializing SrcML.NET Service ..."); base.Initialize(); ExtensionDirectory = GetExtensionDirectory(); SetUpLogger(); //SetUpCommand(); // SrcML.NET does not need any command so far. AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; //// setup cursor monitoring service //cursorMonitor = GetService(typeof(SCursorMonitorService)) as ICursorMonitorService; // setup srcML service srcMLService = GetService(typeof(SSrcMLGlobalService)) as ISrcMLGlobalService; // setup working set registrar _workingSetRegistrar = GetService(typeof(SWorkingSetRegistrarService)) as IWorkingSetRegistrarService; _workingSetRegistrar.RegisterWorkingSetFactory(new DefaultWorkingSetFactory<CompleteWorkingSet>()); SetUpDTEEvents(); SrcMLFileLogger.DefaultLogger.Info("Initialization completed."); }
/// <summary> /// Respond to solution opening. /// Still use Sando's SolutionMonitorFactory because Sando's SolutionMonitorFactory has too much indexer code which is specific with Sando. /// </summary> private void RespondToSolutionOpened(object sender, DoWorkEventArgs ee) { try { updatedForThisSolution = false; //TODO if solution is reopen - the guid should be read from file - future change var solutionId = Guid.NewGuid(); var openSolution = ServiceLocator.Resolve <DTE2>().Solution; var solutionPath = openSolution.FileName; var key = new SolutionKey(solutionId, solutionPath); ServiceLocator.RegisterInstance(key); var sandoOptions = ServiceLocator.Resolve <ISandoOptionsProvider>().GetSandoOptions(); bool isIndexRecreationRequired = IndexStateManager.IsIndexRecreationRequired(); isIndexRecreationRequired = isIndexRecreationRequired || !PathManager.Instance.IndexPathExists(key); ServiceLocator.RegisterInstance(new IndexFilterManager()); ServiceLocator.RegisterInstance <Analyzer>(GetAnalyzer()); SrcMLArchiveEventsHandlers srcMLArchiveEventsHandlers = ServiceLocator.Resolve <SrcMLArchiveEventsHandlers>(); var currentIndexer = new DocumentIndexer(srcMLArchiveEventsHandlers, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10)); ServiceLocator.RegisterInstance(currentIndexer); ServiceLocator.RegisterInstance(new IndexUpdateManager()); if (isIndexRecreationRequired) { currentIndexer.ClearIndex(); } ServiceLocator.Resolve <InitialIndexingWatcher>().InitialIndexingStarted(); // JZ: SrcMLService Integration // Get the SrcML Service. srcMLService = GetService(typeof(SSrcMLGlobalService)) as ISrcMLGlobalService; if (null == srcMLService) { throw new Exception("Can not get the SrcML global service."); } else { ServiceLocator.RegisterInstance(srcMLService); } // Register all types of events from the SrcML Service. if (!SetupHandlers) { SetupHandlers = true; srcMLService.SourceFileChanged += srcMLArchiveEventsHandlers.SourceFileChanged; srcMLService.MonitoringStopped += srcMLArchiveEventsHandlers.MonitoringStopped; } //This is done here because some extension points require data that isn't set until the solution is opened, e.g. the solution key or the srcml archive //However, registration must happen before file monitoring begins below. RegisterExtensionPoints(); SwumManager.Instance.Initialize(PathManager.Instance.GetIndexPath(ServiceLocator.Resolve <SolutionKey>()), !isIndexRecreationRequired); //SwumManager.Instance.Archive = _srcMLArchive; ////XQ: for testing //ISandoGlobalService sandoService = GetService(typeof(SSandoGlobalService)) as ISandoGlobalService; //var res = sandoService.GetSearchResults("Monster"); // xige var dictionary = new DictionaryBasedSplitter(); dictionary.Initialize(PathManager.Instance.GetIndexPath(ServiceLocator.Resolve <SolutionKey>())); ServiceLocator.Resolve <IndexUpdateManager>().indexUpdated += dictionary.UpdateProgramElement; ServiceLocator.RegisterInstance(dictionary); var reformer = new QueryReformerManager(dictionary); reformer.Initialize(null); ServiceLocator.RegisterInstance(reformer); var history = new SearchHistory(); history.Initialize(PathManager.Instance.GetIndexPath (ServiceLocator.Resolve <SolutionKey>())); ServiceLocator.RegisterInstance(history); // End of code changes if (sandoOptions.AllowDataCollectionLogging) { SandoLogManager.StartDataCollectionLogging(PathManager.Instance.GetExtensionRoot()); } else { SandoLogManager.StopDataCollectionLogging(); } LogEvents.SolutionOpened(this, Path.GetFileName(solutionPath)); if (isIndexRecreationRequired) { //just recreate the whole index var indexingTask = System.Threading.Tasks.Task.Factory.StartNew(() => { Collection <string> files = null; while (files == null) { try { files = srcMLService.GetSrcMLArchive().GetFiles(); } catch (NullReferenceException ne) { System.Threading.Thread.Sleep(3000); } } foreach (var file in srcMLService.GetSrcMLArchive().FileUnits) { var fileName = ABB.SrcML.SrcMLElement.GetFileNameForUnit(file); srcMLArchiveEventsHandlers.SourceFileChanged(srcMLService, new FileEventRaisedArgs(FileEventType.FileAdded, fileName)); } srcMLArchiveEventsHandlers.WaitForIndexing(); }); } else { //make sure you're not missing any files var indexingTask = System.Threading.Tasks.Task.Factory.StartNew(() => { Collection <string> files = null; while (files == null) { try { files = srcMLService.GetSrcMLArchive().GetFiles(); } catch (NullReferenceException ne) { System.Threading.Thread.Sleep(3000); } } foreach (var fileName in srcMLService.GetSrcMLArchive().GetFiles()) { srcMLArchiveEventsHandlers.SourceFileChanged(srcMLService, new FileEventRaisedArgs(FileEventType.FileRenamed, fileName)); } srcMLArchiveEventsHandlers.WaitForIndexing(); }); } } catch (Exception e) { LogEvents.UIRespondToSolutionOpeningError(this, e); } var updateListedFoldersTask = System.Threading.Tasks.Task.Factory.StartNew(() => { bool done = false; while (!done) { System.Threading.Thread.Sleep(2000); if (srcMLService != null) { if (srcMLService.MonitoredDirectories != null) { UpdateIndexingFilesList(); done = true; } } } }); }
private void RegisterSrcMLService() { srcMLService = GetService(typeof(SSrcMLGlobalService)) as ISrcMLGlobalService; if (null == srcMLService) { throw new Exception("Cannot get the SrcML global service."); } else { ServiceLocator.RegisterInstance(srcMLService); } }
/// <summary> /// Set up SrcML Service. /// </summary> private void SetUpSrcMLService() { SrcMLFileLogger.DefaultLogger.Info("> Set up SrcML Service."); srcMLService = GetService(typeof(SSrcMLGlobalService)) as ISrcMLGlobalService; if(null == srcMLService) { Trace.WriteLine("Can not get the SrcML global service."); } }
public MethodTrack(IServiceProvider sp) { _serviceProvider = sp; _dataService = sp.GetService(typeof(SSrcMLDataService)) as ISrcMLDataService; _srcmlService = sp.GetService(typeof(SSrcMLGlobalService)) as ISrcMLGlobalService; _cursorMonitor = sp.GetService(typeof(SCursorMonitorService)) as ICursorMonitorService; _currentMethod = new Method(); _navigatedMethods = new List<Method>(); _currentCursor = new CursorPos("", 0, 0); if (null != _cursorMonitor) _cursorMonitor.PropertyChanged += OnCursorMoving; if(null != _srcmlService) _srcmlService.SourceFileChanged += OnFileChanged; }