Ejemplo n.º 1
0
        public VSCommandRouting(IAnkhServiceProvider 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);
            }
        }
Ejemplo n.º 2
0
 public AnkhScheduler(IAnkhServiceProvider context)
     : base(context)
 {
     _timer = new Timer();
     _timer.Enabled = false;
     _timer.Elapsed += new ElapsedEventHandler(OnTimerElapsed);
 }
Ejemplo n.º 3
0
        public SolutionSettings(IAnkhServiceProvider 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;
        }
Ejemplo n.º 4
0
 protected virtual string GetDiff(IAnkhServiceProvider context, ISelectionContext selection)
 {
     return GetDiff(
         context,
         selection,
         null);
 }
Ejemplo n.º 5
0
        public void RefreshText(IAnkhServiceProvider context)
        {
            if (context == null)
                throw new ArgumentNullException("context");

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

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

            if (item == null)
                throw new InvalidOperationException(); // Item no longer valued
            PendingChangeStatus pcs = PendingChange.Change ?? new PendingChangeStatus(PendingChangeKind.None);

            SetValues(
                pcs.PendingCommitText,
                PendingChange.ChangeList,
                GetDirectory(item),
                PendingChange.FullPath,
                item.IsLocked ? PCStrings.LockedValue : "", // Locked
                SafeDate(item.Modified), // Modified
                PendingChange.Name,
                PendingChange.RelativePath,
                PendingChange.Project,
                context.GetService<IFileIconMapper>().GetFileType(item),
                SafeWorkingCopy(item));
        }
Ejemplo n.º 6
0
 public ProjectNotifier(IAnkhServiceProvider context)
     : base(context)
 {
     uint cookie;
     if (ErrorHandler.Succeeded(context.GetService<IVsShell>(typeof(SVsShell)).AdviseBroadcastMessages(this, out cookie)))
         _cookie = cookie;
 }
Ejemplo n.º 7
0
        public ExportDialog(IAnkhServiceProvider context)
            : this()
        {
            if (context == null)
                throw new ArgumentNullException("context");

            Context = context;
        }
Ejemplo n.º 8
0
 public AnkhClientPool(IAnkhServiceProvider context)
     : base(context)
 {
     _syncher = new Control();
     _syncher.Visible = false;
     _syncher.Text = "AnkhSVN Synchronizer";
     GC.KeepAlive(_syncher.Handle); // Ensure the window is created
 }
Ejemplo n.º 9
0
        public WCTreeNode(IAnkhServiceProvider context, WCTreeNode parent)
        {
            if (context == null)
                throw new ArgumentNullException("context");

            _context = context;
            _parent = parent;
        }
Ejemplo n.º 10
0
        protected AnkhCommandHook(IAnkhServiceProvider context, Control control)
            : base(context)
        {
            if (control == null)
                throw new ArgumentNullException("control");

            _control = control;
        }
Ejemplo n.º 11
0
        public CodeEditorWindow(IAnkhServiceProvider context, Control container)
            : base(context)
        {
            if (container == null)
                throw new ArgumentNullException("container");

            _container = container;
            _serviceProvider = context.GetService<IOleServiceProvider>();
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AnkhIdleArgs"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="idleFlags">The idle flags.</param>
 public AnkhIdleArgs(IAnkhServiceProvider 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));
 }
Ejemplo n.º 13
0
 public FileIconMapper(IAnkhServiceProvider 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);
 }
Ejemplo n.º 14
0
        public SynchronizeItem(IAnkhServiceProvider context, SynchronizeListItem listItem)
        {
            if (context == null)
                throw new ArgumentNullException("context");
            else if (listItem == null)
                throw new ArgumentNullException("listItem");

            _context = context;
            _listItem = listItem;
        }
Ejemplo n.º 15
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(IAnkhServiceProvider context, SvnProject project)
        {
            if (context == null)
                throw new ArgumentNullException("context");
            else if (project == null)
                throw new ArgumentNullException("project");

            _context = context;
            _project = project;
        }
Ejemplo n.º 16
0
        public RepositoryExplorerItem(IAnkhServiceProvider context, SvnOrigin origin, RepositoryListItem li)
        {
            if (context == null)
                throw new ArgumentNullException("context");
            else if (li == null)
                throw new ArgumentNullException("li");

            _context = context;
            _origin = origin;
            _li = li;
        }
