Пример #1
0
        private void DoAddRepository(object sender, EventArgs e)
        {
            string   repTypeId  = null;
            MenuItem senderItem = (MenuItem)sender;

            foreach (RepositoryType repType in SccPlugin.RepositoryTypes)
            {
                if (repType.Name == senderItem.Text)
                {
                    repTypeId = repType.Id;
                    break;
                }
            }
            if (repTypeId == null)
            {
                return;
            }

            ResourceProxy proxy = ResourceProxy.BeginNewResource(Props.RepositoryResource);

            proxy.SetProp(Core.Props.Name, "<unnamed>");
            proxy.SetProp(Props.RepositoryType, repTypeId);
            proxy.AddLink(Core.Props.Parent, Core.ResourceTreeManager.GetRootForType(Props.RepositoryResource));
            proxy.EndUpdate();

            SccPlugin.GetRepositoryType(repTypeId).EditRepository(this, proxy.Resource);

            RefreshRepositoryList(proxy.Resource);
        }
Пример #2
0
        public override void Execute(IActionContext context)
        {
            IResource      repository = context.SelectedResources[0];
            RepositoryType repType    = SccPlugin.GetRepositoryType(repository);

            repType.EditRepository(Core.MainWindow, repository);
        }
Пример #3
0
        private void _btnEditRepository_Click(object sender, EventArgs e)
        {
            RepositoryItem item    = (RepositoryItem)_lbxRepositories.SelectedItem;
            RepositoryType repType = SccPlugin.GetRepositoryType(item.Resource);

            repType.EditRepository(this, item.Resource);
            RefreshRepositoryList(item.Resource);
        }
Пример #4
0
 public override void Execute(IActionContext context)
 {
     foreach (IResource res in context.SelectedResources)
     {
         RepositoryType repType = SccPlugin.GetRepositoryType(res);
         if (repType != null)
         {
             repType.UpdateRepository(res);
         }
     }
 }
Пример #5
0
        private void _lnkFileName_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            IResource      repository = _changeSet.GetProp(Props.ChangeSetRepository);
            RepositoryType repType    = SccPlugin.GetRepositoryType(repository);
            string         url        = repType.BuildLinkToFile(repository, (FileChange)e.Link.LinkData);

            if (url != null)
            {
                Core.UIManager.OpenInNewBrowserWindow(url);
            }
        }
Пример #6
0
        public void DisplayResource(IResource resource)
        {
            _changeSet     = resource;
            _changeSetList = resource.ToResourceListLive();
            _changeSetList.ResourceChanged += HandleChangesetChanged;
            _edtDescription.Text            = resource.GetPropText(Core.Props.LongBody);
            HighlightDescriptionLinks();

            IResource      repository = _changeSet.GetProp(Props.ChangeSetRepository);
            RepositoryType repType    = SccPlugin.GetRepositoryType(repository);

            repType.OnChangesetSelected(repository, _changeSet);

            _changedFilesList.BeginUpdate();
            try
            {
                _changedFilesList.Items.Clear();
                foreach (FileChange fileChange in resource.GetLinksOfType(FileChange.ResourceType,
                                                                          Props.Change))
                {
                    if (Settings.HideUnchangedFiles)
                    {
                        if (!fileChange.Binary &&
                            fileChange.ChangeType == "edit" &&
                            String.IsNullOrEmpty(fileChange.Diff))
                        {
                            continue;
                        }
                    }

                    _changedFilesList.Items.Add(fileChange);
                }
            }
            finally
            {
                _changedFilesList.EndUpdate();
            }

            if (_changedFilesList.Items.Count == 0)
            {
                ClearSelectedChange();
                _lnkFileName.Links.Clear();
            }
            else
            {
                FileChange fileChange = (FileChange)_changedFilesList.Items [0];
                _changedFilesList.SelectedItem = fileChange;
                if (repType.BuildLinkToFile(repository, fileChange) == null)
                {
                    _lnkFileName.Links.Clear();
                }
            }
        }
Пример #7
0
        private void UpdateSelectedChange()
        {
            FileChange fileChange = (FileChange)_changedFilesList.SelectedItem;

            if (fileChange != null)
            {
                IResource      repository = _changeSet.GetProp(Props.ChangeSetRepository);
                RepositoryType repType    = SccPlugin.GetRepositoryType(repository);
                string         diffText   = repType.OnFileChangeSelected(repository, fileChange);
                _lnkFileName.Text = repType.BuildFileName(repository, fileChange);
                if (_lnkFileName.Links.Count == 1)
                {
                    _lnkFileName.Links [0].LinkData = fileChange;
                }

                _edtDiff.Clear();
                string changeType = fileChange.ChangeType;
                if (changeType == "add")
                {
                    _edtDiff.Text = "New file";
                }
                else if (changeType == "delete")
                {
                    _edtDiff.Text = "File deleted";
                }
                else if (fileChange.Binary)
                {
                    _edtDiff.Text = "Binary file";
                }
                else
                {
                    string diff = fileChange.Diff;
                    if (String.IsNullOrEmpty(diff))
                    {
                        _edtDiff.Text = diffText;
                    }
                    else
                    {
                        _edtDiff.Text = FilterWhitespaceOnlyDiffs(diff);
                        ColorizeDiff();
                    }
                }
            }
            else
            {
                ClearSelectedChange();
            }
        }
Пример #8
0
 public override void Execute(IActionContext context)
 {
     SccPlugin.SynchronizeRepositories();
 }
Пример #9
0
 public override string ToString()
 {
     return(_resource.GetProp(Core.Props.Name) + " (" +
            SccPlugin.GetRepositoryType(_resource).Name + ")");
 }