当前位置: 首页>>代码示例>>C#>>正文


C# Components.PathEntry类代码示例

本文整理汇总了C#中MonoDevelop.Components.PathEntry的典型用法代码示例。如果您正苦于以下问题:C# PathEntry类的具体用法?C# PathEntry怎么用?C# PathEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PathEntry类属于MonoDevelop.Components命名空间,在下文中一共展示了PathEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BreadcrumbEntryElement

		public BreadcrumbEntryElement (PathEntry path)
		{
			InternalPadding = 5;
			Path = path;
			Build ();
			Opacity = 0.5;
		}
开发者ID:jassmith,项目名称:Xamarin.Canvas,代码行数:7,代码来源:SearchBoxCanvasElement.cs

示例2: Initialize

		public override void Initialize ()
		{
			CurrentPath = new PathEntry[] { new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = null } };
			isPathSet = false;
			UpdatePath (null, null);
			Document.Editor.Caret.PositionChanged += UpdatePath;
			var ext = Document.GetContent<CSharpCompletionTextEditorExtension> ();
			ext.TypeSegmentTreeUpdated += (o, s) => UpdatePath (null, null);
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:9,代码来源:PathedDocumentTextEditorExtension.cs

示例3: Initialize

		public override void Initialize ()
		{
			CurrentPath = new PathEntry[] { new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = null } };
			isPathSet = false;
			UpdateOwnerProjects ();
			UpdatePath (null, null);
			caret = Document.Editor.Caret;
			caret.PositionChanged += UpdatePath;
			ext = Document.GetContent<CSharpCompletionTextEditorExtension> ();
			ext.TypeSegmentTreeUpdated += HandleTypeSegmentTreeUpdated;
			IdeApp.Workspace.FileAddedToProject += HandleProjectChanged;
			IdeApp.Workspace.FileRemovedFromProject += HandleProjectChanged;
		}
开发者ID:jiailiuyan,项目名称:monodevelop,代码行数:13,代码来源:PathedDocumentTextEditorExtension.cs

示例4: Initialize

		public override void Initialize ()
		{
			CurrentPath = new PathEntry[] { new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = null } };
			isPathSet = false;
			// Delay the execution of UpdateOwnerProjects since it may end calling Document.AttachToProject,
			// which shouldn't be called while the extension chain is being initialized.
			Gtk.Application.Invoke (delegate {
				UpdateOwnerProjects ();
				UpdatePath (null, null);
			});
			caret = Document.Editor.Caret;
			caret.PositionChanged += UpdatePath;
			ext = Document.GetContent<CSharpCompletionTextEditorExtension> ();
			ext.TypeSegmentTreeUpdated += HandleTypeSegmentTreeUpdated;
			IdeApp.Workspace.FileAddedToProject += HandleProjectChanged;
			IdeApp.Workspace.FileRemovedFromProject += HandleProjectChanged;
			IdeApp.Workspace.WorkspaceItemUnloaded += HandleWorkspaceItemUnloaded;
			IdeApp.Workspace.WorkspaceItemLoaded += HandleWorkspaceItemLoaded;;
		}
开发者ID:brantwedel,项目名称:monodevelop,代码行数:19,代码来源:PathedDocumentTextEditorExtension.cs

