本文整理汇总了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;
}
示例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();
}
示例3: GetAddinData
public AddinData GetAddinData (ITreeNavigator nav)
{
DotNetProject p = (DotNetProject) nav.GetParentDataItem (typeof(DotNetProject), true);
if (p == null)
return null;
return p.GetAddinData ();
}
示例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;
}
示例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;
}
}
}
}
}
示例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 ();
}
示例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 ();
}
示例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;
}
示例9: GetMainAssembly
protected IUnresolvedAssembly GetMainAssembly (ITreeNavigator treeBuilder)
{
var loader = (AssemblyLoader)treeBuilder.GetParentDataItem (typeof(AssemblyLoader), true);
if (loader != null)
return loader.UnresolvedAssembly;
return null;
}
示例10: IsFromAssembly
protected static bool IsFromAssembly (ITreeNavigator treeBuilder)
{
return treeBuilder.GetParentDataItem (typeof(AssemblyLoader), true) != null;
}
示例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;
}
示例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);
}
示例13: GetCecilLoader
internal CecilLoader GetCecilLoader (ITreeNavigator navigator)
{
return navigator.GetParentDataItem<AssemblyLoader> (false).CecilLoader;
}