void project_ParseInformationUpdated(object sender, ParseInformationEventArgs e)
 {
     if (testProject != null)
     {
         testProject.NotifyParseInformationChanged(e.OldUnresolvedFile, e.NewUnresolvedFile);
     }
 }
        async void UpdateTick(ParseInformationEventArgs e)
        {
            bool isActive = ctl.IsVisible && !SD.ParserService.LoadSolutionProjectsThread.IsRunning;

            timer.IsEnabled = isActive;
            if (!isActive)
            {
                return;
            }
            LoggingService.Debug("DefinitionViewPad.Update");

            ResolveResult res = await ResolveAtCaretAsync(e);

            if (res == null)
            {
                return;
            }
            var pos = res.GetDefinitionRegion();

            if (pos.IsEmpty)
            {
                return;                          // TODO : try to decompile?
            }
            OpenFile(pos);
        }
Esempio n. 3
0
 public void ParserServiceParseInformationUpdated(object sender, ParseInformationEventArgs e)
 {
     lock (pending) {
         pending.Add(e);
     }
     WorkbenchSingleton.SafeThreadAsyncCall(UpdateThread);
 }
Esempio n. 4
0
 public void ParserServiceParseInformationUpdated(object sender, ParseInformationEventArgs e)
 {
     lock (pending) {
         pending.Add(new ICompilationUnit[] { e.ParseInformation.MostRecentCompilationUnit as ICompilationUnit, e.CompilationUnit });
     }
     WorkbenchSingleton.SafeThreadAsyncCall(UpdateThread);
 }
        Task <ResolveResult> ResolveAtCaretAsync(ParseInformationEventArgs e)
        {
            IWorkbenchWindow window = SD.Workbench.ActiveWorkbenchWindow;

            if (window == null)
            {
                return(Task.FromResult <ResolveResult>(null));
            }
            IViewContent viewContent = window.ActiveViewContent;

            if (viewContent == null)
            {
                return(Task.FromResult <ResolveResult>(null));
            }
            ITextEditor editor = viewContent.GetService <ITextEditor>();

            if (editor == null)
            {
                return(Task.FromResult <ResolveResult>(null));
            }

            // e might be null when this is a manually triggered update
            // don't resolve when an unrelated file was changed
            if (e != null && editor.FileName != e.FileName)
            {
                return(Task.FromResult <ResolveResult>(null));
            }

            return(SD.ParserService.ResolveAsync(editor.FileName, editor.Caret.Location, editor.Document));
        }
Esempio n. 6
0
 void ParseInformationUpdated(object source, ParseInformationEventArgs e)
 {
     lock (pending) {
         ICompilationUnit[] units = new ICompilationUnit[] { e.OldCompilationUnit, e.NewCompilationUnit };
         pending.Add(units);
     }
     WorkbenchSingleton.SafeThreadAsyncCall(UpdateParseInfo);
 }
		void ParseInfoUpdated(object sender, ParseInformationEventArgs e)
		{
			if (this.editor == null || !FileUtility.IsEqualFileName(this.editor.FileName, e.FileName))
				return;
			
			var parseInfo = e.NewParseInformation as XamlFullParseInformation;
			if (parseInfo != null && parseInfo.Document != null)
				UpdateTree(parseInfo.Document);
		}
        private void ParserService_ParseInformationUpdated(object sender, ParseInformationEventArgs e)
        {
            if (_textEditor == null || !FileUtility.IsEqualFileName(_textEditor.FileName, e.FileName))
            {
                return;
            }

            trvLayout.Items.Clear();

            IVbModuleWrapper wrapper = (IVbModuleWrapper)e.NewUnresolvedFile;

            TreeViewItem root = new TreeViewItem();

            root.Header = GetNodeHeaderWithIcon(wrapper.Module.Name, CompletionImage.Class);

            TreeViewItem fields = new TreeViewItem();

            root.Items.Add(fields);

            TreeViewItem properties = new TreeViewItem();

            root.Items.Add(properties);

            TreeViewItem methods = new TreeViewItem();

            root.Items.Add(methods);

            foreach (IVbMember member in wrapper.Module.Members)
            {
                TreeViewItem memberNode = new TreeViewItem();
                memberNode.Header    = member.Name;
                memberNode.Tag       = member;
                memberNode.Selected += memberNode_Selected;

                if (member is IVbProperty)
                {
                    properties.Items.Add(memberNode);
                }
                else if (member is IVbMethod)
                {
                    methods.Items.Add(memberNode);
                }
                else if (member is IVbField)
                {
                    fields.Items.Add(memberNode);
                }
            }

            fields.Header     = GetNodeHeaderWithIcon(string.Format("Fields ({0})", fields.Items.Count), CompletionImage.Field);
            properties.Header = GetNodeHeaderWithIcon(string.Format("Properties ({0})", properties.Items.Count), CompletionImage.Property);
            methods.Header    = GetNodeHeaderWithIcon(string.Format("Methods ({0})", methods.Items.Count), CompletionImage.Method);

            root.ExpandSubtree();

            trvLayout.Items.Add(root);
        }
