public override void BuildNode(ITreeBuilder builder, object dataObject, NodeInfo nodeInfo) { string thisPath = GetFolderPath(dataObject); if ((dataObject is ProjectFolder) && builder.Options ["ShowAllFiles"] && Directory.Exists(thisPath)) { ProjectFolder pf = (ProjectFolder)dataObject; if (pf.Project == null || !ProjectFolderCommandHandler.PathExistsInProject(pf.Project, thisPath)) { var gicon = Context.GetComposedIcon(nodeInfo.Icon, "fade"); if (gicon == null) { gicon = nodeInfo.Icon.WithAlpha(0.5); Context.CacheComposedIcon(nodeInfo.Icon, "fade", gicon); } nodeInfo.Icon = gicon; gicon = Context.GetComposedIcon(nodeInfo.ClosedIcon, "fade"); if (gicon == null) { gicon = nodeInfo.ClosedIcon.WithAlpha(0.5); Context.CacheComposedIcon(nodeInfo.ClosedIcon, "fade", gicon); } nodeInfo.ClosedIcon = gicon; } } }
public override void BuildNode(ITreeBuilder builder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) { string thisPath = GetFolderPath(dataObject); if ((dataObject is ProjectFolder) && builder.Options ["ShowAllFiles"] && Directory.Exists(thisPath)) { ProjectFolder pf = (ProjectFolder)dataObject; if (pf.Project == null || !ProjectFolderCommandHandler.PathExistsInProject(pf.Project, thisPath)) { Gdk.Pixbuf gicon = Context.GetComposedIcon(icon, "fade"); if (gicon == null) { gicon = ImageService.MakeTransparent(icon, 0.5); Context.CacheComposedIcon(icon, "fade", gicon); } icon = gicon; gicon = Context.GetComposedIcon(closedIcon, "fade"); if (gicon == null) { gicon = ImageService.MakeTransparent(closedIcon, 0.5); Context.CacheComposedIcon(closedIcon, "fade", gicon); } closedIcon = gicon; } } }
void OnSystemFileDeleted(object sender, FileEventArgs args) { if (Context.Tree.IsDestroyed) { return; } foreach (FileEventInfo e in args) { try { Project project = GetProjectForFile(e.FileName); ITreeBuilder tb = Context.GetTreeBuilder(); if (e.IsDirectory) { if (tb.MoveToObject(new ProjectFolder(e.FileName, project))) { if (tb.Options ["ShowAllFiles"] && (project == null || !ProjectFolderCommandHandler.PathExistsInProject(project, e.FileName))) { tb.Remove(); return; } } } else { if (tb.MoveToObject(new SystemFile(e.FileName, project))) { tb.Remove(); return; } } // Find the parent folder, and update it's children count string parentPath = Path.GetDirectoryName(e.FileName); if (tb.MoveToObject(new ProjectFolder(parentPath, project))) { if (tb.Options ["ShowAllFiles"] && Directory.Exists(parentPath)) { tb.UpdateChildren(); } } } catch (Exception ex) { LoggingService.LogInternalError($"Error while updating project tree in OnSystemFileDeleted : {string.Join (", ", args.Select (x => x.FileName))}.", ex); } } }
void OnSystemFileDeleted(object sender, FileEventArgs args) { foreach (FileEventInfo e in args) { Project project = GetProjectForFile(e.FileName); if (project == null) { return; } ITreeBuilder tb = Context.GetTreeBuilder(); if (e.IsDirectory) { if (tb.MoveToObject(new ProjectFolder(e.FileName, project))) { if (tb.Options ["ShowAllFiles"] && !ProjectFolderCommandHandler.PathExistsInProject(project, e.FileName)) { tb.Remove(); return; } } } else { if (tb.MoveToObject(new SystemFile(e.FileName, project))) { tb.Remove(); return; } } // Find the parent folder, and update it's children count string parentPath = Path.GetDirectoryName(e.FileName); if (tb.MoveToObject(new ProjectFolder(parentPath, project))) { if (tb.Options ["ShowAllFiles"] && Directory.Exists(parentPath)) { tb.UpdateChildren(); } } } }