Ejemplo n.º 17
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, IAnkhServiceProvider context)
        {
            if (selection == null)
                throw new ArgumentNullException("selection");
            if (context == null)
                throw new ArgumentNullException("context");

            IAnkhOpenDocumentTracker tracker = context.GetService<IAnkhOpenDocumentTracker>();
            if (tracker != null)
                tracker.SaveDocuments(selection.GetSelectedFiles(true));
        }
Ejemplo n.º 18
0
 /// <summary>
 /// Generates the diff from the current selection.
 /// </summary>
 /// <param name="context"></param>
 /// <param name="selection"></param>
 /// <param name="revisions"></param>
 /// <returns>The diff as a string.</returns>
 protected virtual string GetDiff(IAnkhServiceProvider context, ISelectionContext selection, SvnRevisionRange revisions)
 {
     return GetDiff(
         context,
         selection,
         revisions,
         delegate(SvnItem item)
         {
             return item.IsVersioned;
         });
 }
Ejemplo n.º 19
0
        public WCSolutionNode(IAnkhServiceProvider context, SvnItem item)
            : base(context, null, item)
        {
            string file = Context.GetService<IAnkhSolutionSettings>().SolutionFilename;

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

            if (string.IsNullOrEmpty(file))
                _imageIndex = iconMapper.GetIconForExtension(".sln");
            else
                _imageIndex = iconMapper.GetIcon(file);
        }
Ejemplo n.º 20
0
        public RepositoryExplorerItem(IAnkhServiceProvider context, SvnOrigin origin, RepositoryTreeNode tn)
        {
            if (context == null)
                throw new ArgumentNullException("context");
            else if (tn == null)
                throw new ArgumentNullException("tn");

            _context = context;
            _origin = origin;
            _tn = tn;
            _name = tn.Text;
        }
Ejemplo n.º 21
0
        public SccProjectFileReference(IAnkhServiceProvider 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);
        }
Ejemplo n.º 22
0
        public VSFormContainerPane(IAnkhServiceProvider 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;
        }
Ejemplo n.º 23
0
        internal SccDocumentData(IAnkhServiceProvider context, string name)
            : base(context)
        {
            if (string.IsNullOrEmpty(name))
                throw new ArgumentNullException("name");

            _name = name;

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

                HookFileChanges(true);
            }
        }
Ejemplo n.º 24
0
        bool EnsureAllProjectsLoaded(IAnkhServiceProvider context)
        {
            List<IVsHierarchy> unloaded = GetProjects(context, __VSENUMPROJFLAGS.EPF_UNLOADEDINSOLUTION);

            if(unloaded != null && unloaded.Count > 0)
            {
                AnkhMessageBox mb = new AnkhMessageBox(context);

                if(DialogResult.Yes != mb.Show("The solution contains unloaded projects. Any changes you make will not affect "+
                    "the unloaded projects.\n\nIt is strongly recommended that you reload all projects before continuing.\n\n" +
                    "Would you like to continue?", "Source Control", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Exclamation))
                    return false;
            }

            return true;
        }
Ejemplo n.º 25
0
        internal void CreateDiffEditor(IAnkhServiceProvider context, AnkhDiffArgs args)
        {
            Context = context;

            DynamicFactory.CreateEditor(args.BaseFile, this);
            OnFrameCreated(EventArgs.Empty);

            Collection <string> A, B;

            GetFileLines(args.BaseFile, args.MineFile, out A, out B);
            TextDiff   Diff   = new TextDiff(HashType.HashCode, false, false);
            EditScript Script = Diff.Execute(A, B);

            string strCaptionA = args.BaseTitle ?? Path.GetFileName(args.BaseFile);
            string strCaptionB = args.MineTitle ?? Path.GetFileName(args.MineFile);

            diffControl1.SetData(A, B, Script, strCaptionA, strCaptionB);
        }
        public void BrowsePath(IAnkhServiceProvider context, string path)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            else if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException("path");
            }

            folderTree.BrowsePath(path);

            if (context.GetService <ISvnStatusCache>()[path].IsFile)
            {
                fileList.SelectPath(path);
            }
        }