示例5: GetRegionEntry

		static PathEntry GetRegionEntry (ParsedDocument unit, Mono.TextEditor.DocumentLocation loc)
		{
			PathEntry entry;
			if (!unit.UserRegions.Any ())
				return null;
			var reg = unit.UserRegions.Where (r => r.Region.IsInside (loc)).LastOrDefault ();
			if (reg == null) {
				entry = new PathEntry (GettextCatalog.GetString ("No region"));
			} else {
				entry = new PathEntry (CompilationUnitDataProvider.Pixbuf,
						                       GLib.Markup.EscapeText (reg.Name));
			}
			entry.Position = EntryPosition.Right;
			return entry;
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:15,代码来源:PathedDocumentTextEditorExtension.cs

示例6: OnPathChanged

		protected void OnPathChanged (PathEntry[] oldPath)
		{
			if (PathChanged != null)
				PathChanged (this, new DocumentPathChangedEventArgs (oldPath));
		}
开发者ID:gAdrev,项目名称:monodevelop,代码行数:5,代码来源:BaseXmlEditorExtension.cs

示例7: UpdatePath

		void UpdatePath (object sender, Mono.TextEditor.DocumentLocationEventArgs e)
		{
			var unit = Document.CompilationUnit;
			if (unit == null)
				return;
			
			var loc = textEditorData.Caret.Location;
			IType type = unit.GetTypeAt (loc.Line, loc.Column);
			IMember member = type != null && type.ClassType != ClassType.Delegate ? type.GetMemberAt (loc.Line, loc.Column) : null;
			
			List<PathEntry> result = new List<PathEntry> ();
			var amb = GetAmbience ();
			INode node = member ?? type ?? (INode)unit;
			while (node != null) {
				PathEntry entry;
				if (node is ICompilationUnit) {
					if (!Document.ParsedDocument.UserRegions.Any ())
						break;
					FoldingRegion reg = Document.ParsedDocument.UserRegions.Where (r => r.Region.Contains (loc.Line, loc.Column)).LastOrDefault ();
					if (reg == null) {
						entry = new PathEntry (GettextCatalog.GetString ("No region"));
					} else {
						entry = new PathEntry (CompilationUnitDataProvider.Pixbuf,
						                       reg.Name);
					}
					entry.Position = EntryPosition.Right;
				} else {
					entry = new PathEntry (ImageService.GetPixbuf (((IMember)node).StockIcon, IconSize.Menu), amb.GetString ((IMember)node, OutputFlags.IncludeGenerics | OutputFlags.IncludeParameters | OutputFlags.ReformatDelegates));
				}
				entry.Tag = node;
				result.Insert (0, entry);
				node = node.Parent;
			}
			PathEntry noSelection = null;
			if (type == null) {
				noSelection = new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = new CustomNode (Document.CompilationUnit) };
			} else if (member == null && type.ClassType != ClassType.Delegate) 
				noSelection = new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = new CustomNode (type) };
			if (noSelection != null) {
/*				if (result.Count > 0 && result[result.Count - 1].Tag is ICompilationUnit) {
					result.Insert (result.Count - 1, noSelection);
				} else {*/
					result.Add (noSelection);
//				}
			}
			var prev = CurrentPath;
			CurrentPath = result.ToArray ();
			OnPathChanged (new DocumentPathChangedEventArgs (prev));
		}
开发者ID:famousthom,项目名称:monodevelop,代码行数:49,代码来源:CSharpTextEditorCompletion.cs

示例8: CreateWidthArray

		void CreateWidthArray (int[] result, int index, PathEntry[] path)
		{
			// Assume that there will be icons of at least 16 pixels. This avoids
			// annoying path bar height changes when switching between empty and full paths
			int maxIconHeight = 16;

			for (int i = 0; i < path.Length; i++) {
				layout.Attributes = (i == activeIndex)? boldAtts : null;
				layout.SetMarkup (GetFirstLineFromMarkup (path[i].Markup));
				layout.Width = -1;
				int w, h;
				layout.GetPixelSize (out w, out h);
				textHeight = Math.Max (h, textHeight);
				if (path[i].DarkIcon != null) {
					maxIconHeight = Math.Max ((int)path[i].DarkIcon.Height, maxIconHeight);
					w += (int)path[i].DarkIcon.Width + iconSpacing;
				}
				result[i + index] = w;
			}
			height = Math.Max (height, maxIconHeight);
			height = Math.Max (height, textHeight);
		}
开发者ID:msiyer,项目名称:Pinta,代码行数:22,代码来源:PathBar.cs

示例9: IndexOf

		public int IndexOf (PathEntry entry)
		{
			return Path.TakeWhile (p => p != entry).Count ();
		}
开发者ID:msiyer,项目名称:Pinta,代码行数:4,代码来源:PathBar.cs

