本文整理汇总了C#中ITreeBuilder类的典型用法代码示例。如果您正苦于以下问题:C# ITreeBuilder类的具体用法?C# ITreeBuilder怎么用?C# ITreeBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITreeBuilder类属于命名空间,在下文中一共展示了ITreeBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildNode
public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
{
SolutionFolder combine = dataObject as SolutionFolder;
label = GLib.Markup.EscapeText (combine.Name);
icon = Context.GetIcon (Stock.SolutionFolderOpen);
closedIcon = Context.GetIcon (Stock.SolutionFolderClosed);
}
示例2: BuildChildNodes
public override void BuildChildNodes(ITreeBuilder treeBuilder, object dataObject)
{
var node = (DependencyNode)dataObject;
foreach (DependencyNode childNode in node.GetDependencies ()) {
treeBuilder.AddChild (childNode);
}
}
示例3: BuildNode
public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
{
ProjectReference pref = (ProjectReference) dataObject;
switch (pref.ReferenceType) {
case ReferenceType.Project:
label = pref.Reference;
icon = Context.GetIcon ("md-reference-project");
break;
case ReferenceType.Assembly:
label = Path.GetFileName(pref.Reference);
icon = Context.GetIcon ("md-reference-folder");
break;
case ReferenceType.Package:
label = pref.Reference.Split(',')[0];
icon = Context.GetIcon ("md-reference-package");
break;
default:
label = pref.Reference;
icon = Context.GetIcon (Stock.Reference);
break;
}
label = GLib.Markup.EscapeText (label);
if (!pref.IsValid) {
label = "<span color='red'>" + label + "</span>";
icon = Context.GetIcon ("md-reference-warning");
}
}
示例4: BuildNode
public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
{
var compilationUnit = (AssemblyLoader)dataObject;
label = Path.GetFileNameWithoutExtension (compilationUnit.FileName);
icon = Context.GetIcon (Stock.Reference);
}
示例5: BuildNode
public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
{
UnknownSolutionItem entry = (UnknownSolutionItem) dataObject;
if (entry.UnloadedEntry) {
icon = Context.GetIcon (MonoDevelop.Ide.Gui.Stock.Project);
Gdk.Pixbuf gicon = Context.GetComposedIcon (icon, "fade");
if (gicon == null) {
gicon = ImageService.MakeTransparent (icon, 0.5);
Context.CacheComposedIcon (icon, "fade", gicon);
}
icon = gicon;
label = GettextCatalog.GetString ("<span foreground='grey'>{0} <span size='small'>(Unavailable)</span></span>", GLib.Markup.EscapeText (entry.Name));
}
else if (entry.LoadError.Length > 0) {
icon = Context.GetIcon (Gtk.Stock.DialogError);
label = GettextCatalog.GetString ("{0} <span foreground='red' size='small'>(Load failed)</span>", GLib.Markup.EscapeText (entry.Name));
} else {
icon = Context.GetIcon (MonoDevelop.Ide.Gui.Stock.Project);
Gdk.Pixbuf gicon = Context.GetComposedIcon (icon, "fade");
if (gicon == null) {
gicon = ImageService.MakeTransparent (icon, 0.5);
Context.CacheComposedIcon (icon, "fade", gicon);
}
icon = gicon;
label = GLib.Markup.EscapeText (entry.Name);
}
}
示例6: BuildNode
public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
{
//modules do no have names/IDs, but genrally the only reason they exist
//is because they have additional, optional dependencies
//so find the dependencies that are not referenced in other modules
//and use one as the label
var module = (ModuleDescription)dataObject;
var deps = new HashSet<string> ();
foreach (Dependency dep in module.Dependencies) {
deps.Add (dep.Name);
}
foreach (ModuleDescription other in module.ParentAddinDescription.AllModules) {
if (other == module) {
continue;
}
foreach (Dependency dep in other.Dependencies) {
deps.Remove (dep.Name);
}
}
if (deps.Count > 0) {
nodeInfo.Label = deps.First ().Split (new[] { ' '})[0];
} else {
nodeInfo.Label = "Module";
}
}
示例7: BuildChildNodes
public override void BuildChildNodes(ITreeBuilder treeBuilder, object dataObject)
{
var node = (DependenciesFolderNode)dataObject;
foreach (FrameworkNode frameworkFolderNode in node.GetFrameworkFolderNodes ()) {
treeBuilder.AddChild (frameworkFolderNode);
}
}
示例8: GetNameWithGenericParameters
/*
private string GetNameWithGenericParameters (IType c)
{
if (c.TypeParameters != null && c.TypeParameters.Count > 0)
{
StringBuilder builder = new StringBuilder (c.Name);
builder.Append("<");
for (int i = 0; i < c.TypeParameters.Count; i++)
{
builder.Append(c.TypeParameters[i].Name);
if (i + 1 < c.TypeParameters.Count) builder.Append(", ");
}
builder.Append(">");
return builder.ToString();
}
else
return c.Name;
}*/
public override void BuildChildNodes (ITreeBuilder builder, object dataObject)
{
ClassData classData = dataObject as ClassData;
bool publicOnly = builder.Options ["PublicApiOnly"];
bool publicProtectedOnly = builder.Options ["PublicProtectedApiOnly"];
publicOnly |= publicProtectedOnly;
// Delegates have an Invoke method, which doesn't need to be shown.
if (classData.Class.ClassType == ClassType.Delegate)
return;
foreach (IType innerClass in classData.Class.InnerTypes)
if (innerClass.IsPublic || (innerClass.IsProtected && publicProtectedOnly) || !publicOnly)
builder.AddChild (new ClassData (classData.Project, innerClass));
foreach (IMethod method in classData.Class.Methods)
if (method.IsPublic || (method.IsProtected && publicProtectedOnly) || !publicOnly)
builder.AddChild (method);
foreach (IProperty property in classData.Class.Properties)
if (property.IsPublic || (property.IsProtected && publicProtectedOnly) || !publicOnly)
builder.AddChild (property);
foreach (IField field in classData.Class.Fields)
if (field.IsPublic || (field.IsProtected && publicProtectedOnly) || !publicOnly)
builder.AddChild (field);
foreach (IEvent e in classData.Class.Events)
if (e.IsPublic || (e.IsProtected && publicProtectedOnly) || !publicOnly)
builder.AddChild (e);
}
示例9: BuildNode
/// <summary>Build the node in the project tree.</summary>
/// <param name="treeBuilder">An ITreeBuilder containing the project tree builder.</param>
/// <param name="dataObject">An object containing the current builder child.</param>
/// <param name="label">A string containing the label of the node.</param>
/// <param name="icon">A Pixbif containing the icon for the node.</param>
/// <param name="closedIcon">A Pixbif containing the closed icon for the node.</param>
public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
{
label = GettextCatalog.GetString ("Web References");
icon = Context.GetIcon (Stock.OpenReferenceFolder);
closedIcon = Context.GetIcon (Stock.ClosedReferenceFolder);
}
示例10: BuildChildNodes
public override void BuildChildNodes (ITreeBuilder builder, object dataObject)
{
// TODO: Type system conversion.
/* ProjectReference pref = (ProjectReference) dataObject;
Dictionary<string, bool> namespaces = new Dictionary<string, bool> ();
bool nestedNs = builder.Options ["NestedNamespaces"];
foreach (string fileName in pref.GetReferencedFileNames (IdeApp.Workspace.ActiveConfiguration)) {
var unit = new CecilLoader ().LoadAssemblyFile (fileName);
if (unit == null)
continue;
foreach (var type in unit.GetTypes ()) {
if (type.IsSynthetic)
continue;
if (String.IsNullOrEmpty (type.Namespace)) {
builder.AddChild (new ClassData (unit, null, type));
continue;
}
string ns = type.Namespace;
if (nestedNs) {
int idx = ns.IndexOf ('.');
if (idx >= 0)
ns = ns.Substring (0, idx);
}
if (namespaces.ContainsKey (ns))
continue;
namespaces[ns] = true;
builder.AddChild (new CompilationUnitNamespaceData (null, ns));
}
}*/
}
示例11: BuildNode
public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
{
ProjectFile file = (ProjectFile) dataObject;
nodeInfo.Label = GLib.Markup.EscapeText (file.Link.IsNullOrEmpty ? file.FilePath.FileName : file.Link.FileName);
if (!File.Exists (file.FilePath)) {
nodeInfo.Label = "<span foreground='red'>" + nodeInfo.Label + "</span>";
}
nodeInfo.Icon = DesktopService.GetIconForFile (file.FilePath, Gtk.IconSize.Menu);
if (file.IsLink && nodeInfo.Icon != null) {
var overlay = ImageService.GetIcon ("md-link-overlay").WithSize (Xwt.IconSize.Small);
var cached = Context.GetComposedIcon (nodeInfo.Icon, overlay);
if (cached != null)
nodeInfo.Icon = cached;
else {
var ib = new Xwt.Drawing.ImageBuilder (nodeInfo.Icon.Width, nodeInfo.Icon.Height);
ib.Context.DrawImage (nodeInfo.Icon, 0, 0);
ib.Context.DrawImage (overlay, 0, 0);
var res = ib.ToVectorImage ();
ib.Dispose ();
Context.CacheComposedIcon (nodeInfo.Icon, overlay, res);
nodeInfo.Icon = res;
}
}
}
示例12: BuildNode
public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
{
ViewSchema schema = (ViewSchema) dataObject;
label = schema.Name;
string iconName = "md-mono-query-table";
icon = Context.GetIcon (iconName);
}
示例13: BuildNode
public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
{
ProjectReference pref = (ProjectReference) dataObject;
switch (pref.ReferenceType) {
case ReferenceType.Project:
nodeInfo.Label = pref.Reference;
nodeInfo.Icon = Context.GetIcon ("md-reference-project");
break;
case ReferenceType.Assembly:
nodeInfo.Label = Path.GetFileName(pref.Reference);
nodeInfo.Icon = Context.GetIcon ("md-reference-folder");
break;
case ReferenceType.Package:
nodeInfo.Label = pref.Reference.Split(',')[0];
nodeInfo.Icon = Context.GetIcon ("md-reference-package");
break;
default:
nodeInfo.Label = pref.Reference;
nodeInfo.Icon = Context.GetIcon (Stock.Reference);
break;
}
nodeInfo.Label = GLib.Markup.EscapeText (nodeInfo.Label);
if (!pref.IsValid) {
nodeInfo.Label = "<span color='red'>" + nodeInfo.Label + "</span>";
nodeInfo.Icon = Context.GetIcon ("md-reference-warning");
}
}
示例14: BuildNode
public override void BuildNode (ITreeBuilder builder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
{
ViewNode node = dataObject as ViewNode;
label = node.View.Name;
icon = Context.GetIcon ("md-db-view");
}
示例15: BuildNode
/* public override void GetNodeAttributes (ITreeNavigator parentNode, object dataObject, ref NodeAttributes attributes)
{
attributes |= NodeAttributes.UseMarkup;
}
*/
public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
{
UnitTest test = dataObject as UnitTest;
nodeInfo.Icon = test.StatusIcon;
var title = RemoveGenericArgument (test.Title);
title = test.Title;
if (test.Status == TestStatus.Running) {
nodeInfo.Label = Ambience.EscapeText (title);
return;
} else if (test.Status == TestStatus.Loading) {
nodeInfo.Label = Ambience.EscapeText (title) + GettextCatalog.GetString (" (Loading)");
return;
} else if (test.Status == TestStatus.LoadError) {
nodeInfo.Label = Ambience.EscapeText (title) + GettextCatalog.GetString (" (Load failed)");
return;
} else {
nodeInfo.Label = Ambience.EscapeText (title);
UnitTestResult res = test.GetLastResult ();
if (res != null && treeBuilder.Options ["ShowTestCounters"] && (test is UnitTestGroup)) {
nodeInfo.Label += string.Format (GettextCatalog.GetString (" ({0} passed, {1} failed, {2} not run)"), res.Passed, res.ErrorsAndFailures, res.TestsNotRun);
}
if (treeBuilder.Options ["ShowTestTime"]) {
nodeInfo.Label += string.Format (" Time: {0}ms", res.Time.TotalMilliseconds);
}
}
}