Ejemplo n.º 27
0
        public SolutionSettings(IAnkhServiceProvider context)
            : base(context)
        {
            IVsShell shell = GetService <IVsShell>(typeof(SVsShell));

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

            object r;

            if (VSErr.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;
        }
Ejemplo n.º 28
0
            public TheWpfEditorInfo(IAnkhServiceProvider context, IVsEditorAdaptersFactoryService adapterFactory, IVsTextView textView)
            {
                if (context == null)
                {
                    throw new ArgumentNullException("context");
                }
                else if (adapterFactory == null)
                {
                    throw new ArgumentNullException("adapterFactory");
                }
                else if (textView == null)
                {
                    throw new ArgumentNullException("textView");
                }

                _context        = context;
                _textView       = textView;
                _adapterFactory = adapterFactory;
            }
Ejemplo n.º 29
0
        public SccDocumentData(IAnkhServiceProvider context, string name)
            : base(context)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }

            ThreadHelper.ThrowIfNotOnUIThread();

            _name = name;

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

                HookFileChanges(true);
            }
        }
Ejemplo n.º 30
0
        public void OnExecute(CommandEventArgs e)
        {
            IAnkhServiceProvider context = e.Context;

            if (!EnsureAllProjectsLoaded(context))
            {
                return;
            }
            // TODO: Verify if all project files and the solution are open and saved

            using (ChangeSourceControl csc = new ChangeSourceControl())
            {
                csc.Context = e.Context;

                csc.Prepare();

                csc.ShowDialog(e.Context);
            }
        }
Ejemplo n.º 31
0
        public ProgressWorkerArgs(IAnkhServiceProvider context, SvnClient client, ISynchronizeInvoke sync)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            else if (client == null)
            {
                throw new ArgumentNullException("client");
            }
            else if (sync == null)
            {
                throw new ArgumentNullException("sync");
            }

            _context = context;
            _client  = client;
            _sync    = sync;
        }
Ejemplo n.º 32
0
        protected override void OnItemChecked(ItemCheckedEventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            base.OnItemChecked(e);

            if (_shell == null)
            {
                IAnkhServiceProvider sps = SelectionPublishServiceProvider;
                if (sps != null)
                {
                    _shell = sps.GetService <IVsUIShell>(typeof(SVsUIShell));
                }
            }
            if (_shell != null)
            {
                _shell.UpdateCommandUI(0); // Make sure the toolbar is updated on check actions
            }
        }
Ejemplo n.º 33
0
        public VSFormContainerPane(IAnkhServiceProvider 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;
        }
Ejemplo n.º 34
0
        public void StartMergesMerged(IAnkhServiceProvider context, SvnOrigin target, SvnTarget source)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            LogSource.Targets     = new SvnOrigin[] { new SvnOrigin(context, source, target.RepositoryRoot) }; // Must be from the same repository!
            LogSource.MergeTarget = target;
            Reset();
            revisionBox.Start(LogMode.MergesMerged);
        }
Ejemplo n.º 35
0
        bool EnsureAllProjectsLoaded(IAnkhServiceProvider context)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            List <IVsHierarchy> unloaded = GetProjects(context, __VSENUMPROJFLAGS.EPF_UNLOADEDINSOLUTION);

            if (unloaded != null && unloaded.Count > 0)
            {
                AnkhMessageBox mb = new AnkhMessageBox(context);

                if (DialogResult.Yes != mb.Show("The solution contains unloaded projects. Any changes you make will not affect " +
                                                "the unloaded projects.\n\nIt is strongly recommended that you reload all projects before continuing.\n\n" +
                                                "Would you like to continue?", "Source Control", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Exclamation))
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 36
0
        static Version GetCurrentVersion(IAnkhServiceProvider context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            if (_currentVersion != null)
            {
                return(_currentVersion);
            }

            IAnkhPackage pkg = context.GetService <IAnkhPackage>();

            if (pkg != null)
            {
                return(_currentVersion = pkg.PackageVersion);
            }
            return(_currentVersion = typeof(CheckForUpdates).Assembly.GetName().Version);
        }
Ejemplo n.º 37
0
        public VSCommandRouting(IAnkhServiceProvider context, VSContainerForm form)
            : base(context)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            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);

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

            if (_priorityCommandTarget != null)
            {
                if (!VSErr.Succeeded(_priorityCommandTarget.RegisterPriorityCommandTarget(0, this, out _csCookie)))
                {
                    _priorityCommandTarget = null;
                }
            }

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

            if (sel != null)
            {
                _activeStack = sel.PushPopupContext(form);
            }
        }