示例10: ArrSame

		bool ArrSame (PathEntry[] a, PathEntry[] b)
		{
			if ((a == null || b == null) && a != b)
				return false;
			if (a.Length != b.Length)
				return false;
			for (int i = 0; i < a.Length; i++)
				if (!a[i].Equals(b[i]))
					return false;
			return true;
		}
开发者ID:msiyer,项目名称:Pinta,代码行数:11,代码来源:PathBar.cs

示例11: CreateWidthArray

		int[] CreateWidthArray (PathEntry[] path)
		{
			var result = new int[path.Length];
			for (int i = 0; i < path.Length; i++) {
				layout.Attributes = (i == activeIndex)? boldAtts : null;
				layout.SetText (path[i].Text);
				int w, h;
				layout.GetPixelSize (out w, out h);
				height = Math.Max (h, height);
				result[i] = w + (path[i].Icon != null ? path[i].Icon.Width + padding : 0);
			}
			return result;
		}
开发者ID:Tak,项目名称:monodevelop-novell,代码行数:13,代码来源:PathBar.cs

示例12: DocumentPathChangedEventArgs

		public DocumentPathChangedEventArgs (PathEntry[] previousPath)
		{
			this.PreviousPath = previousPath;
		}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:4,代码来源:IPathedDocument.cs

示例13: UpdatePath

		void UpdatePath (object sender, Mono.TextEditor.DocumentLocationEventArgs e)
		{
			var parsedDocument = Document.ParsedDocument;
			if (parsedDocument == null || parsedDocument.ParsedFile == null)
				return;
			amb = new AstAmbience (document.GetFormattingOptions ());
			
			var unit = parsedDocument.GetAst<SyntaxTree> ();
			if (unit == null)
				return;

			var loc = Document.Editor.Caret.Location;
			var compExt = Document.GetContent<CSharpCompletionTextEditorExtension> ();
			var caretOffset = Document.Editor.Caret.Offset;
			var segType = compExt.GetTypeAt (caretOffset);
			if (segType != null)
				loc = segType.Region.Begin;

			var curType = (EntityDeclaration)unit.GetNodeAt (loc, n => n is TypeDeclaration || n is DelegateDeclaration);

			var curProject = ownerProjects.Count > 1 ? Document.Project : null;

			var segMember = compExt.GetMemberAt (caretOffset);
			if (segMember != null) {
				loc = segMember.Region.Begin;
			} else {
				loc = Document.Editor.Caret.Location;
			}

			var curMember = unit.GetNodeAt<EntityDeclaration> (loc);
			if (curType == curMember || curType is DelegateDeclaration)
				curMember = null;
			if (isPathSet && curType == lastType && curMember == lastMember && curProject == lastProject)
				return;

			var curTypeMakeup = GetEntityMarkup (curType);
			var curMemberMarkup = GetEntityMarkup (curMember);
			if (isPathSet && curType != null && lastType != null && curType.StartLocation == lastType.StartLocation && curTypeMakeup == lastTypeMarkup &&
				curMember != null && lastMember != null && curMember.StartLocation == lastMember.StartLocation && curMemberMarkup == lastMemberMarkup && curProject == lastProject)
				return;

			lastType = curType;
			lastTypeMarkup = curTypeMakeup;

			lastMember = curMember;
			lastMemberMarkup = curMemberMarkup;

			lastProject = curProject;

			var result = new List<PathEntry> ();

			if (ownerProjects.Count > 1) {
				// Current project if there is more than one
				result.Add (new PathEntry (ImageService.GetIcon (Document.Project.StockIcon), GLib.Markup.EscapeText (Document.Project.Name)) { Tag = Document.Project });
			}

			if (curType == null) {
				if (CurrentPath != null && CurrentPath.Length == 1 && CurrentPath [0].Tag is IUnresolvedFile)
					return;
				if (CurrentPath != null && CurrentPath.Length == 2 && CurrentPath [1].Tag is IUnresolvedFile)
					return;
				var prevPath = CurrentPath;
				result.Add (new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = unit });
				CurrentPath = result.ToArray ();
				OnPathChanged (new DocumentPathChangedEventArgs (prevPath));	
				return;
			}

			if (curType != null) {
				var type = curType;
				var pos = result.Count;
				while (type != null) {
					var declaringType = type.Parent as TypeDeclaration;
					result.Insert (pos, new PathEntry (ImageService.GetIcon (type.GetStockIcon (), Gtk.IconSize.Menu), GetEntityMarkup (type)) { Tag = (AstNode)declaringType ?? unit });
					type = declaringType;
				}
			}
				
			if (curMember != null) {
				result.Add (new PathEntry (ImageService.GetIcon (curMember.GetStockIcon (), Gtk.IconSize.Menu), curMemberMarkup) { Tag = curMember });
				if (curMember is Accessor) {
					var parent = curMember.Parent as EntityDeclaration;
					if (parent != null)
						result.Insert (result.Count - 1, new PathEntry (ImageService.GetIcon (parent.GetStockIcon (), Gtk.IconSize.Menu), GetEntityMarkup (parent)) { Tag = parent });
				}
			}
				
			var entry = GetRegionEntry (parsedDocument, loc);
			if (entry != null)
				result.Add (entry);
				
			PathEntry noSelection = null;
			if (curType == null) {
				noSelection = new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = unit };
			} else if (curMember == null && !(curType is DelegateDeclaration)) { 
				noSelection = new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = curType };
			}

			if (noSelection != null)
				result.Add (noSelection);