Esempio n. 9
0
		void ParseInfoUpdated(object sender, ParseInformationEventArgs e) {
			if (this.editor == null || !FileUtility.IsEqualFileName(this.editor.FileName, e.FileName))
				return;
			
			var parseInfo = e.NewParseInformation as CSharpFullParseInformation;
			if (parseInfo != null && parseInfo.SyntaxTree != null) {
				this.updateTreeTimer.Stop();
				this.syntaxTree = parseInfo.SyntaxTree;
				this.updateTreeTimer.Start();
			}			
		}
Esempio n. 10
0
		static void ParserService_ParseInformationUpdated(object sender, ParseInformationEventArgs e)
		{
			if (e.NewUnresolvedFile == SD.ParserService.GetExistingUnresolvedFile(e.FileName)) {
				// Call UpdateCommentTags only for the main parse information (if a file is in multiple projects),
				// and only if the results haven't already been replaced with a more recent ParseInformation.
				if (e.NewParseInformation != null) {
					UpdateCommentTags(e.FileName, e.NewParseInformation.TagComments);
				} else {
					UpdateCommentTags(e.FileName, new List<TagComment>());
				}
			}
		}
Esempio n. 11
0
 void ParserServiceParseInformationUpdated(object sender, ParseInformationEventArgs e)
 {
     WorkbenchSingleton.DebugAssertMainThread();
     foreach (TreeNode node in classBrowserTreeView.Nodes)
     {
         AbstractProjectNode prjNode = node as AbstractProjectNode;
         if (prjNode != null && e.ProjectContent.Project == prjNode.Project)
         {
             prjNode.UpdateParseInformation(e.OldCompilationUnit, e.NewCompilationUnit);
         }
     }
 }
Esempio n. 12
0
        public override void OnParseInformationUpdated(ParseInformationEventArgs args)
        {
            var c = projectContentContainer;

            if (c != null)
            {
                c.ParseInformationUpdated(args.OldUnresolvedFile, args.NewUnresolvedFile);
            }
            // OnParseInformationUpdated is called inside a lock, but we don't want to raise the event inside that lock.
            // To ensure events are raised in the same order, we always invoke on the main thread.
            SD.MainThread.InvokeAsyncAndForget(delegate { ParseInformationUpdated(null, args); });
        }
