本文整理汇总了C#中ITreeBuilder.HasChild方法的典型用法代码示例。如果您正苦于以下问题:C# ITreeBuilder.HasChild方法的具体用法?C# ITreeBuilder.HasChild怎么用?C# ITreeBuilder.HasChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITreeBuilder
的用法示例。
在下文中一共展示了ITreeBuilder.HasChild方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildChildNodes
public override void BuildChildNodes(ITreeBuilder builder, object dataObject)
{
string path = GetFolderPath (dataObject);
if (builder.Options ["ShowAllFiles"] && Directory.Exists (path))
{
Project project = (Project) builder.GetParentDataItem (typeof(Project), true);
foreach (string file in Directory.GetFiles (path)) {
if (project.ProjectFiles.GetFile (file) == null)
builder.AddChild (new SystemFile (file, project));
}
foreach (string folder in Directory.GetDirectories (path))
if (!builder.HasChild (Path.GetFileName (folder), typeof(ProjectFolder)))
builder.AddChild (new ProjectFolder (folder, project));
}
}
示例2: AddProjectContent
void AddProjectContent (ITreeBuilder builder, Project p)
{
foreach (var ns in namesp.ChildNamespaces) {
if (!builder.HasChild (ns.Name, typeof(NamespaceData)))
builder.AddChild (new ProjectNamespaceData (project, ns));
}
bool nestedNs = builder.Options ["NestedNamespaces"];
bool publicOnly = builder.Options ["PublicApiOnly"];
foreach (var type in namesp.Types) {
if (!publicOnly || type.IsPublic)
builder.AddChild (new ClassData (project, type));
}
}
示例3: FillNamespaces
public static void FillNamespaces (ITreeBuilder builder, Project project, INamespace ns)
{
var members = ns.Types;
//IParserContext ctx = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (project);
if (members.Any ()) {
if (builder.Options ["ShowProjects"])
builder.AddChild (new ProjectNamespaceData (project, ns));
else {
if (!builder.HasChild (ns.Name, typeof (NamespaceData)))
builder.AddChild (new ProjectNamespaceData (null, ns));
}
}
foreach (var nSpace in ns.ChildNamespaces) {
FillNamespaces (builder, project, nSpace);
}
}
示例4: BuildChildNodes
public override void BuildChildNodes (ITreeBuilder builder, object dataObject)
{
if (!builder.Options ["ShowAllFiles"])
return;
string path = GetFolderPath (dataObject);
if (Directory.Exists (path))
{
Project project = (Project) builder.GetParentDataItem (typeof(Project), true);
SolutionFolderFileCollection folderFiles = null;
if (dataObject is Solution)
folderFiles = ((Solution)dataObject).RootFolder.Files;
else if (dataObject is SolutionFolder)
folderFiles = ((SolutionFolder)dataObject).Files;
builder.AddChildren (Directory.EnumerateFiles (path)
.Where (file => (project == null || project.Files.GetFile (file) == null) && (folderFiles == null || !folderFiles.Contains (file)))
.Select (file => new SystemFile (file, project)));
builder.AddChildren (Directory.EnumerateDirectories (path)
.Where (folder => !builder.HasChild (Path.GetFileName (folder), typeof (ProjectFolder)))
.Select (folder => new ProjectFolder (folder, project)));
}
}
示例5: FillNamespaces
public static void FillNamespaces (ITreeBuilder builder, Project project, string ns)
{
ProjectDom dom = ProjectDomService.GetProjectDom (project);
List<IMember> members = dom.GetNamespaceContents (ns, false, false);
//IParserContext ctx = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (project);
if (members.Count > 0) {
if (builder.Options ["ShowProjects"])
builder.AddChild (new ProjectNamespaceData (project, ns));
else {
if (!builder.HasChild (ns, typeof (NamespaceData)))
builder.AddChild (new ProjectNamespaceData (null, ns));
}
}
foreach (IMember ob in members) {
if (ob is Namespace) {
FillNamespaces (builder, project, ns + "." + ((Namespace)ob).Name);
}
}
}
示例6: BuildChildNodes
public override void BuildChildNodes (ITreeBuilder builder, object dataObject)
{
string path = GetFolderPath (dataObject);
if (builder.Options ["ShowAllFiles"] && Directory.Exists (path))
{
Project project = (Project) builder.GetParentDataItem (typeof(Project), true);
SolutionFolderFileCollection folderFiles = null;
if (dataObject is Solution)
folderFiles = ((Solution)dataObject).RootFolder.Files;
else if (dataObject is SolutionFolder)
folderFiles = ((SolutionFolder)dataObject).Files;
foreach (string file in Directory.GetFiles (path)) {
if ((project == null || project.Files.GetFile (file) == null) && (folderFiles == null || !folderFiles.Contains (file)))
builder.AddChild (new SystemFile (file, project));
}
foreach (string folder in Directory.GetDirectories (path))
if (!builder.HasChild (Path.GetFileName (folder), typeof(ProjectFolder)))
builder.AddChild (new ProjectFolder (folder, project));
}
}
示例7: AddProjectContent
void AddProjectContent (ITreeBuilder builder, Project p)
{
builder.AddChildren (namesp.GetNamespaceMembers ()
.Where (ns => !builder.HasChild (ns.Name, typeof (NamespaceData)))
.Select (ns => new ProjectNamespaceData (project, ns)));
// bool nestedNs = builder.Options ["NestedNamespaces"];
bool publicOnly = builder.Options ["PublicApiOnly"];
builder.AddChildren (namesp.GetAllTypes ()
.Where (type => !publicOnly || type.DeclaredAccessibility == Accessibility.Public)
.Select (type => new ClassData (project, type)));
}
示例8: AddProjectContent
void AddProjectContent(ITreeBuilder builder, Project project, NamespaceData nsData, ArrayList list)
{
bool nestedNs = builder.Options ["NestedNamespaces"];
bool publicOnly = builder.Options ["PublicApiOnly"];
foreach (object ob in list) {
if (ob is string && nestedNs) {
string ns = nsData.FullName + "." + ob;
if (!builder.HasChild (ob as string, typeof(NamespaceData)))
builder.AddChild (new NamespaceData (project, ns));
}
else if (ob is IClass) {
if (!publicOnly || ((IClass)ob).IsPublic)
builder.AddChild (new ClassData (project, ob as IClass));
}
}
}
示例9: FillNamespaces
public static void FillNamespaces(ITreeBuilder builder, Project project, string ns)
{
IParserContext ctx = Runtime.ProjectService.ParserDatabase.GetProjectParserContext (project);
if (ctx.GetClassList (ns, false, true).Length > 0) {
if (builder.Options ["ShowProjects"])
builder.AddChild (new NamespaceData (project, ns));
else {
if (!builder.HasChild (ns, typeof (NamespaceData)))
builder.AddChild (new NamespaceData (null, ns));
}
}
string[] list = ctx.GetNamespaceList (ns, false, true);
foreach (string subns in list)
FillNamespaces (builder, project, ns + "." + subns);
}
示例10: AddProjectContent
void AddProjectContent (ITreeBuilder builder, List<IMember> list)
{
bool nestedNs = builder.Options ["NestedNamespaces"];
bool publicOnly = builder.Options ["PublicApiOnly"];
foreach (IMember ob in list) {
if (ob is Namespace && nestedNs) {
Namespace nsob = (Namespace)ob;
string ns = FullName + "." + nsob.Name;
if (!builder.HasChild (nsob.Name, typeof(NamespaceData)))
builder.AddChild (new ProjectNamespaceData (project, ns));
}
else if (ob is IType) {
if (!publicOnly || ((IType)ob).IsPublic)
builder.AddChild (new ClassData (project, ob as IType));
}
}
}
示例11: AddProjectContent
void AddProjectContent (ITreeBuilder builder, Project p)
{
foreach (var ns in namesp.GetNamespaceMembers ()) {
if (!builder.HasChild (ns.Name, typeof (NamespaceData)))
builder.AddChild (new ProjectNamespaceData (project, ns));
}
// bool nestedNs = builder.Options ["NestedNamespaces"];
bool publicOnly = builder.Options ["PublicApiOnly"];
foreach (var type in namesp.GetAllTypes ()) {
if (!publicOnly || type.DeclaredAccessibility == Accessibility.Public)
builder.AddChild (new ClassData (project, type));
}
}