Пример #1
0
            public static bool TestExecution(AnkhCommand commandEnum, object argument)
            {
                AnkhRuntime runtime = new AnkhRuntime(ServiceProviderHelper.serviceProvider);

                runtime.AddModule(new AnkhModule(runtime));
                runtime.Start();

                return(runtime.CommandMapper.Execute(commandEnum, new CommandEventArgs(commandEnum, runtime.Context, argument, false, false)));
            }
Пример #2
0
        public void SetUp()
        {
            sp = new AnkhServiceProvider();

            object pvar;
            var    shell = new Mock <SVsShell>().As <IVsShell>();

            shell.Setup(x => x.GetProperty(It.IsAny <int>(), out pvar)).Returns(-1);
            sp.AddService(typeof(SVsShell), shell.Object);

            var state = new Mock <IAnkhCommandStates>();

            state.SetupGet(x => x.SccProviderActive).Returns(true);
            state.SetupGet(x => x.SolutionExists).Returns(true);

            sp.AddService(typeof(IAnkhCommandStates), state.Object);

            var selection = new Mock <ISelectionContext>();

            selection.Setup(x => x.Cache[It.IsAny <object>()]).Returns(null);

            var rawHandle = new Mock <IVsSccProject2>();
            var p         = new SccProject("c:\foo\bar", rawHandle.Object);

            selection.Setup(x => x.GetSelectedProjects(It.IsAny <bool>())).Returns(new[] { p });
            sp.AddService(typeof(ISelectionContext), selection.Object);



            var pcMgr = new Mock <IPendingChangesManager>();

            sp.AddService(typeof(IPendingChangesManager), pcMgr.Object);



            var textMgr = new Mock <SVsTextManager>().As <IVsTextManager>();

            sp.AddService(typeof(SVsTextManager), textMgr.Object);

            var selectionMonitor = new Mock <IVsMonitorSelection>();

            sp.AddService(typeof(IVsMonitorSelection), selectionMonitor.Object);


            var r = new AnkhRuntime(sp);

            r.AddModule(new AnkhModule(r));
            r.AddModule(new AnkhSccModule(r));
            //r.AddModule(new AnkhVSModule(r));
            r.AddModule(new AnkhUIModule(r));
            r.AddModule(new AnkhDiffModule(r));
            r.Start();

            cm = r.GetService <CommandMapper>();
        }
Пример #3
0
        /////////////////////////////////////////////////////////////////////////////
        // Overridden Package Implementation
        #region Package Members

        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            AnkhRuntime  runtime = null;
            IAnkhPackage pkg     = GetService(typeof(IAnkhPackage)) as IAnkhPackage;

            if (pkg != null)
            {
                runtime = AnkhRuntime.Get(pkg);
            }

            if (runtime != null)
            {
                runtime.AddModule(new AnkhWpfModule(runtime));
                runtime.AddModule(new AnkhWpfUIModule(runtime));
            }
            else
            {
                Trace.WriteLine(string.Format("Failed to initialize {0}, because the Ankh Runtime is not available", typeof(AnkhSvnWpfPackage).FullName));
            }
        }
Пример #4
0
        /////////////////////////////////////////////////////////////////////////////
        // Overridden Package Implementation
        #region Package Members

        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override async System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            // Switches to the UI thread in order to consume some services used in command initialization
            await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            AnkhRuntime  runtime = null;
            IAnkhPackage pkg     = await GetServiceAsync(typeof(IAnkhPackage)) as IAnkhPackage;

            if (pkg != null)
            {
                runtime = AnkhRuntime.Get(pkg);
            }

            if (runtime != null)
            {
                runtime.AddModule(new AnkhWpfModule(runtime));
                runtime.AddModule(new AnkhWpfUIModule(runtime));
            }
            else
            {
                Trace.WriteLine(string.Format("Failed to initialize {0}, because the Ankh Runtime is not available", typeof(AnkhSvnWpfPackage).FullName));
            }
        }
Пример #5
0
 public AnkhSccModule(AnkhRuntime runtime)
     : base(runtime)
 {
 }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AnkhDiffModule"/> class.
 /// </summary>
 /// <param name="runtime">The runtime.</param>
 public AnkhDiffModule(AnkhRuntime runtime)
     : base(runtime)
 {
 }
Пример #7
0
 public AnkhUIModule(AnkhRuntime runtime)
     : base(runtime)
 {
 }
Пример #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AnkhDiffModule"/> class.
 /// </summary>
 /// <param name="runtime">The runtime.</param>
 public AnkhDiffModule(AnkhRuntime runtime)
     : base(runtime)
 {
 }
Пример #9
0
 public AnkhGitSccModule(AnkhRuntime runtime)
     : base(runtime)
 {
 }
Пример #10
0
 public AnkhWpfUIModule(AnkhRuntime runtime)
     : base(runtime)
 {
     Ankh.VS.WpfServices.VSColorProxy.Ensure();
 }
Пример #11
0
            public static bool TestExecution(AnkhCommand commandEnum, object argument)
            {
                AnkhRuntime runtime = new AnkhRuntime(ServiceProviderHelper.serviceProvider);
                runtime.AddModule(new AnkhModule(runtime));
                runtime.Start();

                return runtime.CommandMapper.Execute(commandEnum, new CommandEventArgs(commandEnum, runtime.Context, argument, false, false));
            }
Пример #12
0
        public void SetUp()
        {
            sp = new AnkhServiceProvider();

            object pvar;
            var shell = new Mock<SVsShell>().As<IVsShell>();
            shell.Setup(x => x.GetProperty(It.IsAny<int>(), out pvar)).Returns(-1);
            sp.AddService(typeof(SVsShell), shell.Object);

            var state = new Mock<IAnkhCommandStates>();
            state.SetupGet(x => x.SccProviderActive).Returns(true);
            state.SetupGet(x => x.SolutionExists).Returns(true);

            sp.AddService(typeof(IAnkhCommandStates), state.Object);

            var selection = new Mock<ISelectionContext>();
            selection.Setup(x => x.Cache[It.IsAny<object>()]).Returns(null);

            var rawHandle = new Mock<IVsSccProject2>();
            var p = new SvnProject("c:\foo\bar", rawHandle.Object);
            selection.Setup(x => x.GetSelectedProjects(It.IsAny<bool>())).Returns(new[] { p });
            sp.AddService(typeof(ISelectionContext), selection.Object);

            var pcMgr = new Mock<IPendingChangesManager>();
            sp.AddService(typeof(IPendingChangesManager), pcMgr.Object);

            var textMgr = new Mock<SVsTextManager>().As<IVsTextManager>();
            sp.AddService(typeof(SVsTextManager), textMgr.Object);

            var selectionMonitor = new Mock<IVsMonitorSelection>();
            sp.AddService(typeof(IVsMonitorSelection), selectionMonitor.Object);

            var r = new AnkhRuntime(sp);
            r.AddModule(new AnkhModule(r));
            r.AddModule(new AnkhSccModule(r));
            //r.AddModule(new AnkhVSModule(r));
            r.AddModule(new AnkhUIModule(r));
            r.AddModule(new AnkhDiffModule(r));
            r.Start();

            cm = r.GetService<CommandMapper>();
        }
Пример #13
0
 /// <summary>
 /// Default constructor of the package.
 /// Inside this method you can place any initialization code that does not require
 /// any Visual Studio service because at this point the package object is created but
 /// not sited yet inside Visual Studio environment. The place to do all the other
 /// initialization is the Initialize method.
 /// </summary>
 public AnkhSvnPackage()
 {
     _runtime = new AnkhRuntime(this);
 }