Esempio n. 13
0
        void OnParseInformationUpdated(object sender, ParseInformationEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("ClassDiagramViewContent.OnParseInformationUpdated");

            if (e == null)
            {
                return;
            }
            if (e.NewCompilationUnit == null)
            {
                return;
            }
            if (e.NewCompilationUnit.ProjectContent == null)
            {
                return;
            }
            if (e.NewCompilationUnit.ProjectContent.Classes == null)
            {
                return;
            }
            if (e.NewCompilationUnit.ProjectContent != projectContent)
            {
                return;
            }
            //TODO - this is a wrong way to handle changed parse informtation.
            //       the correct way is to mark removed classes as missing, and to
            //       update changed classes that exist in the diagram.

            /*
             * List<CanvasItem> addedItems = new List<CanvasItem>();
             * foreach (IClass ct in e.CompilationUnit.ProjectContent.Classes)
             * {
             *      if (!canvas.Contains(ct))
             *      {
             *              ClassCanvasItem item = ClassCanvas.CreateItemFromType(ct);
             *              canvas.AddCanvasItem(item);
             *              addedItems.Add(item);
             *      }
             * }
             *
             * WorkbenchSingleton.SafeThreadAsyncCall<ICollection<CanvasItem>>(PlaceNewItems, addedItems);
             *
             * foreach (CanvasItem ci in canvas.GetCanvasItems())
             * {
             *      ClassCanvasItem cci = ci as ClassCanvasItem;
             *      if (cci != null)
             *      {
             *              if (!e.CompilationUnit.ProjectContent.Classes.Contains(cci.RepresentedClassType))
             *                      canvas.RemoveCanvasItem(cci);
             *      }
             * }
             */
        }
 void ParseInformationUpdated(object sender, ParseInformationEventArgs e)
 {
     if (SD.ParserService.LoadSolutionProjectsThread.IsRunning)
     {
         return;
     }
     if (!e.FileName.Equals(editor.FileName))
     {
         return;
     }
     currentReferences = null;
     textView.InvalidateLayer(KnownLayer.Selection);
 }
        void ParseInfoUpdated(object sender, ParseInformationEventArgs e)
        {
            if (this.editor == null || !FileUtility.IsEqualFileName(this.editor.FileName, e.FileName))
            {
                return;
            }

            var parseInfo = e.NewParseInformation as XamlFullParseInformation;

            if (parseInfo != null && parseInfo.Document != null)
            {
                UpdateTree(parseInfo.Document);
            }
        }
Esempio n. 16
0
        void OnParseInformationChanged(object sender, ParseInformationEventArgs e)
        {
            // To prevent some NullReferenceException (possibly when the user switch between editors)
            if (this.ParentEditor == null || this.ParentEditor.DisplayBinding == null || e == null)
            {
                return;
            }
            if (this.ParentEditor.DisplayBinding.ContentName != e.FileName)
            {
                return;
            }

            lastCu = e.ParseInformation.MostRecentCompilationUnit;
            UpdateAutocorTimer();
        }
 void ParserService_ParseInformationUpdated(object sender, ParseInformationEventArgs e)
 {
     if (FileUtility.IsEqualFileName(e.FileName, document.FileName) && invalidLines.Count > 0)
     {
         cachedLines.Clear();
         foreach (IDocumentLine line in invalidLines)
         {
             if (!line.IsDeleted)
             {
                 OnHighlightingStateChanged(line.LineNumber, line.LineNumber);
             }
         }
         invalidLines.Clear();
     }
 }
        void ParseInfoUpdated(object sender, ParseInformationEventArgs e)
        {
            if (this.editor == null || !FileUtility.IsEqualFileName(this.editor.FileName, e.FileName))
            {
                return;
            }
            if (!e.IsPrimaryParseInfoForFile)
            {
                return;
            }

            var cu = e.NewCompilationUnit as XamlCompilationUnit;

            if (cu != null && cu.TreeRootNode != null)
            {
                UpdateTree(cu.TreeRootNode);
            }
        }