//.........这里部分代码省略.........
开发者ID:jiailiuyan,项目名称:monodevelop,代码行数:101,代码来源:PathedDocumentTextEditorExtension.cs

示例14: Initialize

		protected override void Initialize ()
		{
			CurrentPath = new PathEntry[] { new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = null } };
			isPathSet = false;
			// Delay the execution of UpdateOwnerProjects since it may end calling DocumentContext.AttachToProject,
			// which shouldn't be called while the extension chain is being initialized.
			Gtk.Application.Invoke (delegate {
				UpdateOwnerProjects ();
				Editor_CaretPositionChanged (null, null);
			});

			Editor.TextChanging += Editor_TextChanging;
			DocumentContext.DocumentParsed += DocumentContext_DocumentParsed; 
			ext = DocumentContext.GetContent<CSharpCompletionTextEditorExtension> ();
			ext.TypeSegmentTreeUpdated += HandleTypeSegmentTreeUpdated;

			IdeApp.Workspace.FileAddedToProject += HandleProjectChanged;
			IdeApp.Workspace.FileRemovedFromProject += HandleProjectChanged;
			IdeApp.Workspace.WorkspaceItemUnloaded += HandleWorkspaceItemUnloaded;
			IdeApp.Workspace.WorkspaceItemLoaded += HandleWorkspaceItemLoaded;
			IdeApp.Workspace.ItemAddedToSolution += HandleProjectChanged;
			IdeApp.Workspace.ActiveConfigurationChanged += HandleActiveConfigurationChanged;
			SubscribeCaretPositionChange ();
		}
开发者ID:ZZHGit,项目名称:monodevelop,代码行数:24,代码来源:PathedDocumentTextEditorExtension.cs