Ejemplo n.º 38
0
        public LogRevisionItem(LogRevisionControl listView, IAnkhServiceProvider context, SvnLoggingEventArgs e)
            : base(listView)
        {
            if (listView == null)
            {
                throw new ArgumentNullException("listView");
            }
            else if (context == null)
            {
                throw new ArgumentNullException("listView");
            }
            else if (e == null)
            {
                throw new ArgumentNullException("e");
            }

            _args    = e;
            _context = context;
            RefreshText();
            UpdateColors();
        }
Ejemplo n.º 39
0
        public VSDocumentFormPane(IAnkhServiceProvider context, VSDocumentInstance instance, VSEditorControl form)
            : base(context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            else if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }
            else if (form == null)
            {
                throw new ArgumentNullException("form");
            }

            _context  = context;
            _instance = instance;
            _form     = form;
            _host     = new VSDocumentHost(this);
        }
Ejemplo n.º 40
0
        public override void OnThemeChange(IAnkhServiceProvider sender, CancelEventArgs e)
        {
            IAnkhCommandStates states;

            if (VSVersion.SupportsTheming &&
                null != (states = sender.GetService <IAnkhCommandStates>()) &&
                states.ThemeLight)
            {
                e.Cancel = true;               // Don't ask VS to theme the header
                base.OnThemeChange(sender, e); /* Recreate handle while keeping state lists valid */

                ForeColor = Parent.ForeColor;
                BackColor = Parent.BackColor;

                // Re-enable after undoing theming
                ShowSelectAllCheckBox = true;

                return;
            }

            base.OnThemeChange(sender, e);
        }
Ejemplo n.º 41
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="utils"></param>
        public MergeWizard(IAnkhServiceProvider context, SvnItem mergeTarget)
        {
            InitializeComponent();

            DefaultPageImage = MergeStrings.MergeWizardHeaderImage;

            MergeUtils  = new MergeUtils(context);
            MergeTarget = mergeTarget;

            Text = MergeStrings.MergeWizardTitle;

            mergeTypePage     = new MergeTypePage();
            bestPracticesPage = new MergeBestPracticesPage();
            mergeSourceRangeOfRevisionsPage  = new MergeSourceRangeOfRevisionsPage();
            mergeSourceReintegratePage       = new MergeSourceReintegratePage();
            mergeSourceTwoDifferentTreesPage = new MergeSourceTwoDifferentTreesPage();
            mergeSourceManuallyRecordPage    = new MergeSourceManuallyRecordPage();
            mergeSourceManuallyRemovePage    = new MergeSourceManuallyRemovePage();
            mergeRevisionsSelectionPage      = new MergeRevisionsSelectionPage();
            mergeOptionsPage = new MergeOptionsPage();
            mergeSummaryPage = new MergeSummaryPage();
        }
Ejemplo n.º 42
0
        private void cloudForgePictureBox_Click(object sender, EventArgs e)
        {
            Control control         = this;
            IAnkhServiceProvider sp = control as IAnkhServiceProvider;

            while (control != null && sp == null)
            {
                control = control.Parent;
                sp      = control as IAnkhServiceProvider;
            }
            if (sp != null)
            {
                Ankh.VS.IAnkhWebBrowser wb = sp.GetService <Ankh.VS.IAnkhWebBrowser>();
                if (wb != null)
                {
                    Ankh.VS.AnkhBrowserArgs args = new Ankh.VS.AnkhBrowserArgs();
                    args.External = true;
                    Uri cfSignUpUrl = new Uri(CF_SIGNUP_URL);
                    wb.Navigate(cfSignUpUrl, args);
                }
            }
        }
Ejemplo n.º 43
0
        public VSDocumentFormPane(IAnkhServiceProvider context, VSDocumentInstance instance, FrameworkElement host)
            : base(context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            else if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }
            else if (host == null)
            {
                throw new ArgumentNullException("host");
            }

            _context  = context;
            _instance = instance;
            _form     = null;
            Content   = host;
            _host     = new VSDocumentHost(this);
        }
