private OpenProjectFileDiffCommand(
     IGitBranchDifferPackage package,
     DTE dte,
     IVsDifferenceService vsDifferenceService,
     IVsUIShell vsUIShell,
     OleMenuCommandService commandService)
     : base(package,
            dte,
            vsDifferenceService,
            vsUIShell,
            commandService,
            new CommandID(
                GitBranchDifferPackageGuids.guidFileDiffPackageCmdSet,
                GitBranchDifferPackageGuids.CommandIdProjectFileDiffMenuCommand))
 {
 }
Beispiel #2
0
 public BranchDiffFilter(
     IGitBranchDifferPackage package,
     string solutionPath,
     string solutionName,
     SVsServiceProvider serviceProvider,
     IVsHierarchyItemCollectionProvider vsHierarchyItemCollectionProvider)
 {
     this.package           = package;
     this.solutionDirectory = solutionPath;
     this.solutionFile      = solutionName;
     this.serviceProvider   = serviceProvider;
     this.vsHierarchyItemCollectionProvider = vsHierarchyItemCollectionProvider;
     this.Initialized     += BranchDiffFilter_Initialized;
     this.branchDiffWorker = DIContainer.Instance.GetService(typeof(GitBranchDiffController)) as GitBranchDiffController;
     Assumes.Present(this.branchDiffWorker);
 }
        protected async Task InitializeAsync(IGitBranchDifferPackage package)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            this.package = package ?? throw new ArgumentNullException(nameof(package));
            this.dte     = await package.GetServiceAsync(typeof(EnvDTE.DTE)) as EnvDTE.DTE ?? throw new ArgumentNullException(nameof(dte));

            this.vsUIShell = await package.GetServiceAsync(typeof(SVsUIShell)) as IVsUIShell ?? throw new ArgumentNullException(nameof(vsUIShell));

            // Dependencies that can be moved to constructor and resolved via IoC...
            this.vsDifferenceService = await package.GetServiceAsync(typeof(SVsDifferenceService)) as IVsDifferenceService ?? throw new ArgumentNullException(nameof(vsDifferenceService));

            this.commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as IMenuCommandService ?? throw new ArgumentNullException(nameof(commandService));

            this.errorPresenter        = VsDIContainer.Instance.GetService(typeof(ErrorPresenter)) as ErrorPresenter ?? throw new ArgumentNullException(nameof(errorPresenter));
            this.gitFileDiffController = DIContainer.Instance.GetService(typeof(GitFileDiffController)) as GitFileDiffController ?? throw new ArgumentNullException(nameof(gitFileDiffController));
        }
        public bool ValidateBranch(IGitBranchDifferPackage package)
        {
            if (package is null)
            {
                this.errorPresenter.ShowError("Unable to load Git Branch Differ plug-in. It is possible Visual Studio is still initializing, please wait and try again.");

                return(false);
            }

            if (package.BranchToDiffAgainst is null || package.BranchToDiffAgainst == string.Empty)
            {
                this.errorPresenter.ShowError("Branch to diff against is not set. Go to Options -> Git Branch Differ -> Set \"Branch To Diff Against\"");
                return(false);
            }

            return(true);
        }
            public BranchDiffFilter(
                IGitBranchDifferPackage package,
                string solutionPath,
                IVsHierarchyItemCollectionProvider vsHierarchyItemCollectionProvider)
            {
                this.package           = package;
                this.solutionDirectory = solutionPath;
                this.vsHierarchyItemCollectionProvider = vsHierarchyItemCollectionProvider;
                this.Initialized += BranchDiffFilter_Initialized;

                // Dependencies that can be moved to constructor and resolved via IoC...
                this.branchDiffWorker    = DIContainer.Instance.GetService(typeof(GitBranchDiffController)) as GitBranchDiffController;
                this.branchDiffValidator = VsDIContainer.Instance.GetService(typeof(BranchDiffFilterValidator)) as BranchDiffFilterValidator;
                this.errorPresenter      = VsDIContainer.Instance.GetService(typeof(ErrorPresenter)) as ErrorPresenter;
                Assumes.Present(this.branchDiffWorker);
                Assumes.Present(this.branchDiffValidator);
                Assumes.Present(this.errorPresenter);
            }
        public OpenDiffCommand(
            IGitBranchDifferPackage package,
            DTE dte,
            IVsDifferenceService vsDifferenceService,
            IVsUIShell vsUIShell,
            OleMenuCommandService commandService,
            CommandID menuCommandId)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            this.package             = package ?? throw new ArgumentNullException(nameof(package));
            this.dte                 = dte ?? throw new ArgumentNullException(nameof(dte));
            this.vsDifferenceService = vsDifferenceService ?? throw new ArgumentNullException(nameof(vsDifferenceService));
            this.vsUIShell           = vsUIShell ?? throw new ArgumentNullException(nameof(vsUIShell));
            commandService           = commandService ?? throw new ArgumentNullException(nameof(commandService));

            var menuCommand = new OleMenuCommand(this.Execute, menuCommandId);

            OleCommandInstance = menuCommand;
            commandService.AddCommand(menuCommand);
        }
 /// <summary>
 /// One time initialization of the Solution Explorer filter, happens once per-Visual-Studio-startup.
 /// </summary>
 /// <param name="package">
 /// The package becomes a static dependency of this filter,
 /// and is required in order to get the plugin option <see cref="GitBranchDifferPackage.BranchToDiffAgainst"/> set by user.</param>
 public static void Initialize(IGitBranchDifferPackage package)
 {
     Package = package;
 }
Beispiel #8
0
 /// <summary>
 /// One time initialization of the Solution Explorer filter, happens once per-Visual-Studio-startup.
 /// </summary>
 /// <param name="package">
 /// The package becomes a static dependency of this filter,
 /// and is required in order to get the plugin option <see cref="GitBranchDifferPackage.BranchToDiffAgainst"/> set by user.</param>
 public static void Initialize(IGitBranchDifferPackage package)
 {
     Package = package;
     BranchDiffFilterProvider.TagManager = new ItemTagManager();
 }