LoadOverlayIconForStatus() публичный статический Метод

public static LoadOverlayIconForStatus ( VersionStatus status ) : Xwt.Drawing.Image
status VersionStatus
Результат Xwt.Drawing.Image
/*		public override void PrepareChildNodes (object dataObject)
 *              {
 *                      if (dataObject is IWorkspaceObject) {
 *                              IWorkspaceObject ce = (IWorkspaceObject) dataObject;
 *                              Repository rep = VersionControlService.GetRepository (ce);
 *                              if (rep != null)
 *                                      rep.GetDirectoryVersionInfo (ce.BaseDirectory, false, false);
 *                      } else if (dataObject is ProjectFolder) {
 *                              ProjectFolder ce = (ProjectFolder) dataObject;
 *                              if (ce.ParentWorkspaceObject != null) {
 *                                      Repository rep = VersionControlService.GetRepository (ce.ParentWorkspaceObject);
 *                                      if (rep != null)
 *                                              rep.GetDirectoryVersionInfo (ce.Path, false, false);
 *                              }
 *                      }
 *                      base.PrepareChildNodes (dataObject);
 *              }
 */
        static void AddFolderOverlay(Repository rep, string folder, NodeInfo nodeInfo, bool skipVersionedOverlay)
        {
            if (!rep.TryGetVersionInfo(folder, out var vinfo))
            {
                return;
            }
            Xwt.Drawing.Image overlay = null;
            if (vinfo == null || !vinfo.IsVersioned)
            {
                overlay = VersionControlService.LoadOverlayIconForStatus(VersionStatus.Unversioned);
            }
            else if (vinfo.IsVersioned && !vinfo.HasLocalChanges)
            {
                if (!skipVersionedOverlay)
                {
                    overlay = VersionControlService.overlay_controled;
                }
            }
            else
            {
                overlay = VersionControlService.LoadOverlayIconForStatus(vinfo.Status);
            }
            if (overlay != null)
            {
                nodeInfo.OverlayBottomRight = overlay;
            }
        }
        void AddFolderOverlay(Repository rep, string folder, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
        {
            Gdk.Pixbuf  overlay = null;
            VersionInfo vinfo   = rep.GetVersionInfo(folder, false);

            if (vinfo == null || !vinfo.IsVersioned)
            {
                overlay = VersionControlService.LoadOverlayIconForStatus(VersionStatus.Unversioned);
            }
            else if (vinfo.IsVersioned && !vinfo.HasLocalChanges)
            {
                overlay = VersionControlService.overlay_controled;
            }
            else
            {
                overlay = VersionControlService.LoadOverlayIconForStatus(vinfo.Status);
            }
            if (overlay != null)
            {
                AddOverlay(ref icon, overlay);
                if (closedIcon != null)
                {
                    AddOverlay(ref closedIcon, overlay);
                }
            }
        }
Пример #3
0
        void AddFolderOverlay(Repository rep, string folder, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon, object dataObject)
        {
            Gdk.Pixbuf  overlay = null;
            VersionInfo vinfo   = GetVersionInfo(rep, folder, dataObject, false);

            if (vinfo == null)
            {
                ThreadPool.QueueUserWorkItem(x => {
                    VersionInfo info = GetVersionInfo(rep, folder, dataObject, true);
                    if (info != null)
                    {
                        DispatchService.GuiDispatch(() => UpdatePath(folder));
                    }
                });
                vinfo = VersionInfo.CreateUnversioned(folder, true);
            }
            else if (!vinfo.IsVersioned)
            {
                overlay = VersionControlService.LoadOverlayIconForStatus(VersionStatus.Unversioned);
            }
            else if (vinfo.IsVersioned && !vinfo.HasLocalChanges)
            {
                overlay = VersionControlService.overlay_controled;
            }
            else
            {
                overlay = VersionControlService.LoadOverlayIconForStatus(vinfo.Status);
            }
            if (overlay != null)
            {
                AddOverlay(ref icon, overlay);
                if (closedIcon != null)
                {
                    AddOverlay(ref closedIcon, overlay);
                }
            }
        }
        public override void BuildNode(ITreeBuilder builder, object dataObject, NodeInfo nodeInfo)
        {
            if (!builder.Options["ShowVersionControlOverlays"])
            {
                return;
            }

            // Add status overlays

            if (dataObject is WorkspaceObject)
            {
                WorkspaceObject ce  = (WorkspaceObject)dataObject;
                Repository      rep = VersionControlService.GetRepository(ce);
                if (rep != null)
                {
                    rep.GetDirectoryVersionInfoAsync(ce.BaseDirectory, false, false);
                    AddFolderOverlay(rep, ce.BaseDirectory, nodeInfo, false);
                }
                return;
            }
            else if (dataObject is ProjectFolder)
            {
                ProjectFolder ce = (ProjectFolder)dataObject;
                if (ce.ParentWorkspaceObject != null)
                {
                    Repository rep = VersionControlService.GetRepository(ce.ParentWorkspaceObject);
                    if (rep != null)
                    {
                        rep.GetDirectoryVersionInfoAsync(ce.Path, false, false);
                        AddFolderOverlay(rep, ce.Path, nodeInfo, true);
                    }
                }
                return;
            }

            WorkspaceObject prj;
            FilePath        file;

            if (dataObject is ProjectFile)
            {
                ProjectFile pfile = (ProjectFile)dataObject;
                prj  = pfile.Project;
                file = pfile.FilePath;
            }
            else
            {
                SystemFile pfile = (SystemFile)dataObject;
                prj  = pfile.ParentWorkspaceObject;
                file = pfile.Path;
            }

            if (prj == null)
            {
                return;
            }

            Repository repo = VersionControlService.GetRepository(prj);

            if (repo == null)
            {
                return;
            }

            if (repo.TryGetVersionInfo(file, out var vi))
            {
                var overlay = VersionControlService.LoadOverlayIconForStatus(vi.Status);
                if (overlay != null)
                {
                    nodeInfo.OverlayBottomRight = overlay;
                }
            }
        }
        public override void BuildNode(ITreeBuilder builder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
        {
            if (!builder.Options["ShowVersionControlOverlays"])
            {
                return;
            }

            // Add status overlays

            if (dataObject is IWorkspaceObject)
            {
                IWorkspaceObject ce = (IWorkspaceObject)dataObject;
                ClearDirCache(ce.BaseDirectory);
                Repository rep = VersionControlService.GetRepository(ce);
                if (rep != null)
                {
                    AddFolderOverlay(rep, ce.BaseDirectory, ref icon, ref closedIcon);
                }
                return;
            }
            else if (dataObject is ProjectFolder)
            {
                ProjectFolder ce = (ProjectFolder)dataObject;
                if (ce.ParentWorkspaceObject != null)
                {
                    ClearDirCache(ce.Path);
                    Repository rep = VersionControlService.GetRepository(ce.ParentWorkspaceObject);
                    if (rep != null)
                    {
                        AddFolderOverlay(rep, ce.Path, ref icon, ref closedIcon);
                    }
                }
                return;
            }

            IWorkspaceObject prj;
            FilePath         file;

            if (dataObject is ProjectFile)
            {
                ProjectFile pfile = (ProjectFile)dataObject;
                prj  = pfile.Project;
                file = pfile.FilePath;
            }
            else
            {
                SystemFile pfile = (SystemFile)dataObject;
                prj  = pfile.ParentWorkspaceObject;
                file = pfile.Path;
            }

            if (prj == null)
            {
                return;
            }

            Repository repo = VersionControlService.GetRepository(prj);

            if (repo == null)
            {
                return;
            }

            VersionInfo vi = GetVersionInfo(repo, file);

            if (dataObject is ProjectFile)
            {
                ((ProjectFile)dataObject).ExtendedProperties [typeof(VersionInfo)] = vi;
            }

            Gdk.Pixbuf overlay = VersionControlService.LoadOverlayIconForStatus(vi.Status);
            if (overlay != null)
            {
                AddOverlay(ref icon, overlay);
            }
        }
Пример #6
0
        public override void BuildNode(ITreeBuilder builder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
        {
            if (!builder.Options["ShowVersionControlOverlays"])
            {
                return;
            }

            // Add status overlays
            FilePath file;

            if (dataObject is IWorkspaceObject)
            {
                IWorkspaceObject ce = (IWorkspaceObject)dataObject;
                // ClearDirCache (ce.BaseDirectory); // Why?
                Repository rep = VersionControlService.GetRepository(ce);
                if (rep != null)
                {
                    AddFolderOverlay(rep, ce.BaseDirectory, ref icon, ref closedIcon, dataObject);
                }
                return;
            }
            else if (dataObject is ProjectFolder)
            {
                ProjectFolder ce = (ProjectFolder)dataObject;
                if (ce.ParentWorkspaceObject != null)
                {
                    // ClearDirCache (ce.Path); // Why?
                    Repository rep = VersionControlService.GetRepository(ce.ParentWorkspaceObject);
                    if (rep != null)
                    {
                        AddFolderOverlay(rep, ce.Path, ref icon, ref closedIcon, dataObject);
                    }
                }
                return;
            }

            IWorkspaceObject prj;

            if (dataObject is ProjectFile)
            {
                ProjectFile pfile = (ProjectFile)dataObject;
                prj  = pfile.Project;
                file = pfile.FilePath;
            }
            else
            {
                SystemFile pfile = (SystemFile)dataObject;
                prj  = pfile.ParentWorkspaceObject;
                file = pfile.Path;
            }

            if (prj == null)
            {
                return;
            }

            Repository repo = VersionControlService.GetRepository(prj);

            if (repo == null)
            {
                return;
            }

            VersionInfo vi = GetVersionInfo(repo, file.CanonicalPath, dataObject, false);

            if (vi == null)
            {
                // Console.WriteLine ("Cache miss for {0}", file.CanonicalPath);
                ThreadPool.QueueUserWorkItem(x => {
                    VersionInfo info = GetVersionInfo(repo, file.CanonicalPath, dataObject, true);
                    if (info != null)
                    {
                        DispatchService.GuiDispatch(() => UpdatePath(file.CanonicalPath));
                    }
                });
                vi = VersionInfo.CreateUnversioned(file.CanonicalPath, false);
            }

            if (dataObject is ProjectFile)
            {
                ((ProjectFile)dataObject).ExtendedProperties [typeof(VersionInfo)] = vi;
            }

            Gdk.Pixbuf overlay = VersionControlService.LoadOverlayIconForStatus(vi.Status);
            if (overlay != null)
            {
                AddOverlay(ref icon, overlay);
            }
        }