Ejemplo n.º 44
0
        public SccProjectData(SccProjectMap context, IVsSccProject2 project)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            else if (project == null)
            {
                throw new ArgumentNullException("project");
            }

            _context = context;
            _map     = context;

            // Project references to speed up marshalling
            _sccProject = project;
            _hierarchy  = (IVsHierarchy)project; // A project must be a hierarchy in VS
            _vsProject  = (IVsProject)project;   // A project must be a VS project

            _projectFlags = GetProjectFlags(ProjectTypeGuid);
            _files        = new SccProjectFileCollection();

            uint        addvpFlags;
            IVsSolution sln = GetService <IVsSolution>(typeof(SVsSolution));

            if (sln != null && VSErr.Succeeded(sln.GetVirtualProjectFlags(_hierarchy, out addvpFlags)))
            {
                if ((addvpFlags & (uint)__VSADDVPFLAGS.ADDVP_ExcludeFromSCC) != 0)
                {
                    _projectFlags |= SccProjectFlags.ExcludedFromScc;
                }
                if ((addvpFlags & (uint)__VSADDVPFLAGS.ADDVP_AddToProjectWindow) == 0)
                {
                    _projectFlags |= SccProjectFlags.DontAddToProjectWindow;
                }
            }
        }
Ejemplo n.º 45
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="utils"></param>
        public MergeWizard(IAnkhServiceProvider context, SvnItem mergeTarget)
        {
            InitializeComponent();

            DefaultPageImage = MergeStrings.MergeWizardHeaderImage;

            MergeUtils = new MergeUtils(context);
            MergeTarget = mergeTarget;

            Text = MergeStrings.MergeWizardTitle;

            mergeTypePage = new MergeTypePage();
            bestPracticesPage = new MergeBestPracticesPage();
            mergeSourceRangeOfRevisionsPage = new MergeSourceRangeOfRevisionsPage();
            mergeSourceReintegratePage = new MergeSourceReintegratePage();
            mergeSourceTwoDifferentTreesPage = new MergeSourceTwoDifferentTreesPage();
            mergeSourceManuallyRecordPage = new MergeSourceManuallyRecordPage();
            mergeSourceManuallyRemovePage = new MergeSourceManuallyRemovePage();
            mergeRevisionsSelectionPage = new MergeRevisionsSelectionPage();
            mergeOptionsPage = new MergeOptionsPage();
            mergeSummaryPage = new MergeSummaryPage();
        }
Ejemplo n.º 46
0
        /// <summary>
        /// Installs a visual studio command handler for the specified control
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="control">The control.</param>
        /// <param name="command">The command.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="updateHandler">The update handler.</param>
        public static void Install(IAnkhServiceProvider context, Control control, CommandID command, EventHandler <CommandEventArgs> handler, EventHandler <CommandUpdateEventArgs> updateHandler)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            else if (control == null)
            {
                throw new ArgumentNullException("control");
            }
            else if (command == null)
            {
                throw new ArgumentNullException("command");
            }

            IAnkhCommandHandlerInstallerService svc = context.GetService <IAnkhCommandHandlerInstallerService>();

            if (svc != null)
            {
                svc.Install(control, command, handler, updateHandler);
            }
        }
Ejemplo n.º 47
0
        public virtual void OnThemeChange(IAnkhServiceProvider sender, CancelEventArgs e)
        {
            ShowSelectAllCheckBox = false; // Not supported by VS theming. Disable to avoid problems and unnecessary work :(

            _isThemed = !e.Cancel;
            try
            {
                base.OnParentChanged(EventArgs.Empty); // Recreate handle, keeping state
            }
            catch (Exception ee)
            {
                IAnkhErrorHandler handler = sender.GetService <IAnkhErrorHandler>();

                if (handler != null && handler.IsEnabled(ee))
                {
                    handler.OnError(ee);
                }
                else
                {
                    throw;
                }
            }
        }
Ejemplo n.º 48
0
        private static string DoExternalDiff(IAnkhServiceProvider context, IEnumerable <SvnItem> selection, SvnRevision start, SvnRevision end)
        {
            foreach (SvnItem item in selection)
            {
                // skip unmodified for a diff against the textbase
                if (start == SvnRevision.Base && end == SvnRevision.Working && !item.IsModified)
                {
                    continue;
                }

                string tempDir = context.GetService <IAnkhTempDirManager>().GetTempDir();

                AnkhDiffArgs da = new AnkhDiffArgs();

                da.BaseFile = GetPath(context, start, item, tempDir);
                da.MineFile = GetPath(context, end, item, tempDir);


                context.GetService <IAnkhDiffHandler>().RunDiff(da);
            }

            return(null);
        }
