Пример #1
0
 public ProjectNotifier(IVisualGitServiceProvider context)
     : base(context)
 {
     uint cookie;
     if (ErrorHandler.Succeeded(context.GetService<IVsShell>(typeof(SVsShell)).AdviseBroadcastMessages(this, out cookie)))
         _cookie = cookie;
 }
Пример #2
0
        public SolutionSettings(IVisualGitServiceProvider context)
            : base(context)
        {
            IVsShell shell = GetService<IVsShell>(typeof(SVsShell));

            if (shell == null)
                throw new InvalidOperationException("IVsShell not available");

            object r;
            if (ErrorHandler.Succeeded(shell.GetProperty((int)__VSSPROPID.VSSPROPID_VirtualRegistryRoot, out r)))
                _vsUserRoot = (string)r;
            else
                _vsUserRoot = @"SOFTWARE\Microsoft\VisualStudio\8.0";

            string baseName = _vsUserRoot;

            if (_vsUserRoot.EndsWith(@"\UserSettings", StringComparison.OrdinalIgnoreCase))
            {
                _inRanu = true;
                baseName = _vsUserRoot.Substring(0, _vsUserRoot.Length - 13);
                _vsAppRoot = baseName + @"\Configuration";
            }
            else
                _vsAppRoot = _vsUserRoot;

            if (baseName.StartsWith(@"SOFTWARE\", StringComparison.OrdinalIgnoreCase))
                baseName = baseName.Substring(9); // Should always trigger

            if (baseName.StartsWith(@"Microsoft\", StringComparison.OrdinalIgnoreCase))
                baseName = baseName.Substring(10); // Give non-ms hives a prefix

            _hiveSuffix = baseName;
        }
Пример #3
0
        public VSCommandRouting(IVisualGitServiceProvider context, VSContainerForm form)
            : base(context)
        {
            if (form == null)
                throw new ArgumentNullException("form");

            _form = form;
            _vsForm = form;

            if (_routers.Count > 0)
                _routers.Peek().Enabled = false;

            Application.AddMessageFilter(this);
            _routers.Push(this);
            _installed = true;
            _vsWpf = !VSVersion.VS2008OrOlder;
            _map.Add(form, this);

            _rPct = GetService<IVsRegisterPriorityCommandTarget>(typeof(SVsRegisterPriorityCommandTarget));

            if(_rPct != null)
            {
                Marshal.ThrowExceptionForHR(_rPct.RegisterPriorityCommandTarget(0, this, out _csCookie));
            }

            ISelectionContextEx sel = GetService<ISelectionContextEx>(typeof(ISelectionContext));

            if (sel != null)
            {
                _activeStack = sel.PushPopupContext(form);
            }
        }
Пример #4
0
 public VisualGitScheduler(IVisualGitServiceProvider context)
     : base(context)
 {
     _timer = new Timer();
     _timer.Enabled = false;
     _timer.Elapsed += new ElapsedEventHandler(OnTimerElapsed);
 }
Пример #5
0
        public WCTreeNode(IVisualGitServiceProvider context, WCTreeNode parent)
        {
            if (context == null)
                throw new ArgumentNullException("context");

            _context = context;
            _parent = parent;
        }
Пример #6
0
        public ExportDialog(IVisualGitServiceProvider context)
            : this()
        {
            if (context == null)
                throw new ArgumentNullException("context");

            Context = context;
        }
Пример #7
0
        protected VisualGitCommandHook(IVisualGitServiceProvider context, Control control)
            : base(context)
        {
            if (control == null)
                throw new ArgumentNullException("control");

            _control = control;
        }
Пример #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VisualGitIdleArgs"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="idleFlags">The idle flags.</param>
 public VisualGitIdleArgs(IVisualGitServiceProvider context, int idleFlags)
 {
     if (context == null)
         throw new ArgumentNullException("context");
     _context = context;
     _periodic = (0 != (idleFlags & (int)_OLEIDLEF.oleidlefPeriodic));
     _nonPeriodic = (0 != (idleFlags & (int)_OLEIDLEF.oleidlefNonPeriodic));
     _priority = (0 != (idleFlags & (int)_OLEIDLEF.oleidlefPriority));
 }
Пример #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ChangeSourceControlRow"/> class.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="project">The project.</param>
        public ChangeSourceControlRow(IVisualGitServiceProvider context, GitProject project)
        {
            if (context == null)
                throw new ArgumentNullException("context");
            else if (project == null)
                throw new ArgumentNullException("project");

            _context = context;
            _project = project;
        }
Пример #10
0
        public GitItemData(IVisualGitServiceProvider context, GitItem item)
        {
            if (context == null)
                throw new ArgumentNullException("context");
            else if (item == null)
                throw new ArgumentNullException("item");

            _context = context;
            _item = item;
        }
Пример #11
0
 public FileIconMapper(IVisualGitServiceProvider context)
     : base(context)
 {
     _imageList = new ImageList();
     _imageList.ImageSize = new Size(16, 16);
     _imageList.ColorDepth = ColorDepth.Depth32Bit;
     _iconMap = new Dictionary<ProjectIconReference, int>();
     _folderMap = new SortedList<WindowsSpecialFolder, int>();
     _fileTypeMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
 }
Пример #12
0
        /// <summary>
        /// Saves all dirty documents within the provided selection
        /// </summary>
        /// <param name="selection">The selection.</param>
        /// <param name="context">The context.</param>
        protected static void SaveAllDirtyDocuments(ISelectionContext selection, IVisualGitServiceProvider context)
        {
            if (selection == null)
                throw new ArgumentNullException("selection");
            if (context == null)
                throw new ArgumentNullException("context");

            IVisualGitOpenDocumentTracker tracker = context.GetService<IVisualGitOpenDocumentTracker>();
            if (tracker != null)
                tracker.SaveDocuments(selection.GetSelectedFiles(true));
        }
Пример #13
0
        public WCSolutionNode(IVisualGitServiceProvider context, GitItem item)
            : base(context, null, item)
        {
            string file = Context.GetService<IVisualGitSolutionSettings>().SolutionFilename;

            IFileIconMapper iconMapper = context.GetService<IFileIconMapper>();

            if (string.IsNullOrEmpty(file))
                _imageIndex = iconMapper.GetIconForExtension(".sln");
            else
                _imageIndex = iconMapper.GetIcon(file);
        }
Пример #14
0
        public void RefreshText(IVisualGitServiceProvider context)
        {
            if (context == null)
                throw new ArgumentNullException("context");

            IFileStatusCache cache = context.GetService<IFileStatusCache>();

            ImageIndex = PendingChange.IconIndex;
            GitItem item = cache[FullPath];

            if (item == null)
                throw new InvalidOperationException(); // Item no longer valued

            PendingChangeStatus pcs = PendingChange.Change ?? new PendingChangeStatus(PendingChangeKind.None);

            SetValues(
                pcs.PendingCommitText,
                "", // Change list
                GetDirectory(item),
                PendingChange.FullPath,
                "", // Locked
                SafeDate(item.Modified), // Modified
                PendingChange.Name,
                PendingChange.RelativePath,
                PendingChange.Project,
                GetRevision(PendingChange),
                PendingChange.FileType,
                SafeWorkingCopy(item));

            if (!SystemInformation.HighContrast)
            {
                System.Drawing.Color clr = System.Drawing.Color.Black;

                if (item.IsConflicted || PendingChange.Kind == PendingChangeKind.WrongCasing)
                    clr = System.Drawing.Color.Red;
                else if (item.IsDeleteScheduled)
                    clr = System.Drawing.Color.DarkRed;
                else if (item.Status.IsCopied || item.Status.State == GitStatus.Added)
                    clr = System.Drawing.Color.FromArgb(100, 0, 100);
                else if (!item.IsVersioned)
                {
                    if (item.InSolution && !item.IsIgnored)
                        clr = System.Drawing.Color.FromArgb(100, 0, 100); // Same as added+copied
                    else
                        clr = System.Drawing.Color.Black;
                }
                else if (item.IsModified)
                    clr = System.Drawing.Color.DarkBlue;

                ForeColor = clr;
            }
        }
Пример #15
0
        public SccProjectFileReference(IVisualGitServiceProvider context, SccProjectData project, SccProjectFile file)
        {
            if (context == null)
                throw new ArgumentNullException("context");
            else if (project == null)
                throw new ArgumentNullException("project");

            _context = context;
            _project = project;
            _file = file;
            _refCount = 1; // One should only create a reference if one needs one
            file.AddReference(this);
        }
Пример #16
0
        public VSFormContainerPane(IVisualGitServiceProvider context, VSCommandRouting routing, Panel panel)
            : base(context)
        {
            if (context == null)
                throw new ArgumentNullException("context");
            else if (routing == null)
                throw new ArgumentNullException("routing");
            else if (panel == null)
                throw new ArgumentNullException("panel");

            _routing = routing;
            _panel = panel;
        }
Пример #17
0
        internal SccDocumentData(IVisualGitServiceProvider context, string name)
            : base(context)
        {
            if (string.IsNullOrEmpty(name))
                throw new ArgumentNullException("name");

            _name = name;

            if (GitItem.IsValidPath(name))
            {
                _isFileDocument = true;

                HookFileChanges(true);
            }
        }
Пример #18
0
            public DiffTool(IVisualGitServiceProvider context, string name, string title, string program, string arguments)
            {
                if (context == null)
                    throw new ArgumentNullException("context");
                else if (string.IsNullOrEmpty(name))
                    throw new ArgumentNullException("name");
                else if (String.IsNullOrEmpty(program))
                    throw new ArgumentNullException("program");
                else if (String.IsNullOrEmpty(arguments))
                    throw new ArgumentNullException("arguments");

                _context = context;
                _name = name;
                _title = title ?? name;
                _program = program;
                _arguments = arguments;
            }
Пример #19
0
 public VisualGitSccProvider(IVisualGitServiceProvider context)
     : base(context)
 {
 }
Пример #20
0
        protected override IDisposable DialogRunContext(IVisualGitServiceProvider context)
        {
            IVisualGitDialogOwner owner = null;
            if (context != null)
                owner = context.GetService<IVisualGitDialogOwner>();

            if (owner != null)
                return owner.InstallFormRouting(this, EventArgs.Empty);
            else
                return base.DialogRunContext(context);
        }
Пример #21
0
 public TextEditorFactory(IVisualGitServiceProvider context)
     : base(context)
 {
 }
Пример #22
0
 public GitSccContext(IVisualGitServiceProvider context)
     : base(context)
 {
     _client = context.GetService<IGitClientPool>().GetNoUIClient();
     _statusCache = GetService<IFileStatusCache>();
 }
Пример #23
0
            public ProjectListFilter(IVisualGitServiceProvider context, IEnumerable<GitProject> projects)
            {
                if (context == null)
                    throw new ArgumentNullException("context");
                if (projects == null)
                    throw new ArgumentNullException("projects");

                _mapper = context.GetService<IProjectFileMapper>();
                List<GitProject> projectList = new List<GitProject>(projects);

                files.AddRange(_mapper.GetAllFilesOf(projectList));

                foreach (GitProject p in projectList)
                {
                    IGitProjectInfo pi = _mapper.GetProjectInfo(p);

                    if (pi == null)
                        continue; // Ignore solution and non scc projects

                    string dir = pi.ProjectDirectory;

                    if (!string.IsNullOrEmpty(dir) && !folders.Contains(dir))
                        folders.Add(dir);
                }
            }
Пример #24
0
 public ContextCommandHandler(IVisualGitServiceProvider context, Control control)
     : base(context, control)
 {
 }
Пример #25
0
 public VSCommandInstaller(IVisualGitServiceProvider context)
     : base(context)
 {
 }
Пример #26
0
 public SolutionExplorerWindow(IVisualGitServiceProvider context)
     : base(context)
 {
     _manager = new SolutionTreeViewManager(Context);
 }
Пример #27
0
 public PendingChangeManager(IVisualGitServiceProvider context)
     : base(context)
 {
 }
Пример #28
0
 public DiffTool(IVisualGitServiceProvider context, string name, string title, string program, string arguments, bool replaceQuod)
     : this(context, name, title, program, replaceQuod ? (arguments ?? "").Replace('\'', '"') : arguments)
 {
 }
Пример #29
0
 public OutputPaneManager(IVisualGitServiceProvider context)
     : base(context)
 {
 }
Пример #30
0
        public void Create(IVisualGitServiceProvider context, string fullPath)
        {
            if (context == null)
                throw new ArgumentNullException("context");

            _context = context;

            DynamicFactory.CreateEditor(fullPath, this);
            OnFrameCreated(EventArgs.Empty);
        }