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


C# ITreeNavigator.GetParentDataItem方法代码示例

本文整理汇总了C#中ITreeNavigator.GetParentDataItem方法的典型用法代码示例。如果您正苦于以下问题:C# ITreeNavigator.GetParentDataItem方法的具体用法?C# ITreeNavigator.GetParentDataItem怎么用?C# ITreeNavigator.GetParentDataItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITreeNavigator的用法示例。


在下文中一共展示了ITreeNavigator.GetParentDataItem方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetRegistry

		public AddinRegistry GetRegistry (ITreeNavigator nav)
		{
			Solution sol = (Solution) nav.GetParentDataItem (typeof(Solution), true);
			if (sol != null)
				return sol.GetAddinData ().Registry;
			RegistryInfo reg = (RegistryInfo) nav.GetParentDataItem (typeof(RegistryInfo), true);
			if (reg != null)
				return reg.CachedRegistry;
			return null;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:10,代码来源:ExtensionModelTypeNodeBuilder.cs

示例2: MoveCopyFile

        public static void MoveCopyFile(Project project, ITreeNavigator nav, string filename, bool move, bool alreadyInPlace)
        {
            if (Runtime.FileUtilityService.IsDirectory (filename))
                return;

            ProjectFolder folder = nav.GetParentDataItem (typeof(ProjectFolder), true) as ProjectFolder;

            string name = System.IO.Path.GetFileName (filename);
            string baseDirectory = folder != null ? folder.Path : project.BaseDirectory;
            string newfilename = alreadyInPlace ? filename : Path.Combine (baseDirectory, name);

            if (filename != newfilename) {
                if (File.Exists (newfilename)) {
                    if (!Runtime.MessageService.AskQuestion (string.Format (GettextCatalog.GetString ("The file '{0}' already exists. Do you want to replace it?"), newfilename), "MonoDevelop"))
                        return;
                }
                File.Copy (filename, newfilename, true);
                if (move)
                    Runtime.FileService.RemoveFile (filename);
            }

            if (project.IsCompileable (newfilename)) {
                project.AddFile (newfilename, BuildAction.Compile);
            } else {
                project.AddFile (newfilename, BuildAction.Nothing);
            }

            Runtime.ProjectService.SaveCombine();
        }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:29,代码来源:FolderNodeBuilder.cs

示例3: GetAddinData

		public AddinData GetAddinData (ITreeNavigator nav)
		{
			DotNetProject p = (DotNetProject) nav.GetParentDataItem (typeof(DotNetProject), true);
			if (p == null)
				return null;
			return p.GetAddinData ();
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:7,代码来源:ExtensionModelTypeNodeBuilder.cs

示例4: GetCachedModelData

		public CachedModelData GetCachedModelData (ITreeNavigator nav)
		{
			Project p = (Project) nav.GetParentDataItem (typeof(Project), true);
			if (p == null)
				return new CachedModelData ();
			CachedModelData data = (CachedModelData) p.ExtendedProperties [typeof(CachedModelData)];
			if (data == null) {
				data = new CachedModelData ();
				p.ExtendedProperties [typeof(CachedModelData)] = data;
			}
			return data;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:12,代码来源:ExtensionModelTypeNodeBuilder.cs

示例5: GetNodeAttributes

		public override void GetNodeAttributes (ITreeNavigator parentNode, object dataObject, ref NodeAttributes attributes)
		{
			base.GetNodeAttributes (parentNode, dataObject, ref attributes);
			if (dataObject is ProjectFile) {
				string fname = ((ProjectFile)dataObject).Name;
				if (fname.EndsWith (".addin.xml", StringComparison.Ordinal) || fname.EndsWith (".addin", StringComparison.Ordinal)) {
					if (!(parentNode.DataItem is AddinData)) {
						DotNetProject dp = (DotNetProject) parentNode.GetParentDataItem (typeof(DotNetProject), true);
						if (dp != null && dp.GetAddinData () != null) {
							// Hide the manifest
							attributes |= NodeAttributes.Hidden;
						}
					}
				}
			}
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:16,代码来源:ProjectFolderNodeBuilderExtension.cs

示例6: PrintDeclaringType

		internal static void PrintDeclaringType (StringBuilder result, ITreeNavigator navigator)
		{
			var type = (IType)navigator.GetParentDataItem (typeof (IType), false);
			if (type == null)
				return;
			
			result.Append (String.Format (GettextCatalog.GetString ("<b>Declaring Type:</b>\t{0}"), type.FullName));
			result.AppendLine ();
		}
开发者ID:rajeshpillai,项目名称:monodevelop,代码行数:9,代码来源:DomMethodNodeBuilder.cs

示例7: PrintAssembly

		internal static void PrintAssembly (StringBuilder result, ITreeNavigator navigator)
		{
			AssemblyDefinition assemblyDefinition = (AssemblyDefinition)navigator.GetParentDataItem (typeof (AssemblyDefinition), false);
			if (assemblyDefinition == null)
				return;
			
			result.Append (String.Format (GettextCatalog.GetString ("<b>Assembly:</b>\t{0}, Version={1}"),
			                              assemblyDefinition.Name.Name,
			                              assemblyDefinition.Name.Version));
			result.AppendLine ();
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:11,代码来源:DomTypeNodeBuilder.cs

示例8: GetProject

        static Project GetProject(ITreeNavigator node)
        {
            Project project = null;

            if (node.DataItem is Project)
                project = (Project) node.DataItem;
            else if (node.DataItem is ProjectFolder)
                project = ((ProjectFolder) node.DataItem).Project;
            else if (node.DataItem is ProjectFile)
                project = ((ProjectFile) node.DataItem).Project;
            else if (node.DataItem is NamespaceData)
                project = (Project) node.GetParentDataItem (typeof (Project), false);
            else if (node.DataItem is ClassData)
                project = (Project) node.GetParentDataItem (typeof (Project), false);

            return project;
        }
开发者ID:erbriones,项目名称:monodevelop-classdesigner,代码行数:17,代码来源:GenericNodeCommandHandler.cs

示例9: GetMainAssembly

		protected IUnresolvedAssembly GetMainAssembly (ITreeNavigator treeBuilder)
		{
			var loader = (AssemblyLoader)treeBuilder.GetParentDataItem (typeof(AssemblyLoader), true);
			if (loader != null)
				return loader.UnresolvedAssembly;
			return null;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:7,代码来源:AssemblyBrowserTypeNodeBuilder.cs

示例10: IsFromAssembly

		protected static bool IsFromAssembly (ITreeNavigator treeBuilder)
		{
			return treeBuilder.GetParentDataItem (typeof(AssemblyLoader), true) != null;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:4,代码来源:AssemblyBrowserTypeNodeBuilder.cs

示例11: GetContext

		protected ITypeResolveContext GetContext (ITreeNavigator treeBuilder)
		{
			var mainAssembly = GetMainAssembly (treeBuilder);
			if (mainAssembly != null) {
				var simpleCompilation = new SimpleCompilation (mainAssembly);
				return new SimpleTypeResolveContext (simpleCompilation.MainAssembly);
			}
			var project = (Project)treeBuilder.GetParentDataItem (typeof(Project), true);
			var ctx = TypeSystemService.GetCompilation (project);
			return ctx.TypeResolveContext;
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:11,代码来源:AssemblyBrowserTypeNodeBuilder.cs

示例12: Resolve

		protected IType Resolve (ITreeNavigator treeBuilder, IUnresolvedTypeDefinition type)
		{
			var mainAssembly = GetMainAssembly (treeBuilder);
			if (mainAssembly != null) {
				var simpleCompilation = new SimpleCompilation (mainAssembly);
				return type.Resolve (new SimpleTypeResolveContext (simpleCompilation.MainAssembly));
			}
			var project = (Project)treeBuilder.GetParentDataItem (typeof(Project), true);
			var ctx = TypeSystemService.GetCompilation (project);
			return ctx.MainAssembly.GetTypeDefinition (type.Namespace, type.Name, type.TypeParameters.Count);
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:11,代码来源:AssemblyBrowserTypeNodeBuilder.cs

示例13: GetCecilLoader

		internal CecilLoader GetCecilLoader (ITreeNavigator navigator)
		{
			return navigator.GetParentDataItem<AssemblyLoader> (false).CecilLoader;
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:4,代码来源:AssemblyBrowserTypeNodeBuilder.cs


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