Ejemplo n.º 49
0
        public static Uri DisplayBrowseDialogAndGetResult(WizardPage page, SvnItem target, Uri baseUri)
        {
            IAnkhServiceProvider context = ((MergeWizard)page.Wizard).Context;

            if (((MergeWizard)page.Wizard).MergeTarget.IsDirectory)
            {
                using (RepositoryFolderBrowserDialog dlg = new RepositoryFolderBrowserDialog())
                {
                    dlg.SelectedUri = baseUri;

                    if (dlg.ShowDialog(context) == DialogResult.OK)
                    {
                        return(dlg.SelectedUri);
                    }
                }
            }
            else
            {
                using (RepositoryOpenDialog dlg = new RepositoryOpenDialog())
                {
                    string fileName = Path.GetFileName(target.FullPath);

                    dlg.Context = context;
                    dlg.Filter  = fileName + "|" + fileName + "|All Files (*.*)|*";


                    dlg.SelectedUri = baseUri;

                    if (dlg.ShowDialog(context) == DialogResult.OK)
                    {
                        return(dlg.SelectedUri);
                    }
                }
            }

            return(null);
        }
Ejemplo n.º 50
0
        List<IVsHierarchy> GetProjects(IAnkhServiceProvider context, __VSENUMPROJFLAGS flags)
        {
            IVsSolution solution = context.GetService<IVsSolution>(typeof(SVsSolution));
            Guid gNone = Guid.Empty;
            IEnumHierarchies hierEnum;
            ErrorHandler.ThrowOnFailure(solution.GetProjectEnum((uint)flags, ref gNone, out hierEnum));

            IVsHierarchy[] hiers = new IVsHierarchy[32];
            List<IVsHierarchy> result = new List<IVsHierarchy>();

            uint fetched;
            while(ErrorHandler.Succeeded(hierEnum.Next((uint)hiers.Length, hiers, out fetched)))
            {
                if((int)fetched == hiers.Length)
                    result.AddRange(hiers);
                else if(fetched > 0)
                    for(int i = 0; i < (int)fetched; i++)
                        result.Add(hiers[i]);
                else
                    break;
            }

            return result;
        }
Ejemplo n.º 51
0
        List <IVsHierarchy> GetProjects(IAnkhServiceProvider context, __VSENUMPROJFLAGS flags)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            IVsSolution      solution = context.GetService <IVsSolution>(typeof(SVsSolution));
            Guid             gNone    = Guid.Empty;
            IEnumHierarchies hierEnum;

            Marshal.ThrowExceptionForHR(solution.GetProjectEnum((uint)flags, ref gNone, out hierEnum));

            IVsHierarchy[]      hiers  = new IVsHierarchy[32];
            List <IVsHierarchy> result = new List <IVsHierarchy>();

            uint fetched;

            while (VSErr.Succeeded(hierEnum.Next((uint)hiers.Length, hiers, out fetched)))
            {
                if ((int)fetched == hiers.Length)
                {
                    result.AddRange(hiers);
                }
                else if (fetched > 0)
                {
                    for (int i = 0; i < (int)fetched; i++)
                    {
                        result.Add(hiers[i]);
                    }
                }
                else
                {
                    break;
                }
            }

            return(result);
        }
Ejemplo n.º 52
0
 public IssueRepositoryConnectorProxy(IAnkhServiceProvider context, string name, string delegateServiceId)
 {
     _context = context;
     _name = name;
     _delegateId = delegateServiceId;
 }
Ejemplo n.º 53
0
 public InternalDiff(IAnkhServiceProvider context)
     : base(context)
 {
 }
Ejemplo n.º 54
0
 public AnkhWebBrowser(IAnkhServiceProvider context)
     : base(context)
 {
 }
Ejemplo n.º 55
0
 public AnkhDiff(IAnkhServiceProvider context)
     : base(context)
 {
 }
Ejemplo n.º 56
0
 public CommandMapper(IAnkhServiceProvider context, AnkhCommandContext commandContext)
     : this(context)
 {
     _commandContext = commandContext;
 }
Ejemplo n.º 57
0
 public CommandMapper(IAnkhServiceProvider context)
     : base(context)
 {
     _map = new Dictionary<AnkhCommand, CommandMapItem>();
 }
Ejemplo n.º 58
0
 public CommandState(IAnkhServiceProvider context)
     : base(context)
 {
 }
Ejemplo n.º 59
0
 public IssueTrackerConfigDialog(IAnkhServiceProvider context)
 {
     InitializeComponent();
     base.Context      = context;
     _connectorPageMap = new Dictionary <string, IssueRepositoryConfigurationPage>();
 }
Ejemplo n.º 60
0
 public TempDirManager(IAnkhServiceProvider context)
     : base(context)
 {
 }