本文整理汇总了C#中IVsHierarchy.TryGetItemName方法的典型用法代码示例。如果您正苦于以下问题:C# IVsHierarchy.TryGetItemName方法的具体用法?C# IVsHierarchy.TryGetItemName怎么用?C# IVsHierarchy.TryGetItemName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVsHierarchy
的用法示例。
在下文中一共展示了IVsHierarchy.TryGetItemName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ContainedDocument
public ContainedDocument(
AbstractContainedLanguage containedLanguage,
SourceCodeKind sourceCodeKind,
Workspace workspace,
IVsHierarchy hierarchy,
uint itemId,
IComponentModel componentModel,
IFormattingRule vbHelperFormattingRule)
{
Contract.ThrowIfNull(containedLanguage);
_containedLanguage = containedLanguage;
_sourceCodeKind = sourceCodeKind;
_componentModel = componentModel;
_workspace = workspace;
_optionService = _workspace.Services.GetService<IOptionService>();
_hostType = GetHostType();
string filePath;
if (!ErrorHandler.Succeeded(((IVsProject)hierarchy).GetMkDocument(itemId, out filePath)))
{
// we couldn't look up the document moniker from an hierarchy for an itemid.
// Since we only use this moniker as a key, we could fall back to something else, like the document name.
Debug.Assert(false, "Could not get the document moniker for an item from its hierarchy.");
if (!hierarchy.TryGetItemName(itemId, out filePath))
{
Environment.FailFast("Failed to get document moniker for a contained document");
}
}
if (Project.Hierarchy != null)
{
string moniker;
Project.Hierarchy.GetCanonicalName(itemId, out moniker);
_itemMoniker = moniker;
}
this.Key = new DocumentKey(Project, filePath);
this.Id = DocumentId.CreateNewId(Project.Id, filePath);
this.Folders = containedLanguage.Project.GetFolderNames(itemId);
this.Loader = TextLoader.From(containedLanguage.SubjectBuffer.AsTextContainer(), VersionStamp.Create(), filePath);
_differenceSelectorService = componentModel.GetService<ITextDifferencingSelectorService>();
_snapshotTracker = new ReiteratedVersionSnapshotTracker(_containedLanguage.SubjectBuffer);
_vbHelperFormattingRule = vbHelperFormattingRule;
}