Esempio n. 19
0
        void SD_ParserService_ParseInformationUpdated(object sender, ParseInformationEventArgs e)
        {
            var parseInfo = e.NewParseInformation as CSharpFullParseInformation;
            ITextSourceVersion currentVersion = editor.Document.Version;

            if (parseInfo == null)
            {
                return;
            }
            ITextSourceVersion parsedVersion = parseInfo.ParsedVersion;

            if (parsedVersion != null && currentVersion != null && parsedVersion.BelongsToSameDocumentAs(currentVersion))
            {
                if (analyzedVersion != null && analyzedVersion.CompareAge(parsedVersion) == 0)
                {
                    // don't analyze the same version twice
                    return;
                }
                RunAnalysis(editor.Document.CreateSnapshot(), parseInfo);
            }
        }
Esempio n. 20
0
 void ParserServiceParseInformationUpdated(object sender, ParseInformationEventArgs e)
 {
     if (e.FileName != this.FileName)
     {
         return;
     }
     this.VerifyAccess();
     // When parse information is updated quickly in succession, only do a single update
     // to the latest version.
     updateParseInfoTo = e.NewParseInformation;
     this.Dispatcher.BeginInvoke(
         DispatcherPriority.Background,
         new Action(
             delegate {
         if (updateParseInfoTo != null)
         {
             ParseInformationUpdated(updateParseInfoTo);
             updateParseInfoTo = null;
         }
     }));
 }
Esempio n. 21
0
		public void ParserServiceParseInformationUpdated(object sender, ParseInformationEventArgs e)
		{
			lock (pending) {
				pending.Add(e);
			}
			WorkbenchSingleton.SafeThreadAsyncCall(UpdateThread);
		}
Esempio n. 22
0
		public void ParserServiceParseInformationUpdated(object sender, ParseInformationEventArgs e)
		{
			lock (pending) {
				pending.Add(new ICompilationUnit[] { e.ParseInformation.MostRecentCompilationUnit as ICompilationUnit, e.CompilationUnit});
			}
			WorkbenchSingleton.SafeThreadAsyncCall(UpdateThread);
		}
		private void UpdateClassBrowser(object sender, ParseInformationEventArgs args)
		{
			// This event handler can get called when files other than the current content are updated. eg.
			// when loading a new document. If we didn't do this check the member combo for this tab would have
			// methods for a different class in it!
			
			if (ContentName == args.FileName && !handlingParseEvent) {
				handlingParseEvent = true;
				memberParseInfo = args.ParseInformation;
				GLib.Timeout.Add (1000, new GLib.TimeoutHandler (BindClassCombo));
			}
		}
 void OnParserUpdateStep(object sender, ParseInformationEventArgs e)
 {
     UpdateTick(e);
 }
		void OnParseInformationChanged (object sender, ParseInformationEventArgs e)
		{
			// To prevent some NullReferenceException (possibly when the user switch between editors)
			if (this.ParentEditor == null || this.ParentEditor.DisplayBinding == null || e == null)
				return;
			if (this.ParentEditor.DisplayBinding.ContentName != e.FileName)
				return;
			
			lastCu = e.ParseInformation.MostRecentCompilationUnit;
			UpdateAutocorTimer ();
		}
Esempio n. 26
0
		void SD_ParserService_ParseInformationUpdated(object sender, ParseInformationEventArgs e)
		{
			var parseInfo = e.NewParseInformation as CSharpFullParseInformation;
			ITextSourceVersion currentVersion  = editor.Document.Version;
			if (parseInfo == null)
				return;
			ITextSourceVersion parsedVersion = parseInfo.ParsedVersion;
			if (parsedVersion != null && currentVersion != null && parsedVersion.BelongsToSameDocumentAs(currentVersion)) {
				if (analyzedVersion != null && analyzedVersion.CompareAge(parsedVersion) == 0) {
					// don't analyze the same version twice
					return;
				}
				RunAnalysis(editor.Document.CreateSnapshot(), parseInfo);
			}
		}
Esempio n. 27
0
		void ParserServiceParseInformationUpdated(object sender, ParseInformationEventArgs e)
		{
			if (e.FileName != this.FileName)
				return;
			this.VerifyAccess();
			// When parse information is updated quickly in succession, only do a single update
			// to the latest version.
			updateParseInfoTo = e.NewParseInformation;
			this.Dispatcher.BeginInvoke(
				DispatcherPriority.Background,
				new Action(
					delegate {
						if (updateParseInfoTo != null) {
							ParseInformationUpdated(updateParseInfoTo);
							updateParseInfoTo = null;
						}
					}));
		}