示例15: Update

		void Update()
		{
			if (DocumentContext == null)
				return;
			var parsedDocument = DocumentContext.ParsedDocument;
			if (parsedDocument == null)
				return;
			var caretOffset = Editor.CaretOffset;
			var model = parsedDocument.GetAst<SemanticModel>();
			if (model == null)
				return;
			CancelUpdatePath ();
			var cancellationToken = src.Token;
			amb = new AstAmbience(TypeSystemService.Workspace.Options);
			var loc = Editor.CaretLocation;
			Task.Run(async delegate {
				var unit = model.SyntaxTree;
				SyntaxNode root;
				SyntaxNode node;
				try {
					root = await unit.GetRootAsync(cancellationToken).ConfigureAwait(false);
					if (root.FullSpan.Length <= caretOffset) {
						return;
					}
					node = root.FindNode(TextSpan.FromBounds(caretOffset, caretOffset));
					if (node.SpanStart != caretOffset)
						node = root.SyntaxTree.FindTokenOnLeftOfPosition(caretOffset, cancellationToken).Parent;
				} catch (Exception ex ) {
					Console.WriteLine (ex);
					return;
				}

				var curMember = node != null ? node.AncestorsAndSelf ().FirstOrDefault (m => m is VariableDeclaratorSyntax && m.Parent != null && !(m.Parent.Parent is LocalDeclarationStatementSyntax) || (m is MemberDeclarationSyntax && !(m is NamespaceDeclarationSyntax))) : null;
				var curType = node != null ? node.AncestorsAndSelf ().FirstOrDefault (IsType) : null;

				var curProject = ownerProjects != null && ownerProjects.Count > 1 ? DocumentContext.Project : null;

				if (curType == curMember || curType is DelegateDeclarationSyntax)
					curMember = null;
				if (isPathSet && curType == lastType && curMember == lastMember && curProject == lastProject) {
					return;
				}
				var curTypeMakeup = GetEntityMarkup(curType);
				var curMemberMarkup = GetEntityMarkup(curMember);
				if (isPathSet && curType != null && lastType != null && curTypeMakeup == lastTypeMarkup &&
					curMember != null && lastMember != null && curMemberMarkup == lastMemberMarkup && curProject == lastProject) {
					return;
				}


				var result = new List<PathEntry>();

				if (ownerProjects != null && ownerProjects.Count > 1) {
					// Current project if there is more than one
					result.Add (new PathEntry (ImageService.GetIcon (DocumentContext.Project.StockIcon, Gtk.IconSize.Menu), GLib.Markup.EscapeText (DocumentContext.Project.Name)) { Tag = DocumentContext.Project });
				}
				if (curType == null) {
					if (CurrentPath != null && CurrentPath.Length == 1 && CurrentPath [0].Tag is CSharpSyntaxTree)
						return;
					if (CurrentPath != null && CurrentPath.Length == 2 && CurrentPath [1].Tag is CSharpSyntaxTree)
						return;
					var prevPath = CurrentPath;
					result.Add (new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = unit });
					Gtk.Application.Invoke (delegate {
						if (cancellationToken.IsCancellationRequested)
							return;

						CurrentPath = result.ToArray ();
						lastType = curType;
						lastTypeMarkup = curTypeMakeup;

						lastMember = curMember;
						lastMemberMarkup = curMemberMarkup;

						lastProject = curProject;
						OnPathChanged (new DocumentPathChangedEventArgs (prevPath));
					});
					return;
				}
				var regionEntry = await GetRegionEntry (DocumentContext.ParsedDocument, loc).ConfigureAwait (false);

				Gtk.Application.Invoke(delegate {
					if (curType != null) {
						var type = curType;
						var pos = result.Count;
						while (type != null) {
							if (!(type is BaseTypeDeclarationSyntax))
								break;
							var tag = (object)type.Ancestors ().FirstOrDefault (IsType) ?? unit;
							result.Insert (pos, new PathEntry (ImageService.GetIcon (type.GetStockIcon (), Gtk.IconSize.Menu), GetEntityMarkup (type)) { Tag = tag });
							type = type.Parent;
						}
					}
					if (curMember != null) {
						result.Add (new PathEntry (ImageService.GetIcon (curMember.GetStockIcon (), Gtk.IconSize.Menu), curMemberMarkup) { Tag = curMember });
						if (curMember.Kind () == SyntaxKind.GetAccessorDeclaration ||
						curMember.Kind () == SyntaxKind.SetAccessorDeclaration ||
						curMember.Kind () == SyntaxKind.AddAccessorDeclaration ||
						curMember.Kind () == SyntaxKind.RemoveAccessorDeclaration) {
							var parent = curMember.Parent;
//.........这里部分代码省略.........
开发者ID:ZZHGit,项目名称:monodevelop,代码行数:101,代码来源:PathedDocumentTextEditorExtension.cs


注:本文中的MonoDevelop.Components.PathEntry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。