Esempio n. 28
0
			void project_ParseInformationUpdated(object sender, ParseInformationEventArgs e)
			{
				if (testProject != null) {
					testProject.NotifyParseInformationChanged(e.OldUnresolvedFile, e.NewUnresolvedFile);
				}
			}
		void ParseInformationUpdated(object sender, ParseInformationEventArgs e)
		{
			if (SD.ParserService.LoadSolutionProjectsThread.IsRunning)
				return;
			if (!e.FileName.Equals(editor.FileName))
				return;
			currentReferences = null;
			textView.InvalidateLayer(KnownLayer.Selection);

		}
Esempio n. 30
0
        private void ParserService_ParseInformationUpdated(object sender, ParseInformationEventArgs e)
        {
            if (_textEditor == null || !FileUtility.IsEqualFileName(_textEditor.FileName, e.FileName))
            {
                return;
            }

            trvLayout.Items.Clear();

            IVbModuleWrapper wrapper = (IVbModuleWrapper)e.NewUnresolvedFile;

            TreeViewItem root = new TreeViewItem();
            root.Header = GetNodeHeaderWithIcon(wrapper.Module.Name, CompletionImage.Class);

            TreeViewItem fields = new TreeViewItem();
            root.Items.Add(fields);

            TreeViewItem properties = new TreeViewItem();
            root.Items.Add(properties);

            TreeViewItem methods = new TreeViewItem();
            root.Items.Add(methods);

            foreach (IVbMember member in wrapper.Module.Members)
            {
                TreeViewItem memberNode = new TreeViewItem();
                memberNode.Header = member.Name;
                memberNode.Tag = member;
                memberNode.Selected += memberNode_Selected;

                if (member is IVbProperty)
                {
                    properties.Items.Add(memberNode);
                }
                else if (member is IVbMethod)
                {
                    methods.Items.Add(memberNode);
                }
                else if (member is IVbField)
                {
                    fields.Items.Add(memberNode);
                }
            }

            fields.Header = GetNodeHeaderWithIcon(string.Format("Fields ({0})", fields.Items.Count), CompletionImage.Field);
            properties.Header = GetNodeHeaderWithIcon(string.Format("Properties ({0})", properties.Items.Count), CompletionImage.Property);
            methods.Header = GetNodeHeaderWithIcon(string.Format("Methods ({0})", methods.Items.Count), CompletionImage.Method);

            root.ExpandSubtree();

            trvLayout.Items.Add(root);
        }
Esempio n. 31
0
		void ParserServiceParseInformationUpdated(object sender, ParseInformationEventArgs e)
		{
			WorkbenchSingleton.DebugAssertMainThread();
			foreach (TreeNode node in classBrowserTreeView.Nodes) {
				AbstractProjectNode prjNode = node as AbstractProjectNode;
				if (prjNode != null && e.ProjectContent.Project == prjNode.Project) {
					prjNode.UpdateParseInformation(e.OldCompilationUnit, e.NewCompilationUnit);
				}
			}
		}
		void ParserService_ParseInformationUpdated(object sender, ParseInformationEventArgs e)
		{
			if (FileUtility.IsEqualFileName(e.FileName, document.FileName) && invalidLines.Count > 0) {
				cachedLines.Clear();
				foreach (IDocumentLine line in invalidLines) {
					if (!line.IsDeleted) {
						OnHighlightingStateChanged(line.LineNumber, line.LineNumber);
					}
				}
				invalidLines.Clear();
			}
		}
Esempio n. 33
0
 public virtual void OnParseInformationUpdated(ParseInformationEventArgs args)
 {
     throw new NotSupportedException();
 }